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

16163 lines
598 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_editItem = (req, res) => {
res.send('<h2>ExACT Automated Test Script: CONTENT - Edit Item (ExACT_editItem) | 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 30 seconds');
console.log('Passed: My Content widget (content_sets.php) loaded successfully - Dashboard fully loaded');
//Final sleep to allow any remaining dynamic content to settle
await driver.sleep(2000);
console.log('Passed: ExACT Dashboard loaded successfully');
if (errors.length > 0) {
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
throw new Error(errors.join('\n'));
}
}
},
//Dashboard title
{
description: 'Validate dashboard title text, size, and color',
action: async () => {
const multipleChecks = 'Dashboard title';
const element = await driver.findElement(By.css('.e-heading'));
//Get text, font, size, and color
const elementText = await element.getText();
const 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(40, 39, 90, 1)') {
console.log('Passed: Total item count button background color matched as expected');
} else {
errors.push(`Expected: Total item count button background color: "rgba(40, 39, 90, 1)"; Actual: "${elementButtonColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//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, 'Biology content page did not fully load within 30 seconds');
//Wait until the element exists in the DOM
const filterResultsLabel = await driver.wait(
until.elementLocated(By.css('.well > b')),
30000
);
//Wait until it becomes visible
await driver.wait(
until.elementIsVisible(filterResultsLabel),
30000
);
//Wait for page to load completely
await driver.wait(async () => {
const readyState = await driver.executeScript('return document.readyState');
return readyState === 'complete';
}, 30000, 'Biology content page did not fully load within 30 seconds');
console.log('Passed: Biology content page loaded successfully');
}
},
//Biology - Content Results page
//Content result card 3 title
{
description: 'Validate Content result card 3 title',
action: async () => {
const multipleChecks = 'Content result card 3 title';
const element = await driver.findElement(By.linkText('4X4'));
//Get text, font, color, and size
const elementText = await element.getText('');
const elementFont = await element.getCssValue('font-family');
const elementSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
const elementURL = await element.getAttribute('href');
//Track all errors
const errors = [];
//text
if (elementText === '4X4') {
console.log('Passed: Content result card 3 title text matched as expected');
} else {
errors.push(`Expected: Content result card 3 title: "4X4"; Actual: "${elementText}"`);
}
//font-family
if (elementFont === "Poppins, sans-serif") {
console.log('Passed: Content result card 3 title text font matched as expected');
} else {
errors.push(`Expected: Content result card 3 title text font "Poppins, sans-serif"; Actual: ${elementFont}`);
}
//font size
if (elementSize === '13px') {
console.log('Passed: Content result card 3 title text font-size matched as expected');
} else {
errors.push(`Expected: Content result card 3 title text font-size "13px"; Actual: "${elementSize}"`);
}
//text color
if (elementTextColor === 'rgba(73, 80, 87, 1)') {
console.log('Passed: Content result card 3 title text color matched as expected');
} else {
errors.push(`Expected: Content result card 3 title text color: "rgba(73, 80, 87, 1)"; Actual: "${elementTextColor}"`);
}
//url
if (elementURL === 'http://pulse.pharmacy.arizona.edu/9th_grade/culture_cycles/science/4X4.html') {
console.log('Passed: Content result card 3 URL link matched as expected');
} else {
errors.push(`Expected: Content result card 3 URL: "http://pulse.pharmacy.arizona.edu/9th_grade/culture_cycles/science/4X4.html"; Actual: "${elementURL}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Content result card 3 edit button
{
description: 'Validate Content result card 3 edit button',
action: async () => {
const multipleChecks = 'Content result card 3 edit button';
const elementIcon = await driver.findElement(By.css('.card:nth-child(10) .lo-title .fa'));
const element = await driver.findElement(By.css('.card:nth-child(10) .ml-3'));
//Get text, font, color, and size
const elementText = await element.getText('');
const elementFont = await element.getCssValue('font-family');
const elementSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
const elementButtonColor = await element.getCssValue('background-color');
//Track all errors
const errors = [];
//icon
if (elementIcon) {
console.log('Passed: Content result card 3 button Edit icon is present');
} else {
errors.push('Content result card 3 button "Edit" icon was not found');
}
//text
if (elementText === 'Edit') {
console.log('Passed: Content result card 3 Edit button text matched as expected');
} else {
errors.push(`Expected: Content result card 3 button text: "Edit"; Actual: "${elementText}"`);
}
//font-family
if (elementFont === "Poppins, sans-serif") {
console.log('Passed: Content result card 3 Edit button text font matched as expected');
} else {
errors.push(`Expected: Content result card 3 Edit button text font "Poppins, sans-serif"; Actual: ${elementFont}`);
}
//font size
if (elementSize === '12px') {
console.log('Passed: Content result card 3 Edit button text font-size matched as expected');
} else {
errors.push(`Expected: Content result card 3 Edit button text font-size "12px"; Actual: "${elementSize}"`);
}
//text color
if (elementTextColor === 'rgba(255, 255, 255, 1)') {
console.log('Passed: Content result card 3 Edit button text color matched as expected');
} else {
errors.push(`Expected: Content result card 3 Edit button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`);
}
//button color
if (elementButtonColor === 'rgba(48, 200, 172, 1)') {
console.log('Passed: Content result card 3 Edit button background color matched as expected');
} else {
errors.push(`Expected: Content result card 3 Edit button background color: "rgba(48, 200, 172, 1)"; Actual: "${elementButtonColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Content result card 3 thumbnail
{
description: 'Verify Content result card 3 thumbnail',
action: async () => {
const multipleChecks = 'Content result card 3 thumbnail';
const element = await driver.wait(until.elementLocated(By.css('#pub > div:nth-child(10) > div > div > div:nth-child(1) > a')), 5000).catch(() => false);
const elementURL = await element.getAttribute('href');
//Track all errors
const errors = [];
//thumbnail
if (element) {
console.log('Passed: Content result card 3 thumbnail present');
} else {
errors.push('Content result card 3 thumbnail not found');
}
//url
if (elementURL === 'http://pulse.pharmacy.arizona.edu/9th_grade/culture_cycles/science/4X4.html') {
console.log('Passed: Content result card 3 thumbnail URL link matched as expected');
} else {
errors.push(`Expected: Content result card 3 thumbnail URL: "http://pulse.pharmacy.arizona.edu/9th_grade/culture_cycles/science/4X4.html"; Actual: "${elementURL}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Content result card 3 View Details button
{
description: 'Validate Content result card 3 View Details button',
action: async () => {
const multipleChecks = 'Content result card 3 View Details button';
const element = await driver.findElement(By.css('.card:nth-child(10) > .card-body > div > .btn'));
//Get text, font, color, and size
const elementText = await element.getText('');
const elementFont = await element.getCssValue('font-family');
const elementSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
const elementButtonColor = await element.getCssValue('background-color');
//Track all errors
const errors = [];
//text
if (elementText === 'View Details') {
console.log('Passed: Content result card 3 View Details button text matched as expected');
} else {
errors.push(`Expected: Content result card 3 button text: "View Details"; Actual: "${elementText}"`);
}
//font-family
if (elementFont === "Poppins, sans-serif") {
console.log('Passed: Content result card 3 View Details button text font matched as expected');
} else {
errors.push(`Expected: Content result card 3 View Details button text font "Poppins, sans-serif"; Actual: ${elementFont}`);
}
//font size
if (elementSize === '14px') {
console.log('Passed: Content result card 3 View Details button text font-size matched as expected');
} else {
errors.push(`Expected: Content result card 3 View Details button text font-size "14px"; Actual: "${elementSize}"`);
}
//text color
if (elementTextColor === 'rgba(255, 255, 255, 1)') {
console.log('Passed: Content result card 3 View Details button text color matched as expected');
} else {
errors.push(`Expected: Content result card 3 View Details button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`);
}
//button color
if (elementButtonColor === 'rgba(48, 200, 172, 1)') {
console.log('Passed: Content result card 3 View Details button background color matched as expected');
} else {
errors.push(`Expected: Content result card 3 View Details button background color: "rgba(48, 200, 172, 1)"; Actual: "${elementButtonColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Content result card 3 View Details - details (SPECIAL CASE: trim text)
{
description: 'Validate Content result card 3 View Details info',
action: async () => {
const multipleChecks = 'Content result card 3 View Details info';
//Track all errors
const errors = [];
//Target the specific content div using the matching onclick ID
const contentText = await driver.executeScript(`
const viewDetailsBtn = document.querySelector('a[onclick*="content1162099585"]');
if (!viewDetailsBtn) return 'button not found';
const div = viewDetailsBtn.previousElementSibling;
if (!div) return 'div not found';
return div.innerHTML
.replace(/<br>/gi, '\\n')
.replace(/<[^>]+>/g, '')
.trim();
`);
//console.log('----->| DEBUG content text:', contentText);
const expectedLines = [
'Alignment Status: Not Aligned',
'Content Type: Lesson Plan',
'Format: HTML',
'Free or Fee: Free',
'Grade Range: 8 to 12',
'Language: English',
'Level-On Target: 12',
'Source: University of Arizona',
'Subject(s): Science,Social Studies',
'Target Audience: Teacher'
];
const actualLines = contentText
.split('\n')
.map(line => line.trim())
.filter(line => line !== '');
//console.log('----->| DEBUG actual lines:', JSON.stringify(actualLines));
for (const expectedLine of expectedLines) {
if (actualLines.includes(expectedLine)) {
console.log(`Passed: Content result card 3 details: ${expectedLine} text matched as expected`);
} else {
errors.push(`Expected: "${expectedLine}" text not found in content 1 details`);
}
}
if (errors.length > 0) {
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
throw new Error(errors.join('\n'));
}
}
},
//Content result card 3 description
{
description: 'Validate Content result card 3 description',
action: async () => {
const multipleChecks = 'Content result card 3 description';
const element = await driver.findElement(By.css('.card:nth-child(10) .lo-descr'));
//Get text, font, color, and size
const elementText = await element.getText('');
const elementFont = await element.getCssValue('font-family');
const elementSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
//Extract the bare text node (everything that's not a tag)
const elementTrimmedText = await driver.executeScript(`
const el = arguments[0];
for (const node of el.childNodes) {
if (node.nodeType === Node.TEXT_NODE && node.textContent.trim()) {
return node.textContent.trim();
}
}
return null;
`, element);
//Track all errors
const errors = [];
//text
if (elementTrimmedText === 'In the previous lessons, students have considered first an article about new standards in groundwater arsenic levels and problems with compliance and the historical impact of arsenic. In this explain lesson, they are asked to generate 4 statements and 4 questions about arsenic based on these lessons. As the historical information is the most recent, and since the thrust of this learning cycle is to use arsenic as a focal point for discussions about groundwater, it will be useful to spend the first part of class revisiting the first article in light of what was learned in the explore lesson.') {
console.log('Passed: Content result card 3 description text found and matched as expected');
} else {
errors.push(`Expected: Content result card 3 description text to contain: "In the previous lessons, students have considered first an article about new standards in groundwater arsenic levels and problems with compliance and the historical impact of arsenic. In this explain lesson, they are asked to generate 4 statements and 4 questions about arsenic based on these lessons. As the historical information is the most recent, and since the thrust of this learning cycle is to use arsenic as a focal point for discussions about groundwater, it will be useful to spend the first part of class revisiting the first article in light of what was learned in the explore lesson."; Actual: "${elementTrimmedText}"`);
}
//font-family
if (elementFont === "Poppins, sans-serif") {
console.log('Passed: Content result card 3 description text font matched as expected');
} else {
errors.push(`Expected: Content result card 3 description text font "Poppins, sans-serif"; Actual: ${elementFont}`);
}
//font size
if (elementSize === '13px') {
console.log('Passed: Content result card 3 description text font-size matched as expected');
} else {
errors.push(`Expected: Content result card 3 description text font-size "13px"; Actual: "${elementSize}"`);
}
//text color
if (elementTextColor === 'rgba(40, 39, 90, 1)') {
console.log('Passed: Content result card 3 description text color matched as expected');
} else {
errors.push(`Expected: Content result card 3 description text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Content result card 3 Content Set
{
description: 'Validate Content result card 3 Content Set',
action: async () => {
const multipleChecks = 'Content result card 3 Content Set';
const element = await driver.findElement(By.css('.card:nth-child(10) small'));
//Get text, font, color, and size
const elementText = await element.getText('');
const elementFont = await element.getCssValue('font-family');
const elementSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//text
if (elementText === 'Content Set: Biology') {
console.log('Passed: Content result card 3 Content Set: Biology text matched as expected');
} else {
errors.push(`Expected: Content result card 3: "Content Set: Biology"; Actual: "${elementText}"`);
}
//font-family
if (elementFont === "Poppins, sans-serif") {
console.log('Passed: Content result card 3 Content Set: Biology text font matched as expected');
} else {
errors.push(`Expected: Content result card 3 Content Set: Biology text font "Poppins, sans-serif"; Actual: ${elementFont}`);
}
//font size
if (elementSize === '10.4px') {
console.log('Passed: Content result card 3 Content Set: Biology text font-size matched as expected');
} else {
errors.push(`Expected: Content result card 3 Content Set: Biology text font-size "10.4px"; Actual: "${elementSize}"`);
}
//text color
if (elementTextColor === 'rgba(40, 39, 90, 1)') {
console.log('Passed: Content result card 3 Content Set: Biology text color matched as expected');
} else {
errors.push(`Expected: Content result card 3 Content Set: Biology text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Content result card 3 Alignment Status
{
description: 'Validate Content result card 3 Alignment Status',
action: async () => {
const multipleChecks = 'Content result card 3 Alignment Status';
const element = await driver.findElement(By.css('#alignstatuslink1162099585 > .display-alignment'));
//Get text, font, color, and size
const elementText = await element.getText('');
const elementFont = await element.getCssValue('font-family');
const elementSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//text
if (elementText === 'Not Aligned') {
console.log('Passed: Content result card 3 Not Aligned text matched as expected');
} else {
errors.push(`Expected: Content result card 3: "Not Aligned"; Actual: "${elementText}"`);
}
//font-family
if (elementFont === "Poppins, sans-serif") {
console.log('Passed: Content result card 3 Not Aligned text font matched as expected');
} else {
errors.push(`Expected: Content result card 3 Not Aligned text font "Poppins, sans-serif"; Actual: ${elementFont}`);
}
//font size
if (elementSize === '13px') {
console.log('Passed: Content result card 3 Not Aligned text font-size matched as expected');
} else {
errors.push(`Expected: Content result card 3 Not Aligned text font-size "13px"; Actual: "${elementSize}"`);
}
//text color
if (elementTextColor === 'rgba(40, 39, 90, 1)') {
console.log('Passed: Content result card 3 Not Aligned text color matched as expected');
} else {
errors.push(`Expected: Content result card 3 Not Aligned text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Content result card 3 View Standards button
{
description: 'Validate Content result card 3 View Standards button',
action: async () => {
const multipleChecks = 'Content result card 3 View Standards button';
const elementIcon = await driver.findElement(By.css('.card:nth-child(10) .well .fa'));
const element = await driver.findElement(By.css('.card:nth-child(10) .well > .btn'));
//Get text, font, color, and size
const elementText = await element.getText('');
const elementFont = await element.getCssValue('font-family');
const elementSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
const elementButtonColor = await element.getCssValue('background-color');
//Track all errors
const errors = [];
//icon
if (elementIcon) {
console.log('Passed: Content result card 3 button View Standards icon is present');
} else {
errors.push('Content result card 3 button "View Standards" icon was not found');
}
//text
if (elementText === 'View Standards') {
console.log('Passed: Content result card 3 View Standards button text matched as expected');
} else {
errors.push(`Expected: Content result card 3 button text: "View Standards"; Actual: "${elementText}"`);
}
//font-family
if (elementFont === "Poppins, sans-serif") {
console.log('Passed: Content result card 3 View Standards button text font matched as expected');
} else {
errors.push(`Expected: Content result card 3 View Standards button text font "Poppins, sans-serif"; Actual: ${elementFont}`);
}
//font size
if (elementSize === '14px') {
console.log('Passed: Content result card 3 View Standards button text font-size matched as expected');
} else {
errors.push(`Expected: Content result card 3 View Standards button text font-size "14px"; Actual: "${elementSize}"`);
}
//text color
if (elementTextColor === 'rgba(255, 255, 255, 1)') {
console.log('Passed: Content result card 3 View Standards button text color matched as expected');
} else {
errors.push(`Expected: Content result card 3 View Standards button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`);
}
//button color
if (elementButtonColor === 'rgba(48, 200, 172, 1)') {
console.log('Passed: Content result card 3 View Standards button background color matched as expected');
} else {
errors.push(`Expected: Content result card 3 View Standards button background color: "rgba(48, 200, 172, 1)"; Actual: "${elementButtonColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//NEXT ACTION
{
description: 'Click Edit button',
action: async () => {
await driver.findElement(By.css('.card:nth-child(10) .ml-3')).click();
console.log('----->| NEXT ACTION: Clicked Content 4x4 Edit button');
//Wait for page to load completely
await driver.wait(async () => {
const readyState = await driver.executeScript('return document.readyState');
return readyState === 'complete';
}, 30000, 'Edit Item page did not fully load within 30 seconds');
//Wait until the element exists in the DOM
const pageTitle = await driver.wait(
until.elementLocated(By.css('#myModalLabel')),
30000
);
//Wait until it becomes visible
await driver.wait(
until.elementIsVisible(pageTitle),
30000
);
//Wait for page to load completely
await driver.wait(async () => {
const readyState = await driver.executeScript('return document.readyState');
return readyState === 'complete';
}, 30000, 'Edit Item page did not fully load within 30 seconds');
console.log('Passed: Edit Item page loaded successfully');
}
},
//Edit Item - Resource page
//Page title
{
description: 'Validate Edit page title text, size, and color',
action: async () => {
const multipleChecks = 'Edit page title';
const element = await driver.findElement(By.css('#myModalLabel'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//text
if (elementText === 'Edit Item') {
console.log('Passed: Edit page title text matched as expected');
} else {
errors.push(`Expected: "Edit Item"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === `"DM Serif Display", serif`) {
console.log('Passed: Edit page title font matched as expected');
} else {
errors.push(`Expected: Edit page title font "DM Serif Display, serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '32px') {
console.log('Passed: Edit page title text font-size matched as expected');
} else {
errors.push(`Expected: Edit page title text font-size "32px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(40, 39, 90, 1)') {
console.log('Passed: Edit page title text color matched as expected');
} else {
errors.push(`Expected: Edit page title text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Resource tab title (active)
{
description: 'Validate Resource tab title text, size, and color',
action: async () => {
const multipleChecks = 'Resource title';
const element = await driver.findElement(By.linkText('Resource'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//text
if (elementText === 'Resource') {
console.log('Passed: Resource tab title text matched as expected');
} else {
errors.push(`Expected: "Resource"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Resource tab title font matched as expected');
} else {
errors.push(`Expected: Resource tab title font "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '14px') {
console.log('Passed: Resource tab title text font-size matched as expected');
} else {
errors.push(`Expected: Resource tab title text font-size "14px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(40, 39, 90, 1)') {
console.log('Passed: Resource tab title text color matched as expected');
} else {
errors.push(`Expected: Resource tab title text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Metadata tab tab title
{
description: 'Validate Metadata tab title text, size, and color',
action: async () => {
const multipleChecks = 'Metadata tab title';
const element = await driver.findElement(By.linkText('Metadata'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//text
if (elementText === 'Metadata') {
console.log('Passed: Metadata tab title text matched as expected');
} else {
errors.push(`Expected: "Metadata"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Metadata tab title font matched as expected');
} else {
errors.push(`Expected: Metadata tab title font "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '14px') {
console.log('Passed: Metadata tab title text font-size matched as expected');
} else {
errors.push(`Expected: Metadata tab title text font-size "14px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(182, 186, 181, 1)') {
console.log('Passed: Metadata tab title text color matched as expected');
} else {
errors.push(`Expected: Metadata tab title text color: "rgba(182, 186, 181, 1)"; Actual: "${elementTextColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Concepts/Correlate tab title
{
description: 'Validate ConceptsCorrelate tab title text, size, and color',
action: async () => {
const multipleChecks = 'Concepts/Correlate title';
const element = await driver.findElement(By.linkText('Concepts/Correlate'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//text
if (elementText === 'Concepts/Correlate') {
console.log('Passed: Concepts/Correlate tab title text matched as expected');
} else {
errors.push(`Expected: "Concepts/Correlate"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Concepts/Correlate tab title font matched as expected');
} else {
errors.push(`Expected: Concepts/Correlate tab title font "DM Serif Display, serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '14px') {
console.log('Passed: Concepts/Correlate tab title text font-size matched as expected');
} else {
errors.push(`Expected: Concepts/Correlate tab title text font-size "14px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(182, 186, 181, 1)') {
console.log('Passed: Concepts/Correlate tab title text color matched as expected');
} else {
errors.push(`Expected: Concepts/Correlate tab title text color: "rgba(182, 186, 181, 1)"; Actual: "${elementTextColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Save Changes button
{
description: 'Validate Save Changes button',
action: async () => {
const multipleChecks = 'Save Changes button';
const elementIcon = await driver.findElement(By.css('.glyphicon-save'));
const element = await driver.findElement(By.css('.submit-content-button'));
//Get text, font, color, and size
const elementText = await element.getText('');
const elementFont = await element.getCssValue('font-family');
const elementSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
const elementButtonColor = await element.getCssValue('background-color');
//Track all errors
const errors = [];
//icon
if (elementIcon) {
console.log('Passed: Save Changes icon is present');
} else {
errors.push('Save Changes icon was not found');
}
//text
if (elementText === 'Save Changes') {
console.log('Passed: Save Changes button text matched as expected');
} else {
errors.push(`Expected: Button text: "Save Changes"; Actual: "${elementText}"`);
}
//font-family
if (elementFont === "Poppins, sans-serif") {
console.log('Passed: Save Changes button text font matched as expected');
} else {
errors.push(`Expected: Save Changes button text font "Poppins, sans-serif"; Actual: ${elementFont}`);
}
//font size
if (elementSize === '14px') {
console.log('Passed: Save Changes button text font-size matched as expected');
} else {
errors.push(`Expected: Save Changes button text font-size "14px"; Actual: "${elementSize}"`);
}
//text color
if (elementTextColor === 'rgba(255, 255, 255, 1)') {
console.log('Passed: Save Changes button text color matched as expected');
} else {
errors.push(`Expected: Save Changes button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`);
}
//button color
if (elementButtonColor === 'rgba(48, 200, 172, 1)') {
console.log('Passed: Save Changes button background color matched as expected');
} else {
errors.push(`Expected: Save Changes button background color: "rgba(48, 200, 172, 1)"; Actual: "${elementButtonColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//* Required label
{
description: 'Validate Required label text, size, and color',
action: async () => {
const multipleChecks = 'Required label';
const element = await driver.findElement(By.css('#tabsr-1 > div:nth-child(1)'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//text
if (elementText === '* Required') {
console.log('Passed: * Required label text matched as expected');
} else {
errors.push(`Expected: "* Required"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: * Required label font matched as expected');
} else {
errors.push(`Expected: * Required label font "DM Serif Display, serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '13px') {
console.log('Passed: * Required label text font-size matched as expected');
} else {
errors.push(`Expected: * Required label text font-size "13px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(255, 0, 0, 1)') {
console.log('Passed: * Required label text color matched as expected');
} else {
errors.push(`Expected: * Required label text color: "rgba(255, 0, 0, 1)"; Actual: "${elementTextColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Title label
{
description: 'Validate Title label text, size, and color',
action: async () => {
const multipleChecks = 'Title label';
const elementIcon = await driver.findElement(By.css('.form-group:nth-child(3) span'));
const element = await driver.findElement(By.css('.form-group:nth-child(3) > label'));
//Get text, font, size, and color
const elementIconText = await elementIcon.getText();
const elementIconTextColor = await elementIcon.getCssValue('color');
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//icon text
if (elementIconText === '*') {
console.log('Passed: * Title icon label text matched as expected');
} else {
errors.push(`Expected: "*" Title icon label; Actual: "${elementIconText}"`);
}
//icon color
if (elementIconTextColor === 'rgba(255, 0, 0, 1)') {
console.log('Passed: * Title icon label text color matched as expected');
} else {
errors.push(`Expected: * Title icon label text color: "rgba(255, 0, 0, 1)"; Actual: "${elementIconTextColor}"`);
}
//text
if (elementText === '* Title') {
console.log('Passed: * Title label text matched as expected');
} else {
errors.push(`Expected: "* Title"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: * Title label font matched as expected');
} else {
errors.push(`Expected: * Title label font "DM Serif Display, serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '13px') {
console.log('Passed: * Title label text font-size matched as expected');
} else {
errors.push(`Expected: * Title label text font-size "13px"; Actual: "${elementTextSize}"`);
}
//text color
if (elementTextColor === 'rgba(40, 39, 90, 1)') {
console.log('Passed: * Title label text color matched as expected');
} else {
errors.push(`Expected: * Title label text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Title textbox
{
description: 'Validate Title textbox',
action: async () => {
const multipleChecks = 'Title texbox';
const element = await driver.findElement(By.css('#cutitle'));
//Get text, font, size, and color
const elementText = await element.getAttribute('value');
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//text
if (elementText === '4X4') {
console.log('Passed: Title textbox text matched as expected');
} else {
errors.push(`Expected: Title: "4X4"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === "Poppins, sans-serif") {
console.log('Passed: Title textbox font matched as expected');
} else {
errors.push(`Expected: Title textbox font "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '16px') {
console.log('Passed: Title textbox font-size matched as expected');
} else {
errors.push(`Expected: Title textbox font-size "16px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(73, 80, 87, 1)') {
console.log('Passed: Title textbox color matched as expected');
} else {
errors.push(`Expected: Title textbox color: "rgba(73, 80, 87, 1)"; Actual: "${elementTextColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Description label
{
description: 'Validate Description label text, size, and color',
action: async () => {
const multipleChecks = 'Description label';
const element = await driver.findElement(By.css('.form-group:nth-child(4) > label'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//text
if (elementText === 'Description') {
console.log('Passed: Description label text matched as expected');
} else {
errors.push(`Expected: "Description"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Description label font matched as expected');
} else {
errors.push(`Expected: Description label font "DM Serif Display, serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '13px') {
console.log('Passed: Description label text font-size matched as expected');
} else {
errors.push(`Expected: Description label text font-size "13px"; Actual: "${elementTextSize}"`);
}
//text color
if (elementTextColor === 'rgba(40, 39, 90, 1)') {
console.log('Passed: Description label text color matched as expected');
} else {
errors.push(`Expected: Description label text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Description textbox
{
description: 'Validate Description textbox',
action: async () => {
const multipleChecks = 'Description texbox';
const element = await driver.findElement(By.css('#cudesc'));
//Get text, font, size, and color
const elementText = await element.getAttribute('value');
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//text
if (elementText === 'In the previous lessons, students have considered first an article about new standards in groundwater arsenic levels and problems with compliance and the historical impact of arsenic. In this explain lesson, they are asked to generate 4 statements and 4 questions about arsenic based on these lessons. As the historical information is the most recent, and since the thrust of this learning cycle is to use arsenic as a focal point for discussions about groundwater, it will be useful to spend the first part of class revisiting the first article in light of what was learned in the explore lesson.') {
console.log('Passed: Description textbox text matched as expected');
} else {
errors.push(`Expected: Description: "In the previous lessons, students have considered first an article about new standards in groundwater arsenic levels and problems with compliance and the historical impact of arsenic. In this explain lesson, they are asked to generate 4 statements and 4 questions about arsenic based on these lessons. As the historical information is the most recent, and since the thrust of this learning cycle is to use arsenic as a focal point for discussions about groundwater, it will be useful to spend the first part of class revisiting the first article in light of what was learned in the explore lesson."; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === "Poppins, sans-serif") {
console.log('Passed: Description textbox font matched as expected');
} else {
errors.push(`Expected: Description textbox font "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '16px') {
console.log('Passed: Description textbox font-size matched as expected');
} else {
errors.push(`Expected: Description textbox font-size "16px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(73, 80, 87, 1)') {
console.log('Passed: Description textbox color matched as expected');
} else {
errors.push(`Expected: Description textbox color: "rgba(73, 80, 87, 1)"; Actual: "${elementTextColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//URL label
{
description: 'Validate URL label text, size, and color',
action: async () => {
const multipleChecks = 'URL label';
const element = await driver.findElement(By.css('.form-group:nth-child(5) > label'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//text
if (elementText === 'URL') {
console.log('Passed: URL label text matched as expected');
} else {
errors.push(`Expected: "URL"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: URL label font matched as expected');
} else {
errors.push(`Expected: URL label font "DM Serif Display, serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '13px') {
console.log('Passed: URL label text font-size matched as expected');
} else {
errors.push(`Expected: URL label text font-size "13px"; Actual: "${elementTextSize}"`);
}
//text color
if (elementTextColor === 'rgba(40, 39, 90, 1)') {
console.log('Passed: URL label text color matched as expected');
} else {
errors.push(`Expected: URL label text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//URL textbox
{
description: 'Validate URL textbox',
action: async () => {
const multipleChecks = 'URL texbox';
const element = await driver.findElement(By.css('#cuurl'));
//Get text, font, size, and color
const elementText = await element.getAttribute('value');
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//text
if (elementText === 'http://pulse.pharmacy.arizona.edu/9th_grade/culture_cycles/science/4X4.html') {
console.log('Passed: URL textbox text matched as expected');
} else {
errors.push(`Expected: URL: "http://pulse.pharmacy.arizona.edu/9th_grade/culture_cycles/science/4X4.html"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === "Poppins, sans-serif") {
console.log('Passed: URL textbox font matched as expected');
} else {
errors.push(`Expected: URL textbox font "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '16px') {
console.log('Passed: URL textbox font-size matched as expected');
} else {
errors.push(`Expected: URL textbox font-size "16px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(73, 80, 87, 1)') {
console.log('Passed: URL textbox color matched as expected');
} else {
errors.push(`Expected: URL textbox color: "rgba(73, 80, 87, 1)"; Actual: "${elementTextColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Client Item ID label
{
description: 'Validate Client Item ID label text, size, and color',
action: async () => {
const multipleChecks = 'Client Item ID label';
const element = await driver.findElement(By.css('.form-group:nth-child(6) > label'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//text
if (elementText === 'Client Item ID') {
console.log('Passed: Client Item ID label text matched as expected');
} else {
errors.push(`Expected: "Client Item ID"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Client Item ID label font matched as expected');
} else {
errors.push(`Expected: Client Item ID label font "DM Serif Display, serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '13px') {
console.log('Passed: Client Item ID label text font-size matched as expected');
} else {
errors.push(`Expected: Client Item ID label text font-size "13px"; Actual: "${elementTextSize}"`);
}
//text color
if (elementTextColor === 'rgba(40, 39, 90, 1)') {
console.log('Passed: Client Item ID label text color matched as expected');
} else {
errors.push(`Expected: Client Item ID label text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Client Item ID textbox
{
description: 'Validate Client Item ID textbox',
action: async () => {
const multipleChecks = 'Client Item ID texbox';
const element = await driver.findElement(By.css('#culoid'));
//Get text, font, size, and color
const elementText = await element.getAttribute('value');
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//text
if (elementText === 'CMXUASC1411000001') {
console.log('Passed: Client Item ID textbox text matched as expected');
} else {
errors.push(`Expected: Client Item ID: "CMXUASC1411000001"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === "Poppins, sans-serif") {
console.log('Passed: Client Item ID textbox font matched as expected');
} else {
errors.push(`Expected: Client Item ID textbox font "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '16px') {
console.log('Passed: Client Item ID textbox font-size matched as expected');
} else {
errors.push(`Expected: Client Item ID textbox font-size "16px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(73, 80, 87, 1)') {
console.log('Passed: Client Item ID textbox color matched as expected');
} else {
errors.push(`Expected: Client Item ID textbox color: "rgba(73, 80, 87, 1)"; Actual: "${elementTextColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Content Set label
{
description: 'Validate Content Set label text, size, and color',
action: async () => {
const multipleChecks = 'Content Set label';
const elementIcon = await driver.findElement(By.css('.form-group:nth-child(7) span'));
const element = await driver.findElement(By.css('.form-group:nth-child(7) > label'));
//Get text, font, size, and color
const elementIconText = await elementIcon.getText();
const elementIconTextColor = await elementIcon.getCssValue('color');
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//icon text
if (elementIconText === '*') {
console.log('Passed: * Content Set icon label text matched as expected');
} else {
errors.push(`Expected: "*" Content Set icon label; Actual: "${elementIconText}"`);
}
//icon color
if (elementIconTextColor === 'rgba(255, 0, 0, 1)') {
console.log('Passed: * Content Set icon label text color matched as expected');
} else {
errors.push(`Expected: * Content Set icon label text color: "rgba(255, 0, 0, 1)"; Actual: "${elementIconTextColor}"`);
}
//text
if (elementText === '* Content Set') {
console.log('Passed: * Content Set label text matched as expected');
} else {
errors.push(`Expected: "* Content Set"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: * Content Set label font matched as expected');
} else {
errors.push(`Expected: * Content Set label font "DM Serif Display, serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '13px') {
console.log('Passed: * Content Set label text font-size matched as expected');
} else {
errors.push(`Expected: * Content Set label text font-size "13px"; Actual: "${elementTextSize}"`);
}
//text color
if (elementTextColor === 'rgba(40, 39, 90, 1)') {
console.log('Passed: * Content Set label text color matched as expected');
} else {
errors.push(`Expected: * Content Set label text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Content Set dropdown
{
description: 'Validate Content Set dropdown',
action: async () => {
const multipleChecks = 'Content Set List';
const elementDropdown = await driver.findElement(By.css('#orgs'));
const selectedOption = await elementDropdown.findElement(By.css('option:checked'));
const elementText = await selectedOption.getText();
const elementTextFont = await selectedOption.getCssValue('font-family');
const elementTextSize = await selectedOption.getCssValue('font-size');
const elementTextColor = await selectedOption.getCssValue('color');
const options = await elementDropdown.findElements(By.css('option'));
//Track all errors
const errors = [];
//text
if (elementText === 'Biology') {
console.log('Passed: Content Set dropdown text matched as expected');
} else {
throw new Error(`Expected: Content Set: "Biology"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === "Poppins, sans-serif") {
console.log('Passed: Content Set dropdown font matched as expected');
} else {
errors.push(`Expected: Content Set dropdown font "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '13px') {
console.log('Passed: Content Set dropdown font-size matched as expected');
} else {
errors.push(`Expected: Content Set dropdown font-size "13px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(40, 39, 90, 1)') {
console.log('Passed: Content Set dropdown color matched as expected');
} else {
errors.push(`Expected: Content Set dropdown color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`);
}
const expected = [
'Algebra',
'Biology',
'Copy Move Delete Test 1',
'Copy Move Delete Test 2',
'create me',
'English I',
'Import Align - Concept Based 1',
'Import Align - Concept Based 2',
'Import Align - Direct Align 1',
'Import Align - Direct Align 2',
'Math Alignment Import Test',
'US History III'
];
const actual = [];
for (const opt of options) {
const text = (await opt.getText()).trim();
actual.push(text);
}
if (JSON.stringify(actual) === JSON.stringify(expected)) {
console.log('Passed: Content Set - Dropdown list matched as expected');
} else {
throw new Error(`Expected: Content Set - Dropdown list: ${JSON.stringify(expected)}, Actual: ${JSON.stringify(actual)}`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Grades label
{
description: 'Validate Grades label text, size, and color',
action: async () => {
const multipleChecks = 'Grades label';
const elementIcon = await driver.findElement(By.css('.form-group:nth-child(8) span'));
const element = await driver.findElement(By.css('.form-group:nth-child(8) > label'));
//Get text, font, size, and color
const elementIconText = await elementIcon.getText();
const elementIconTextColor = await elementIcon.getCssValue('color');
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//icon text
if (elementIconText === '*') {
console.log('Passed: * Grades icon label text matched as expected');
} else {
errors.push(`Expected: "*" Grades icon label; Actual: "${elementIconText}"`);
}
//icon color
if (elementIconTextColor === 'rgba(255, 0, 0, 1)') {
console.log('Passed: * Grades icon label text color matched as expected');
} else {
errors.push(`Expected: * Grades icon label text color: "rgba(255, 0, 0, 1)"; Actual: "${elementIconTextColor}"`);
}
//text
if (elementText === '* Grades') {
console.log('Passed: * Grades label text matched as expected');
} else {
errors.push(`Expected: "* Grades"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: * Grades label font matched as expected');
} else {
errors.push(`Expected: * Grades label font "DM Serif Display, serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '13px') {
console.log('Passed: * Grades label text font-size matched as expected');
} else {
errors.push(`Expected: * Grades label text font-size "13px"; Actual: "${elementTextSize}"`);
}
//text color
if (elementTextColor === 'rgba(40, 39, 90, 1)') {
console.log('Passed: * Grades label text color matched as expected');
} else {
errors.push(`Expected: * Grades label text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Grade K
{
description: 'Validate Grade K text, size, and color',
action: async () => {
const multipleChecks = 'Grade K';
const elementIcon = await driver.findElement(By.css('#\\33 8'));
const element = await driver.findElement(By.css('.form-check:nth-child(3) > .form-check-label'));
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//icon
if (elementIcon) {
console.log('Passed: Grade K checkbox is present');
} else {
errors.push('Grade K checkbox was not found');
}
//text
if (elementText === 'K') {
console.log('Passed: Grade K label text matched as expected');
} else {
errors.push(`Expected: "K"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Grade K label font matched as expected');
} else {
errors.push(`Expected: Grade K label font "DM Serif Display, serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '13px') {
console.log('Passed: Grade K label text font-size matched as expected');
} else {
errors.push(`Expected: Grade K label text font-size "13px"; Actual: "${elementTextSize}"`);
}
//text color
if (elementTextColor === 'rgba(40, 39, 90, 1)') {
console.log('Passed: Grade K label text color matched as expected');
} else {
errors.push(`Expected: Grade K label text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Grade 1
{
description: 'Validate Grade 1 text, size, and color',
action: async () => {
const multipleChecks = 'Grade 1';
const elementIcon = await driver.findElement(By.css('#\\33 9'));
const element = await driver.findElement(By.css('.form-check:nth-child(4) > .form-check-label'));
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//icon
if (elementIcon) {
console.log('Passed: Grade 1 checkbox is present');
} else {
errors.push('Grade 1 checkbox was not found');
}
//text
if (elementText === '1') {
console.log('Passed: Grade 1 label text matched as expected');
} else {
errors.push(`Expected: "1"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Grade 1 label font matched as expected');
} else {
errors.push(`Expected: Grade 1 label font "DM Serif Display, serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '13px') {
console.log('Passed: Grade 1 label text font-size matched as expected');
} else {
errors.push(`Expected: Grade 1 label text font-size "13px"; Actual: "${elementTextSize}"`);
}
//text color
if (elementTextColor === 'rgba(40, 39, 90, 1)') {
console.log('Passed: Grade 1 label text color matched as expected');
} else {
errors.push(`Expected: Grade 1 label text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Grade 2
{
description: 'Validate Grade 2 text, size, and color',
action: async () => {
const multipleChecks = 'Grade 2';
const elementIcon = await driver.findElement(By.css('#\\34 0'));
const element = await driver.findElement(By.css('.form-check:nth-child(5) > .form-check-label'));
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//icon
if (elementIcon) {
console.log('Passed: Grade 2 checkbox is present');
} else {
errors.push('Grade 2 checkbox was not found');
}
//text
if (elementText === '2') {
console.log('Passed: Grade 2 label text matched as expected');
} else {
errors.push(`Expected: "2"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Grade 2 label font matched as expected');
} else {
errors.push(`Expected: Grade 2 label font "DM Serif Display, serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '13px') {
console.log('Passed: Grade 2 label text font-size matched as expected');
} else {
errors.push(`Expected: Grade 2 label text font-size "13px"; Actual: "${elementTextSize}"`);
}
//text color
if (elementTextColor === 'rgba(40, 39, 90, 1)') {
console.log('Passed: Grade 2 label text color matched as expected');
} else {
errors.push(`Expected: Grade 2 label text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Grade 3
{
description: 'Validate Grade 3 text, size, and color',
action: async () => {
const multipleChecks = 'Grade 3';
const elementIcon = await driver.findElement(By.css('#\\34 1'));
const element = await driver.findElement(By.css('.form-check:nth-child(6) > .form-check-label'));
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//icon
if (elementIcon) {
console.log('Passed: Grade 3 checkbox is present');
} else {
errors.push('Grade 3 checkbox was not found');
}
//text
if (elementText === '3') {
console.log('Passed: Grade 3 label text matched as expected');
} else {
errors.push(`Expected: "3"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Grade 3 label font matched as expected');
} else {
errors.push(`Expected: Grade 3 label font "DM Serif Display, serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '13px') {
console.log('Passed: Grade 3 label text font-size matched as expected');
} else {
errors.push(`Expected: Grade 3 label text font-size "13px"; Actual: "${elementTextSize}"`);
}
//text color
if (elementTextColor === 'rgba(40, 39, 90, 1)') {
console.log('Passed: Grade 3 label text color matched as expected');
} else {
errors.push(`Expected: Grade 3 label text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Grade 4
{
description: 'Validate Grade 4 text, size, and color',
action: async () => {
const multipleChecks = 'Grade 4';
const elementIcon = await driver.findElement(By.css('#\\34 3'));
const element = await driver.findElement(By.css('.form-check:nth-child(7) > .form-check-label'));
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//icon
if (elementIcon) {
console.log('Passed: Grade 4 checkbox is present');
} else {
errors.push('Grade 4 checkbox was not found');
}
//text
if (elementText === '4') {
console.log('Passed: Grade 4 label text matched as expected');
} else {
errors.push(`Expected: "4"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Grade 4 label font matched as expected');
} else {
errors.push(`Expected: Grade 4 label font "DM Serif Display, serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '13px') {
console.log('Passed: Grade 4 label text font-size matched as expected');
} else {
errors.push(`Expected: Grade 4 label text font-size "13px"; Actual: "${elementTextSize}"`);
}
//text color
if (elementTextColor === 'rgba(40, 39, 90, 1)') {
console.log('Passed: Grade 4 label text color matched as expected');
} else {
errors.push(`Expected: Grade 4 label text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Grade 5
{
description: 'Validate Grade 5 text, size, and color',
action: async () => {
const multipleChecks = 'Grade 5';
const elementIcon = await driver.findElement(By.css('#\\34 4'));
const element = await driver.findElement(By.css('.form-check:nth-child(8) > .form-check-label'));
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//icon
if (elementIcon) {
console.log('Passed: Grade 5 checkbox is present');
} else {
errors.push('Grade 5 checkbox was not found');
}
//text
if (elementText === '5') {
console.log('Passed: Grade 5 label text matched as expected');
} else {
errors.push(`Expected: "5"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Grade 5 label font matched as expected');
} else {
errors.push(`Expected: Grade 5 label font "DM Serif Display, serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '13px') {
console.log('Passed: Grade 5 label text font-size matched as expected');
} else {
errors.push(`Expected: Grade 5 label text font-size "13px"; Actual: "${elementTextSize}"`);
}
//text color
if (elementTextColor === 'rgba(40, 39, 90, 1)') {
console.log('Passed: Grade 5 label text color matched as expected');
} else {
errors.push(`Expected: Grade 5 label text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Grade 6
{
description: 'Validate Grade 6 text, size, and color',
action: async () => {
const multipleChecks = 'Grade 6';
const elementIcon = await driver.findElement(By.css('#\\34 5'));
const element = await driver.findElement(By.css('.form-check:nth-child(9) > .form-check-label'));
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//icon
if (elementIcon) {
console.log('Passed: Grade 6 checkbox is present');
} else {
errors.push('Grade 6 checkbox was not found');
}
//text
if (elementText === '6') {
console.log('Passed: Grade 6 label text matched as expected');
} else {
errors.push(`Expected: "6"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Grade 6 label font matched as expected');
} else {
errors.push(`Expected: Grade 6 label font "DM Serif Display, serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '13px') {
console.log('Passed: Grade 6 label text font-size matched as expected');
} else {
errors.push(`Expected: Grade 6 label text font-size "13px"; Actual: "${elementTextSize}"`);
}
//text color
if (elementTextColor === 'rgba(40, 39, 90, 1)') {
console.log('Passed: Grade 6 label text color matched as expected');
} else {
errors.push(`Expected: Grade 6 label text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Grade 7
{
description: 'Validate Grade 7 text, size, and color',
action: async () => {
const multipleChecks = 'Grade 7';
const elementIcon = await driver.findElement(By.css('#\\34 7'));
const element = await driver.findElement(By.css('.form-check:nth-child(10) > .form-check-label'));
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//icon
if (elementIcon) {
console.log('Passed: Grade 7 checkbox is present');
} else {
errors.push('Grade 7 checkbox was not found');
}
//text
if (elementText === '7') {
console.log('Passed: Grade 7 label text matched as expected');
} else {
errors.push(`Expected: "7"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Grade 7 label font matched as expected');
} else {
errors.push(`Expected: Grade 7 label font "DM Serif Display, serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '13px') {
console.log('Passed: Grade 7 label text font-size matched as expected');
} else {
errors.push(`Expected: Grade 7 label text font-size "13px"; Actual: "${elementTextSize}"`);
}
//text color
if (elementTextColor === 'rgba(40, 39, 90, 1)') {
console.log('Passed: Grade 7 label text color matched as expected');
} else {
errors.push(`Expected: Grade 7 label text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Grade 8
{
description: 'Validate Grade 8 text, size, and color',
action: async () => {
const multipleChecks = 'Grade 8';
const elementIcon = await driver.findElement(By.css('#\\34 8'));
const element = await driver.findElement(By.css('.form-check:nth-child(11) > .form-check-label'));
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//icon
if (elementIcon) {
console.log('Passed: Grade 8 checkbox is present');
} else {
errors.push('Grade 8 checkbox was not found');
}
//text
if (elementText === '8') {
console.log('Passed: Grade 8 label text matched as expected');
} else {
errors.push(`Expected: "8"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Grade 8 label font matched as expected');
} else {
errors.push(`Expected: Grade 8 label font "DM Serif Display, serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '13px') {
console.log('Passed: Grade 8 label text font-size matched as expected');
} else {
errors.push(`Expected: Grade 8 label text font-size "13px"; Actual: "${elementTextSize}"`);
}
//text color
if (elementTextColor === 'rgba(40, 39, 90, 1)') {
console.log('Passed: Grade 8 label text color matched as expected');
} else {
errors.push(`Expected: Grade 8 label text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Grade 9
{
description: 'Validate Grade 9 text, size, and color',
action: async () => {
const multipleChecks = 'Grade 9';
const elementIcon = await driver.findElement(By.css('#\\34 9'));
const element = await driver.findElement(By.css('.form-check:nth-child(12) > .form-check-label'));
const elementSelected = await elementIcon.getAttribute('checked');
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//icon
if (elementIcon) {
console.log('Passed: Grade 9 checkbox is present');
} else {
errors.push('Grade 9 checkbox was not found');
}
//selected
if (elementSelected) {
console.log('Passed: Grade 9 checkbox is selected');
} else {
errors.push('Grade 9 checkbox was not selected');
}
//text
if (elementText === '9') {
console.log('Passed: Grade 9 label text matched as expected');
} else {
errors.push(`Expected: "9"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Grade 9 label font matched as expected');
} else {
errors.push(`Expected: Grade 9 label font "DM Serif Display, serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '13px') {
console.log('Passed: Grade 9 label text font-size matched as expected');
} else {
errors.push(`Expected: Grade 9 label text font-size "13px"; Actual: "${elementTextSize}"`);
}
//text color
if (elementTextColor === 'rgba(40, 39, 90, 1)') {
console.log('Passed: Grade 9 label text color matched as expected');
} else {
errors.push(`Expected: Grade 9 label text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Grade 10
{
description: 'Validate Grade 10 text, size, and color',
action: async () => {
const multipleChecks = 'Grade 10';
const elementIcon = await driver.findElement(By.css('#\\35 1'));
const element = await driver.findElement(By.css('.form-check:nth-child(13) > .form-check-label'));
const elementSelected = await elementIcon.getAttribute('checked');
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//icon
if (elementIcon) {
console.log('Passed: Grade 10 checkbox is present');
} else {
errors.push('Grade 10 checkbox was not found');
}
//selected
if (elementSelected) {
console.log('Passed: Grade 10 checkbox is selected');
} else {
errors.push('Grade 10 checkbox was not selected');
}
//text
if (elementText === '10') {
console.log('Passed: Grade 10 label text matched as expected');
} else {
errors.push(`Expected: "10"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Grade 10 label font matched as expected');
} else {
errors.push(`Expected: Grade 10 label font "DM Serif Display, serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '13px') {
console.log('Passed: Grade 10 label text font-size matched as expected');
} else {
errors.push(`Expected: Grade 10 label text font-size "13px"; Actual: "${elementTextSize}"`);
}
//text color
if (elementTextColor === 'rgba(40, 39, 90, 1)') {
console.log('Passed: Grade 10 label text color matched as expected');
} else {
errors.push(`Expected: Grade 10 label text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Grade 11
{
description: 'Validate Grade 11 text, size, and color',
action: async () => {
const multipleChecks = 'Grade 11';
const elementIcon = await driver.findElement(By.css('#\\35 2'));
const element = await driver.findElement(By.css('.form-check:nth-child(14) > .form-check-label'));
const elementSelected = await elementIcon.getAttribute('checked');
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//icon
if (elementIcon) {
console.log('Passed: Grade 11 checkbox is present');
} else {
errors.push('Grade 11 checkbox was not found');
}
//selected
if (elementSelected) {
console.log('Passed: Grade 11 checkbox is selected');
} else {
errors.push('Grade 11 checkbox was not selected');
}
//text
if (elementText === '11') {
console.log('Passed: Grade 11 label text matched as expected');
} else {
errors.push(`Expected: "11"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Grade 11 label font matched as expected');
} else {
errors.push(`Expected: Grade 11 label font "DM Serif Display, serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '13px') {
console.log('Passed: Grade 11 label text font-size matched as expected');
} else {
errors.push(`Expected: Grade 11 label text font-size "13px"; Actual: "${elementTextSize}"`);
}
//text color
if (elementTextColor === 'rgba(40, 39, 90, 1)') {
console.log('Passed: Grade 11 label text color matched as expected');
} else {
errors.push(`Expected: Grade 11 label text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Grade 12
{
description: 'Validate Grade 12 text, size, and color',
action: async () => {
const multipleChecks = 'Grade 12';
const elementIcon = await driver.findElement(By.css('#\\35 3'));
const element = await driver.findElement(By.css('.form-check:nth-child(15) > .form-check-label'));
const elementSelected = await elementIcon.getAttribute('checked');
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//icon
if (elementIcon) {
console.log('Passed: Grade 12 checkbox is present');
} else {
errors.push('Grade 12 checkbox was not found');
}
//selected
if (elementSelected) {
console.log('Passed: Grade 12 checkbox is selected');
} else {
errors.push('Grade 12 checkbox was not selected');
}
//text
if (elementText === '12') {
console.log('Passed: Grade 12 label text matched as expected');
} else {
errors.push(`Expected: "12"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Grade 12 label font matched as expected');
} else {
errors.push(`Expected: Grade 12 label font "DM Serif Display, serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '13px') {
console.log('Passed: Grade 12 label text font-size matched as expected');
} else {
errors.push(`Expected: Grade 12 label text font-size "13px"; Actual: "${elementTextSize}"`);
}
//text color
if (elementTextColor === 'rgba(40, 39, 90, 1)') {
console.log('Passed: Grade 12 label text color matched as expected');
} else {
errors.push(`Expected: Grade 12 label text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//NEXT ACTION
{
description: 'Click Metadata tab link',
action: async () => {
await driver.findElement(By.linkText('Metadata')).click();
console.log('----->| NEXT ACTION: Clicked Metadata tab link');
//Wait for page to load completely
await driver.wait(async () => {
const readyState = await driver.executeScript('return document.readyState');
return readyState === 'complete';
}, 30000, 'Edit Item - Metadata page did not fully load within 30 seconds');
//Wait until the element exists in the DOM
const pageHeader = await driver.wait(
until.elementLocated(By.css('#tabsr-4 > div:nth-child(1) > b')),
30000
);
//Wait until it becomes visible
await driver.wait(
until.elementIsVisible(pageHeader),
30000
);
//Wait for page to load completely
await driver.wait(async () => {
const readyState = await driver.executeScript('return document.readyState');
return readyState === 'complete';
}, 30000, 'Edit Item - Metadata page did not fully load within 30 seconds');
console.log('Passed: Edit Item - Metadata page loaded successfully');
}
},
//Edit Item - Metadata page
//Page title
{
description: 'Validate Edit page title text, size, and color',
action: async () => {
const multipleChecks = 'Edit page title';
const element = await driver.findElement(By.css('#myModalLabel'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//text
if (elementText === 'Edit Item') {
console.log('Passed: Edit page title text matched as expected');
} else {
errors.push(`Expected: "Edit Item"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === `"DM Serif Display", serif`) {
console.log('Passed: Edit page title font matched as expected');
} else {
errors.push(`Expected: Edit page title font "DM Serif Display, serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '32px') {
console.log('Passed: Edit page title text font-size matched as expected');
} else {
errors.push(`Expected: Edit page title text font-size "32px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(40, 39, 90, 1)') {
console.log('Passed: Edit page title text color matched as expected');
} else {
errors.push(`Expected: Edit page title text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Resource tab title
{
description: 'Validate Resource tab title text, size, and color',
action: async () => {
const multipleChecks = 'Resource title';
const element = await driver.findElement(By.linkText('Resource'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//text
if (elementText === 'Resource') {
console.log('Passed: Resource tab title text matched as expected');
} else {
errors.push(`Expected: "Resource"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Resource tab title font matched as expected');
} else {
errors.push(`Expected: Resource tab title font "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '14px') {
console.log('Passed: Resource tab title text font-size matched as expected');
} else {
errors.push(`Expected: Resource tab title text font-size "14px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(182, 186, 181, 1)') {
console.log('Passed: Resource tab title text color matched as expected');
} else {
errors.push(`Expected: Resource tab title text color: "rgba(182, 186, 181, 1)"; Actual: "${elementTextColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Metadata tab tab title (active)
{
description: 'Validate Metadata tab title text, size, and color',
action: async () => {
const multipleChecks = 'Metadata tab title';
const element = await driver.findElement(By.linkText('Metadata'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//text
if (elementText === 'Metadata') {
console.log('Passed: Metadata tab title text matched as expected');
} else {
errors.push(`Expected: "Metadata"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Metadata tab title font matched as expected');
} else {
errors.push(`Expected: Metadata tab title font "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '14px') {
console.log('Passed: Metadata tab title text font-size matched as expected');
} else {
errors.push(`Expected: Metadata tab title text font-size "14px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(40, 39, 90, 1)') {
console.log('Passed: Metadata tab title text color matched as expected');
} else {
errors.push(`Expected: Metadata tab title text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Concepts/Correlate tab title
{
description: 'Validate ConceptsCorrelate tab title text, size, and color',
action: async () => {
const multipleChecks = 'Concepts/Correlate title';
const element = await driver.findElement(By.linkText('Concepts/Correlate'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//text
if (elementText === 'Concepts/Correlate') {
console.log('Passed: Concepts/Correlate tab title text matched as expected');
} else {
errors.push(`Expected: "Concepts/Correlate"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Concepts/Correlate tab title font matched as expected');
} else {
errors.push(`Expected: Concepts/Correlate tab title font "DM Serif Display, serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '14px') {
console.log('Passed: Concepts/Correlate tab title text font-size matched as expected');
} else {
errors.push(`Expected: Concepts/Correlate tab title text font-size "14px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(182, 186, 181, 1)') {
console.log('Passed: Concepts/Correlate tab title text color matched as expected');
} else {
errors.push(`Expected: Concepts/Correlate tab title text color: "rgba(182, 186, 181, 1)"; Actual: "${elementTextColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Save Changes button
{
description: 'Validate Save Changes button',
action: async () => {
const multipleChecks = 'Save Changes button';
const elementIcon = await driver.findElement(By.css('.glyphicon-save'));
const element = await driver.findElement(By.css('.submit-content-button'));
//Get text, font, color, and size
const elementText = await element.getText('');
const elementFont = await element.getCssValue('font-family');
const elementSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
const elementButtonColor = await element.getCssValue('background-color');
//Track all errors
const errors = [];
//icon
if (elementIcon) {
console.log('Passed: Save Changes icon is present');
} else {
errors.push('Save Changes icon was not found');
}
//text
if (elementText === 'Save Changes') {
console.log('Passed: Save Changes button text matched as expected');
} else {
errors.push(`Expected: Button text: "Save Changes"; Actual: "${elementText}"`);
}
//font-family
if (elementFont === "Poppins, sans-serif") {
console.log('Passed: Save Changes button text font matched as expected');
} else {
errors.push(`Expected: Save Changes button text font "Poppins, sans-serif"; Actual: ${elementFont}`);
}
//font size
if (elementSize === '14px') {
console.log('Passed: Save Changes button text font-size matched as expected');
} else {
errors.push(`Expected: Save Changes button text font-size "14px"; Actual: "${elementSize}"`);
}
//text color
if (elementTextColor === 'rgba(255, 255, 255, 1)') {
console.log('Passed: Save Changes button text color matched as expected');
} else {
errors.push(`Expected: Save Changes button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`);
}
//button color
if (elementButtonColor === 'rgba(48, 200, 172, 1)') {
console.log('Passed: Save Changes button background color matched as expected');
} else {
errors.push(`Expected: Save Changes button background color: "rgba(48, 200, 172, 1)"; Actual: "${elementButtonColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Field Name header
{
description: 'Validate Field Name header text, size, and color',
action: async () => {
const multipleChecks = 'Field Name header';
const element = await driver.findElement(By.css('#tabsr-4 > div:nth-child(1) > b'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//text
if (elementText === 'Field Name') {
console.log('Passed: Field Name header text matched as expected');
} else {
errors.push(`Expected: "Field Name"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Field Name header font matched as expected');
} else {
errors.push(`Expected: Field Name header font "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '13px') {
console.log('Passed: Field Name header text font-size matched as expected');
} else {
errors.push(`Expected: Field Name header text font-size "13px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(40, 39, 90, 1)') {
console.log('Passed: Field Name header text color matched as expected');
} else {
errors.push(`Expected: Field Name header text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Field Name dropdown (SPECIAL CASE: <li> elements with data-value)
{
description: 'Validate Field Name dropdown',
action: async () => {
const multipleChecks = 'Field Name dropdown';
const errors = [];
//Target the combobox input
const elementDropdown = await driver.wait(until.elementLocated(By.css('input.combobox.form-control')), 5000);
const elementText = await elementDropdown.getAttribute('placeholder');
const elementTextFont = await elementDropdown.getCssValue('font-family');
const elementTextSize = await elementDropdown.getCssValue('font-size');
const elementTextColor = await elementDropdown.getCssValue('color');
//Click to open dropdown
await driver.findElement(By.css('.input-group-text')).click();
console.log('----->| NEXT ACTION: Clicked Field Name dropdown arrow to open list');
//Wait for typeahead list to populate
await driver.wait(async () => {
const count = await driver.executeScript(`
return document.querySelectorAll('ul.typeahead li[data-value]').length;
`);
return count > 0;
}, 5000, 'Typeahead dropdown did not populate within 5 seconds');
//Now get the options
const actual = await driver.executeScript(`
const items = document.querySelectorAll('ul.typeahead li[data-value]');
return Array.from(items).map(li => li.getAttribute('data-value'));
`);
//console.log('----->| DEBUG actual options:', JSON.stringify(actual));
//placeholder text
if (elementText === 'Select/Enter Field...') {
console.log('Passed: Field Name dropdown placeholder matched as expected');
} else {
errors.push(`Expected: Field Name dropdown placeholder "Select/Enter Field..."; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Field Name dropdown font matched as expected');
} else {
errors.push(`Expected: Field Name dropdown font "Poppins, sans-serif"; Actual: "${elementTextFont}"`);
}
//font-size
if (elementTextSize === '16px') {
console.log('Passed: Field Name dropdown font-size matched as expected');
} else {
errors.push(`Expected: Field Name dropdown font-size "16px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(73, 80, 87, 1)') {
console.log('Passed: Field Name dropdown color matched as expected');
} else {
errors.push(`Expected: Field Name dropdown color "rgba(73, 80, 87, 1)"; Actual: "${elementTextColor}"`);
}
const expected = [
'Author Name',
'Career Cluster',
'Career Pathway',
'Content Type',
'Copyright Date',
'Descriptors',
'Entry-Level Education',
'For Kids',
'Format',
'Free or Fee',
'Grade Range',
'Grouping',
'High Grade',
'ICD 9',
'Includes',
'InstructorRequired',
'Language',
'Learning Style',
'Length',
'Level - Challenging',
'Level - On Target',
'Level - Skill Builder',
'Lexile Scale',
'Low Grade',
'Medical Focus',
'Method',
'Notes',
'Occupation',
'Pedagogy',
'Price',
'Producer',
'Reading Level',
'Source',
'StudentFacingDigital ',
'StudentFacingPrint',
'Subject',
'Submitted By',
'Target Audience',
'TeacherMaterials',
'Technology',
'Terms of Use'
];
if (JSON.stringify(actual) === JSON.stringify(expected)) {
console.log('Passed: Field Name dropdown list matched as expected');
} else {
errors.push(`Expected: Field Name dropdown list: ${JSON.stringify(expected)}\nActual: ${JSON.stringify(actual)}`);
}
//Click to close dropdown
await driver.findElement(By.css('.input-group-text')).click();
console.log('----->| NEXT ACTION: Clicked Field Name dropdown arrow to close list');
await driver.sleep(2000);
//Throw summary if any validation failed
if (errors.length > 0) {
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
throw new Error(errors.join('\n'));
}
}
},
//Value header
{
description: 'Validate Value header text, size, and color',
action: async () => {
const multipleChecks = 'Value header';
const element = await driver.findElement(By.css('div:nth-child(2) > b'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//text
if (elementText === 'Value') {
console.log('Passed: Value header text matched as expected');
} else {
errors.push(`Expected: "Value"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Value header font matched as expected');
} else {
errors.push(`Expected: Value header font "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '13px') {
console.log('Passed: Value header text font-size matched as expected');
} else {
errors.push(`Expected: Value header text font-size "13px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(40, 39, 90, 1)') {
console.log('Passed: Value header text color matched as expected');
} else {
errors.push(`Expected: Value header text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Value textbox
{
description: 'Verify Value textbox is present',
action: async () => {
const element = await driver.wait(until.elementLocated(By.css('#meta_value')), 5000).catch(() => false);
//Track all errors
const errors = [];
if (element) {
console.log('Passed: Value textbox appeared as expected');
} else {
errors.push('Value textbox not found');
}
}
},
//Add Metadata button
{
description: 'Validate Add Metadata button',
action: async () => {
const multipleChecks = 'Add Metadata button';
const element = await driver.findElement(By.css('.btn:nth-child(5)'));
//Get text, font, color, and size
const elementText = await element.getAttribute('value');
const elementFont = await element.getCssValue('font-family');
const elementSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
const elementButtonColor = await element.getCssValue('background-color');
//Track all errors
const errors = [];
//text
if (elementText === 'Add Metadata') {
console.log('Passed: Add Metadata button text matched as expected');
} else {
errors.push(`Expected: Button text: "Add Metadata"; Actual: "${elementText}"`);
}
//font-family
if (elementFont === "Poppins, sans-serif") {
console.log('Passed: Add Metadata button text font matched as expected');
} else {
errors.push(`Expected: Add Metadata button text font "Poppins, sans-serif"; Actual: ${elementFont}`);
}
//font size
if (elementSize === '16px') {
console.log('Passed: Add Metadata button text font-size matched as expected');
} else {
errors.push(`Expected: Add Metadata button text font-size "16px"; Actual: "${elementSize}"`);
}
//text color
if (elementTextColor === 'rgba(255, 255, 255, 1)') {
console.log('Passed: Add Metadata button text color matched as expected');
} else {
errors.push(`Expected: Add Metadata button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`);
}
//button color
if (elementButtonColor === 'rgba(48, 200, 172, 1)') {
console.log('Passed: Add Metadata button background color matched as expected');
} else {
errors.push(`Expected: Add Metadata button background color: "rgba(48, 200, 172, 1)"; Actual: "${elementButtonColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Current Metadata header
{
description: 'Validate Current Metadata header text, size, and color',
action: async () => {
const multipleChecks = 'Current Metadata header';
const element = await driver.findElement(By.css('span:nth-child(7)'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//text
if (elementText === 'Current Metadata') {
console.log('Passed: Current Metadata header text matched as expected');
} else {
errors.push(`Expected: "Current Metadata"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Current Metadata header font matched as expected');
} else {
errors.push(`Expected: Current Metadata header font "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '13px') {
console.log('Passed: Current Metadata header text font-size matched as expected');
} else {
errors.push(`Expected: Current Metadata header text font-size "13px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(40, 39, 90, 1)') {
console.log('Passed: Current Metadata header text color matched as expected');
} else {
errors.push(`Expected: Current Metadata header text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Name header
{
description: 'Validate Name header text, size, and color',
action: async () => {
const multipleChecks = 'Name header';
const element = await driver.findElement(By.css('th:nth-child(1)'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//text
if (elementText === 'Name') {
console.log('Passed: Name header text matched as expected');
} else {
errors.push(`Expected: "Name"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Name header font matched as expected');
} else {
errors.push(`Expected: Name header font "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '14.3px') {
console.log('Passed: Name header text font-size matched as expected');
} else {
errors.push(`Expected: Name header text font-size "14.3px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(33, 37, 41, 1)') {
console.log('Passed: Name header text color matched as expected');
} else {
errors.push(`Expected: Name header text color: "rgba(33, 37, 41, 1)"; Actual: "${elementTextColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Data header
{
description: 'Validate Data header text, size, and color',
action: async () => {
const multipleChecks = 'Data header';
const element = await driver.findElement(By.css('th:nth-child(2)'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//text
if (elementText === 'Data') {
console.log('Passed: Data header text matched as expected');
} else {
errors.push(`Expected: "Data"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Data header font matched as expected');
} else {
errors.push(`Expected: Data header font "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '14.3px') {
console.log('Passed: Data header text font-size matched as expected');
} else {
errors.push(`Expected: Data header text font-size "14.3px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(33, 37, 41, 1)') {
console.log('Passed: Data header text color matched as expected');
} else {
errors.push(`Expected: Data header text color: "rgba(33, 37, 41, 1)"; Actual: "${elementTextColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Ads label
{
description: 'Validate Ads label text, size, and color',
action: async () => {
const multipleChecks = 'Ads label';
const element = await driver.findElement(By.css('#m718311f909243a985798d8f4937c4308 > td:nth-child(1)'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//text
if (elementText === 'Ads') {
console.log('Passed: Ads label text matched as expected');
} else {
errors.push(`Expected: Label: "Ads"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Ads label font matched as expected');
} else {
errors.push(`Expected: Ads label font "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '14.3px') {
console.log('Passed: Ads label text font-size matched as expected');
} else {
errors.push(`Expected: Ads label text font-size "14.3px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(33, 37, 41, 1)') {
console.log('Passed: Ads label text color matched as expected');
} else {
errors.push(`Expected: Ads label text color: "rgba(33, 37, 41, 1)"; Actual: "${elementTextColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Ads textbox and delete icon
{
description: 'Validate Ads textbox and delete icon',
action: async () => {
const multipleChecks = 'Ads textbox and delete icon';
const element = await driver.findElement(By.css('#m718311f909243a985798d8f4937c4308 .form-control'));
const elementIcon = await driver.findElement(By.css('#m718311f909243a985798d8f4937c4308 > td:nth-child(3) > a'));
//Get text, font, size, and color
const elementText = await element.getAttribute('value');
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
const elementIconTooltip = await elementIcon.getAttribute('title');
//Track all errors
const errors = [];
//text
if (elementText === 'No') {
console.log('Passed: Ads data textbox text matched as expected');
} else {
errors.push(`Expected: Ads: "No"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === "Poppins, sans-serif") {
console.log('Passed: Ads data textbox font matched as expected');
} else {
errors.push(`Expected: Ads data textbox font "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '16px') {
console.log('Passed: Ads data textbox font-size matched as expected');
} else {
errors.push(`Expected: Ads data textbox font-size "16px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(73, 80, 87, 1)') {
console.log('Passed: Ads data textbox color matched as expected');
} else {
errors.push(`Expected: Ads data textbox color: "rgba(73, 80, 87, 1)"; Actual: "${elementTextColor}"`);
}
//icon tool-tip
if (elementIconTooltip === 'Remove Field') {
console.log('Passed: Ads Delete icon tool-tip text matched as expected');
} else {
errors.push(`Expected: Ads: "Remove Field"; Actual: "${elementIconTooltip}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Content Type label
{
description: 'Validate Content Type label text, size, and color',
action: async () => {
const multipleChecks = 'Content Type label';
const element = await driver.findElement(By.css('#mb2fa2c551d7d04604b3a90dfbffcde87 > td:nth-child(1)'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//text
if (elementText === 'Content Type') {
console.log('Passed: Content Type label text matched as expected');
} else {
errors.push(`Expected: Label: "Content Type"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Content Type label font matched as expected');
} else {
errors.push(`Expected: Content Type label font "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '14.3px') {
console.log('Passed: Content Type label text font-size matched as expected');
} else {
errors.push(`Expected: Content Type label text font-size "14.3px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(33, 37, 41, 1)') {
console.log('Passed: Content Type label text color matched as expected');
} else {
errors.push(`Expected: Content Type label text color: "rgba(33, 37, 41, 1)"; Actual: "${elementTextColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Content Type dropdown and delete icon
{
description: 'Validate Content Type dropdown and delete icon',
action: async () => {
const multipleChecks = 'Content Type dropdown and delete icon';
const element = await driver.findElement(By.css('#mb2fa2c551d7d04604b3a90dfbffcde87 .form-control'));
const selectedOption = await element.findElement(By.css('option:checked'));
const elementIcon = await driver.findElement(By.css('#mb2fa2c551d7d04604b3a90dfbffcde87 > td:nth-child(3) > a'));
//Get text, font, size, and color
const elementText = await element.getAttribute('value');
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
const elementIconTooltip = await elementIcon.getAttribute('title');
const options = await element.findElements(By.css('option'));
//Track all errors
const errors = [];
//text
if (elementText === 'Lesson Plan') {
console.log('Passed: Content Type data dropdown text matched as expected');
} else {
errors.push(`Expected: Content Type: "Lesson Plan"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === "Poppins, sans-serif") {
console.log('Passed: Content Type data dropdown font matched as expected');
} else {
errors.push(`Expected: Content Type data dropdown font "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '16px') {
console.log('Passed: Content Type data dropdown font-size matched as expected');
} else {
errors.push(`Expected: Content Type data dropdown font-size "16px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(73, 80, 87, 1)') {
console.log('Passed: Content Type data dropdown color matched as expected');
} else {
errors.push(`Expected: Content Type data dropdown color: "rgba(73, 80, 87, 1)"; Actual: "${elementTextColor}"`);
}
const expected = [
'Activity',
'Article',
'Assessment Question',
'Course',
'Curricular Theme',
'General Resource',
'Interactive Exercise',
'Interactive Resource',
'Lab Experiment',
'Lesson Plan',
'Quiz / Test',
'Teacher Guide',
'Timeline Resource',
'Tutorial',
'Unit',
'Worksheet'
];
const actual = [];
for (const opt of options) {
const text = (await opt.getText()).trim();
actual.push(text);
}
if (JSON.stringify(actual) === JSON.stringify(expected)) {
console.log('Passed: Content Type - Dropdown list matched as expected');
} else {
throw new Error(`Expected: Content Type - Dropdown list: ${JSON.stringify(expected)}, Actual: ${JSON.stringify(actual)}`);
}
//icon tool-tip
if (elementIconTooltip === 'Remove Field') {
console.log('Passed: Content Type Delete icon tool-tip text matched as expected');
} else {
errors.push(`Expected: Content Type: "Remove Field"; Actual: "${elementIconTooltip}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Format label
{
description: 'Validate Format label text, size, and color',
action: async () => {
const multipleChecks = 'Format label';
const element = await driver.findElement(By.css('#maf6ee65f869419e9bf9b091223b6da37 > td:nth-child(1)'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//text
if (elementText === 'Format') {
console.log('Passed: Format label text matched as expected');
} else {
errors.push(`Expected: Label: "Format"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Format label font matched as expected');
} else {
errors.push(`Expected: Format label font "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '14.3px') {
console.log('Passed: Format label text font-size matched as expected');
} else {
errors.push(`Expected: Format label text font-size "14.3px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(33, 37, 41, 1)') {
console.log('Passed: Format label text color matched as expected');
} else {
errors.push(`Expected: Format label text color: "rgba(33, 37, 41, 1)"; Actual: "${elementTextColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Format dropdown and delete icon
{
description: 'Validate Format dropdown and delete icon',
action: async () => {
const multipleChecks = 'Format dropdown and delete icon';
const element = await driver.findElement(By.css('#maf6ee65f869419e9bf9b091223b6da37 .form-control'));
const selectedOption = await element.findElement(By.css('option:checked'));
const elementIcon = await driver.findElement(By.css('#maf6ee65f869419e9bf9b091223b6da37 > td:nth-child(3) > a'));
//Get text, font, size, and color
const elementText = await element.getAttribute('value');
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
const elementIconTooltip = await elementIcon.getAttribute('title');
const options = await element.findElements(By.css('option'));
//Track all errors
const errors = [];
//text
if (elementText === 'HTML') {
console.log('Passed: Format data dropdown text matched as expected');
} else {
errors.push(`Expected: Format: "HTML"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === "Poppins, sans-serif") {
console.log('Passed: Format data dropdown font matched as expected');
} else {
errors.push(`Expected: Format data dropdown font "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '16px') {
console.log('Passed: Format data dropdown font-size matched as expected');
} else {
errors.push(`Expected: Format data dropdown font-size "16px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(73, 80, 87, 1)') {
console.log('Passed: Format data dropdown color matched as expected');
} else {
errors.push(`Expected: Format data dropdown color: "rgba(73, 80, 87, 1)"; Actual: "${elementTextColor}"`);
}
const expected = [
'HTML',
'Online Video',
'PDF'
];
const actual = [];
for (const opt of options) {
const text = (await opt.getText()).trim();
actual.push(text);
}
if (JSON.stringify(actual) === JSON.stringify(expected)) {
console.log('Passed: Format - Dropdown list matched as expected');
} else {
throw new Error(`Expected: Format - Dropdown list: ${JSON.stringify(expected)}, Actual: ${JSON.stringify(actual)}`);
}
//icon tool-tip
if (elementIconTooltip === 'Remove Field') {
console.log('Passed: Format Delete icon tool-tip text matched as expected');
} else {
errors.push(`Expected: Format: "Remove Field"; Actual: "${elementIconTooltip}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Free or Fee label
{
description: 'Validate Free or Fee label text, size, and color',
action: async () => {
const multipleChecks = 'Free or Fee label';
const element = await driver.findElement(By.css('#m351eb217b1f32cca4bafbfa2131bc449 > td:nth-child(1)'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//text
if (elementText === 'Free or Fee') {
console.log('Passed: Free or Fee label text matched as expected');
} else {
errors.push(`Expected: Label: "Free or Fee"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Free or Fee label font matched as expected');
} else {
errors.push(`Expected: Free or Fee label font "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '14.3px') {
console.log('Passed: Free or Fee label text font-size matched as expected');
} else {
errors.push(`Expected: Free or Fee label text font-size "14.3px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(33, 37, 41, 1)') {
console.log('Passed: Free or Fee label text color matched as expected');
} else {
errors.push(`Expected: Free or Fee label text color: "rgba(33, 37, 41, 1)"; Actual: "${elementTextColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Free or Fee dropdown and delete icon
{
description: 'Validate Free or Fee dropdown and delete icon',
action: async () => {
const multipleChecks = 'Free or Fee dropdown and delete icon';
const element = await driver.findElement(By.css('#m351eb217b1f32cca4bafbfa2131bc449 .form-control'));
const selectedOption = await element.findElement(By.css('option:checked'));
const elementIcon = await driver.findElement(By.css('#m351eb217b1f32cca4bafbfa2131bc449 > td:nth-child(3) > a'));
//Get text, font, size, and color
const elementText = await element.getAttribute('value');
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
const elementIconTooltip = await elementIcon.getAttribute('title');
const options = await element.findElements(By.css('option'));
//Track all errors
const errors = [];
//text
if (elementText === 'Free') {
console.log('Passed: Free or Fee data dropdown text matched as expected');
} else {
errors.push(`Expected: Free or Fee: "Free"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === "Poppins, sans-serif") {
console.log('Passed: Free or Fee data dropdown font matched as expected');
} else {
errors.push(`Expected: Free or Fee data dropdown font "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '16px') {
console.log('Passed: Free or Fee data dropdown font-size matched as expected');
} else {
errors.push(`Expected: Free or Fee data dropdown font-size "16px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(73, 80, 87, 1)') {
console.log('Passed: Free or Fee data dropdown color matched as expected');
} else {
errors.push(`Expected: Free or Fee data dropdown color: "rgba(73, 80, 87, 1)"; Actual: "${elementTextColor}"`);
}
const expected = [
'$$',
'Free',
'Free Samples'
];
const actual = [];
for (const opt of options) {
const text = (await opt.getText()).trim();
actual.push(text);
}
if (JSON.stringify(actual) === JSON.stringify(expected)) {
console.log('Passed: Free or Fee - Dropdown list matched as expected');
} else {
throw new Error(`Expected: Free or Fee - Dropdown list: ${JSON.stringify(expected)}, Actual: ${JSON.stringify(actual)}`);
}
//icon tool-tip
if (elementIconTooltip === 'Remove Field') {
console.log('Passed: Free or Fee Delete icon tool-tip text matched as expected');
} else {
errors.push(`Expected: Free or Fee: "Remove Field"; Actual: "${elementIconTooltip}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Grade Range label
{
description: 'Validate Grade Range label text, size, and color',
action: async () => {
const multipleChecks = 'Grade Range label';
const element = await driver.findElement(By.css('#mff2cd573a71e3519aed5b913db085dcf > td:nth-child(1)'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//text
if (elementText === 'Grade Range') {
console.log('Passed: Grade Range label text matched as expected');
} else {
errors.push(`Expected: Label: "Grade Range"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Grade Range label font matched as expected');
} else {
errors.push(`Expected: Grade Range label font "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '14.3px') {
console.log('Passed: Grade Range label text font-size matched as expected');
} else {
errors.push(`Expected: Grade Range label text font-size "14.3px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(33, 37, 41, 1)') {
console.log('Passed: Grade Range label text color matched as expected');
} else {
errors.push(`Expected: Grade Range label text color: "rgba(33, 37, 41, 1)"; Actual: "${elementTextColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Grade Range textbox and delete icon
{
description: 'Validate Grade Range textbox and delete icon',
action: async () => {
const multipleChecks = 'Grade Range textbox and delete icon';
const element = await driver.findElement(By.css('#mff2cd573a71e3519aed5b913db085dcf .form-control'));
const elementIcon = await driver.findElement(By.css('#mff2cd573a71e3519aed5b913db085dcf > td:nth-child(3) > a'));
//Get text, font, size, and color
const elementText = await element.getAttribute('value');
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
const elementIconTooltip = await elementIcon.getAttribute('title');
//Track all errors
const errors = [];
//text
if (elementText === '8 to 12') {
console.log('Passed: Grade Range data textbox text matched as expected');
} else {
errors.push(`Expected: Grade Range: "8 to 12"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === "Poppins, sans-serif") {
console.log('Passed: Grade Range data textbox font matched as expected');
} else {
errors.push(`Expected: Grade Range data textbox font "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '16px') {
console.log('Passed: Grade Range data textbox font-size matched as expected');
} else {
errors.push(`Expected: Grade Range data textbox font-size "16px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(73, 80, 87, 1)') {
console.log('Passed: Grade Range data textbox color matched as expected');
} else {
errors.push(`Expected: Grade Range data textbox color: "rgba(73, 80, 87, 1)"; Actual: "${elementTextColor}"`);
}
//icon tool-tip
if (elementIconTooltip === 'Remove Field') {
console.log('Passed: Grade Range Delete icon tool-tip text matched as expected');
} else {
errors.push(`Expected: Grade Range: "Remove Field"; Actual: "${elementIconTooltip}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Language label
{
description: 'Validate Language label text, size, and color',
action: async () => {
const multipleChecks = 'Language label';
const element = await driver.findElement(By.css('#m69a67e85dc8d37db26e54e93a8731eef > td:nth-child(1)'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//text
if (elementText === 'Language') {
console.log('Passed: Language label text matched as expected');
} else {
errors.push(`Expected: Label: "Language"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Language label font matched as expected');
} else {
errors.push(`Expected: Language label font "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '14.3px') {
console.log('Passed: Language label text font-size matched as expected');
} else {
errors.push(`Expected: Language label text font-size "14.3px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(33, 37, 41, 1)') {
console.log('Passed: Language label text color matched as expected');
} else {
errors.push(`Expected: Language label text color: "rgba(33, 37, 41, 1)"; Actual: "${elementTextColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Language dropdown and delete icon
{
description: 'Validate Language dropdown and delete icon',
action: async () => {
const multipleChecks = 'Language dropdown and delete icon';
const element = await driver.findElement(By.css('#m69a67e85dc8d37db26e54e93a8731eef .form-control'));
const selectedOption = await element.findElement(By.css('option:checked'));
const elementIcon = await driver.findElement(By.css('#m69a67e85dc8d37db26e54e93a8731eef > td:nth-child(3) > a'));
//Get text, font, size, and color
const elementText = await element.getAttribute('value');
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
const elementIconTooltip = await elementIcon.getAttribute('title');
const options = await element.findElements(By.css('option'));
//Track all errors
const errors = [];
//text
if (elementText === 'English') {
console.log('Passed: Language data dropdown text matched as expected');
} else {
errors.push(`Expected: Language: "English"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === "Poppins, sans-serif") {
console.log('Passed: Language data dropdown font matched as expected');
} else {
errors.push(`Expected: Language data dropdown font "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '16px') {
console.log('Passed: Language data dropdown font-size matched as expected');
} else {
errors.push(`Expected: Language data dropdown font-size "16px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(73, 80, 87, 1)') {
console.log('Passed: Language data dropdown color matched as expected');
} else {
errors.push(`Expected: Language data dropdown color: "rgba(73, 80, 87, 1)"; Actual: "${elementTextColor}"`);
}
const expected = [
'Arabic',
'English',
'French',
'German',
'Italian',
'Japanese',
'Latin',
'More Than One',
'Pacific Language',
'Portuguese',
'Spanish'
];
const actual = [];
for (const opt of options) {
const text = (await opt.getText()).trim();
actual.push(text);
}
if (JSON.stringify(actual) === JSON.stringify(expected)) {
console.log('Passed: Language - Dropdown list matched as expected');
} else {
throw new Error(`Expected: Language - Dropdown list: ${JSON.stringify(expected)}, Actual: ${JSON.stringify(actual)}`);
}
//icon tool-tip
if (elementIconTooltip === 'Remove Field') {
console.log('Passed: Language Delete icon tool-tip text matched as expected');
} else {
errors.push(`Expected: Language: "Remove Field"; Actual: "${elementIconTooltip}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Level-Challenging label
{
description: 'Validate LevelChallenging label text, size, and color',
action: async () => {
const multipleChecks = 'Level-Challenging label';
const element = await driver.findElement(By.css('#m8dd4934d544003c3ca1af42caaaf7985 > td:nth-child(1)'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//text
if (elementText === 'Level-Challenging') {
console.log('Passed: Level-Challenging label text matched as expected');
} else {
errors.push(`Expected: Label: "Level-Challenging"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Level-Challenging label font matched as expected');
} else {
errors.push(`Expected: Level-Challenging label font "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '14.3px') {
console.log('Passed: Level-Challenging label text font-size matched as expected');
} else {
errors.push(`Expected: Level-Challenging label text font-size "14.3px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(33, 37, 41, 1)') {
console.log('Passed: Level-Challenging label text color matched as expected');
} else {
errors.push(`Expected: Level-Challenging label text color: "rgba(33, 37, 41, 1)"; Actual: "${elementTextColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Level-Challenging textbox and delete icon
{
description: 'Validate LevelChallenging textbox and delete icon',
action: async () => {
const multipleChecks = 'Level-Challenging textbox and delete icon';
const element = await driver.findElement(By.css('#m8dd4934d544003c3ca1af42caaaf7985 .form-control'));
const elementIcon = await driver.findElement(By.css('#m8dd4934d544003c3ca1af42caaaf7985 > td:nth-child(3) > a'));
//Get text, font, size, and color
const elementText = await element.getAttribute('value');
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
const elementIconTooltip = await elementIcon.getAttribute('title');
//Track all errors
const errors = [];
//text
if (elementText === '8') {
console.log('Passed: Level-Challenging data textbox text matched as expected');
} else {
errors.push(`Expected: Level-Challenging: "8"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === "Poppins, sans-serif") {
console.log('Passed: Level-Challenging data textbox font matched as expected');
} else {
errors.push(`Expected: Level-Challenging data textbox font "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '16px') {
console.log('Passed: Level-Challenging data textbox font-size matched as expected');
} else {
errors.push(`Expected: Level-Challenging data textbox font-size "16px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(73, 80, 87, 1)') {
console.log('Passed: Level-Challenging data textbox color matched as expected');
} else {
errors.push(`Expected: Level-Challenging data textbox color: "rgba(73, 80, 87, 1)"; Actual: "${elementTextColor}"`);
}
//icon tool-tip
if (elementIconTooltip === 'Remove Field') {
console.log('Passed: Level-Challenging Delete icon tool-tip text matched as expected');
} else {
errors.push(`Expected: Level-Challenging: "Remove Field"; Actual: "${elementIconTooltip}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Level-On Target label
{
description: 'Validate LevelOn Target label text, size, and color',
action: async () => {
const multipleChecks = 'Level-On Target label';
const element = await driver.findElement(By.css('#md1a8bc96f5a2edcfa8ee134238cd5ead > td:nth-child(1)'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//text
if (elementText === 'Level-On Target') {
console.log('Passed: Level-On Target label text matched as expected');
} else {
errors.push(`Expected: Label: "Level-On Target"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Level-On Target label font matched as expected');
} else {
errors.push(`Expected: Level-On Target label font "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '14.3px') {
console.log('Passed: Level-On Target label text font-size matched as expected');
} else {
errors.push(`Expected: Level-On Target label text font-size "14.3px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(33, 37, 41, 1)') {
console.log('Passed: Level-On Target label text color matched as expected');
} else {
errors.push(`Expected: Level-On Target label text color: "rgba(33, 37, 41, 1)"; Actual: "${elementTextColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Level-On Target textbox and delete icon
{
description: 'Validate LevelOn Target textbox and delete icon',
action: async () => {
const multipleChecks = 'Level-On Target textbox and delete icon';
const element = await driver.findElement(By.css('#md1a8bc96f5a2edcfa8ee134238cd5ead .form-control'));
const elementIcon = await driver.findElement(By.css('#md1a8bc96f5a2edcfa8ee134238cd5ead > td:nth-child(3) > a'));
//Get text, font, size, and color
const elementText = await element.getAttribute('value');
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
const elementIconTooltip = await elementIcon.getAttribute('title');
//Track all errors
const errors = [];
//text
if (elementText === '12') {
console.log('Passed: Level-On Target data textbox text matched as expected');
} else {
errors.push(`Expected: Level-On Target: "12"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === "Poppins, sans-serif") {
console.log('Passed: Level-On Target data textbox font matched as expected');
} else {
errors.push(`Expected: Level-On Target data textbox font "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '16px') {
console.log('Passed: Level-On Target data textbox font-size matched as expected');
} else {
errors.push(`Expected: Level-On Target data textbox font-size "16px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(73, 80, 87, 1)') {
console.log('Passed: Level-On Target data textbox color matched as expected');
} else {
errors.push(`Expected: Level-On Target data textbox color: "rgba(73, 80, 87, 1)"; Actual: "${elementTextColor}"`);
}
//icon tool-tip
if (elementIconTooltip === 'Remove Field') {
console.log('Passed: Level-On Target Delete icon tool-tip text matched as expected');
} else {
errors.push(`Expected: Level-On Target: "Remove Field"; Actual: "${elementIconTooltip}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Level_Challenging label
{
description: 'Validate LevelChallenging label text, size, and color',
action: async () => {
const multipleChecks = 'Level_Challenging label';
const element = await driver.findElement(By.css('#m4aa48829c2cbcee79bc0d5c9c6b3a6c2 > td:nth-child(1)'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//text
if (elementText === 'Level_Challenging') {
console.log('Passed: Level_Challenging label text matched as expected');
} else {
errors.push(`Expected: Label: "Level_Challenging"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Level_Challenging label font matched as expected');
} else {
errors.push(`Expected: Level_Challenging label font "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '14.3px') {
console.log('Passed: Level_Challenging label text font-size matched as expected');
} else {
errors.push(`Expected: Level_Challenging label text font-size "14.3px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(33, 37, 41, 1)') {
console.log('Passed: Level_Challenging label text color matched as expected');
} else {
errors.push(`Expected: Level_Challenging label text color: "rgba(33, 37, 41, 1)"; Actual: "${elementTextColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Level_Challenging textbox and delete icon
{
description: 'Validate LevelChallenging textbox and delete icon',
action: async () => {
const multipleChecks = 'Level_Challenging textbox and delete icon';
const element = await driver.findElement(By.css('#m4aa48829c2cbcee79bc0d5c9c6b3a6c2 .form-control'));
const elementIcon = await driver.findElement(By.css('#m4aa48829c2cbcee79bc0d5c9c6b3a6c2 > td:nth-child(3) > a'));
//Get text, font, size, and color
const elementText = await element.getAttribute('value');
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
const elementIconTooltip = await elementIcon.getAttribute('title');
//Track all errors
const errors = [];
//text
if (elementText === '8') {
console.log('Passed: Level_Challenging data textbox text matched as expected');
} else {
errors.push(`Expected: Level_Challenging: "8"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === "Poppins, sans-serif") {
console.log('Passed: Level_Challenging data textbox font matched as expected');
} else {
errors.push(`Expected: Level_Challenging data textbox font "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '16px') {
console.log('Passed: Level_Challenging data textbox font-size matched as expected');
} else {
errors.push(`Expected: Level_Challenging data textbox font-size "16px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(73, 80, 87, 1)') {
console.log('Passed: Level_Challenging data textbox color matched as expected');
} else {
errors.push(`Expected: Level_Challenging data textbox color: "rgba(73, 80, 87, 1)"; Actual: "${elementTextColor}"`);
}
//icon tool-tip
if (elementIconTooltip === 'Remove Field') {
console.log('Passed: Level_Challenging Delete icon tool-tip text matched as expected');
} else {
errors.push(`Expected: Level_Challenging: "Remove Field"; Actual: "${elementIconTooltip}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Level_On Target label
{
description: 'Validate LevelOn Target label text, size, and color',
action: async () => {
const multipleChecks = 'Level_On Target label';
const element = await driver.findElement(By.css('#m19a1d038868c30f294ee5045203780c1 > td:nth-child(1)'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//text
if (elementText === 'Level_On Target') {
console.log('Passed: Level_On Target label text matched as expected');
} else {
errors.push(`Expected: Label: "Level_On Target"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Level_On Target label font matched as expected');
} else {
errors.push(`Expected: Level_On Target label font "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '14.3px') {
console.log('Passed: Level_On Target label text font-size matched as expected');
} else {
errors.push(`Expected: Level_On Target label text font-size "14.3px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(33, 37, 41, 1)') {
console.log('Passed: Level_On Target label text color matched as expected');
} else {
errors.push(`Expected: Level_On Target label text color: "rgba(33, 37, 41, 1)"; Actual: "${elementTextColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Level_On Target textbox and delete icon
{
description: 'Validate LevelOn Target textbox and delete icon',
action: async () => {
const multipleChecks = 'Level_On Target textbox and delete icon';
const element = await driver.findElement(By.css('#m19a1d038868c30f294ee5045203780c1 .form-control'));
const elementIcon = await driver.findElement(By.css('#m19a1d038868c30f294ee5045203780c1 > td:nth-child(3) > a'));
//Get text, font, size, and color
const elementText = await element.getAttribute('value');
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
const elementIconTooltip = await elementIcon.getAttribute('title');
//Track all errors
const errors = [];
//text
if (elementText === '9,10,11,12') {
console.log('Passed: Level_On Target data textbox text matched as expected');
} else {
errors.push(`Expected: Level_On Target: "9,10,11,12"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === "Poppins, sans-serif") {
console.log('Passed: Level_On Target data textbox font matched as expected');
} else {
errors.push(`Expected: Level_On Target data textbox font "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '16px') {
console.log('Passed: Level_On Target data textbox font-size matched as expected');
} else {
errors.push(`Expected: Level_On Target data textbox font-size "16px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(73, 80, 87, 1)') {
console.log('Passed: Level_On Target data textbox color matched as expected');
} else {
errors.push(`Expected: Level_On Target data textbox color: "rgba(73, 80, 87, 1)"; Actual: "${elementTextColor}"`);
}
//icon tool-tip
if (elementIconTooltip === 'Remove Field') {
console.log('Passed: Level_On Target Delete icon tool-tip text matched as expected');
} else {
errors.push(`Expected: Level_On Target: "Remove Field"; Actual: "${elementIconTooltip}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Login Required label
{
description: 'Validate Login Required label text, size, and color',
action: async () => {
const multipleChecks = 'Login Required label';
const element = await driver.findElement(By.css('#m66634eae9c5df8a656d5862b2f3c61b1 > td:nth-child(1)'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//text
if (elementText === 'Login Required') {
console.log('Passed: Login Required label text matched as expected');
} else {
errors.push(`Expected: Label: "Login Required"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Login Required label font matched as expected');
} else {
errors.push(`Expected: Login Required label font "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '14.3px') {
console.log('Passed: Login Required label text font-size matched as expected');
} else {
errors.push(`Expected: Login Required label text font-size "14.3px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(33, 37, 41, 1)') {
console.log('Passed: Login Required label text color matched as expected');
} else {
errors.push(`Expected: Login Required label text color: "rgba(33, 37, 41, 1)"; Actual: "${elementTextColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Login Required textbox and delete icon
{
description: 'Validate Login Required textbox and delete icon',
action: async () => {
const multipleChecks = 'Login Required textbox and delete icon';
const element = await driver.findElement(By.css('#m66634eae9c5df8a656d5862b2f3c61b1 .form-control'));
const elementIcon = await driver.findElement(By.css('#m66634eae9c5df8a656d5862b2f3c61b1 > td:nth-child(3) > a'));
//Get text, font, size, and color
const elementText = await element.getAttribute('value');
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
const elementIconTooltip = await elementIcon.getAttribute('title');
//Track all errors
const errors = [];
//text
if (elementText === 'No') {
console.log('Passed: Login Required data textbox text matched as expected');
} else {
errors.push(`Expected: Login Required: "No"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === "Poppins, sans-serif") {
console.log('Passed: Login Required data textbox font matched as expected');
} else {
errors.push(`Expected: Login Required data textbox font "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '16px') {
console.log('Passed: Login Required data textbox font-size matched as expected');
} else {
errors.push(`Expected: Login Required data textbox font-size "16px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(73, 80, 87, 1)') {
console.log('Passed: Login Required data textbox color matched as expected');
} else {
errors.push(`Expected: Login Required data textbox color: "rgba(73, 80, 87, 1)"; Actual: "${elementTextColor}"`);
}
//icon tool-tip
if (elementIconTooltip === 'Remove Field') {
console.log('Passed: Login Required Delete icon tool-tip text matched as expected');
} else {
errors.push(`Expected: Login Required: "Remove Field"; Actual: "${elementIconTooltip}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Printable label
{
description: 'Validate Printable label text, size, and color',
action: async () => {
const multipleChecks = 'Printable label';
const element = await driver.findElement(By.css('#m45868127f2091b432170a9e864bbdd67 > td:nth-child(1)'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//text
if (elementText === 'Printable') {
console.log('Passed: Printable label text matched as expected');
} else {
errors.push(`Expected: Label: "Printable"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Printable label font matched as expected');
} else {
errors.push(`Expected: Printable label font "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '14.3px') {
console.log('Passed: Printable label text font-size matched as expected');
} else {
errors.push(`Expected: Printable label text font-size "14.3px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(33, 37, 41, 1)') {
console.log('Passed: Printable label text color matched as expected');
} else {
errors.push(`Expected: Printable label text color: "rgba(33, 37, 41, 1)"; Actual: "${elementTextColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Printable textbox and delete icon
{
description: 'Validate Printable textbox and delete icon',
action: async () => {
const multipleChecks = 'Printable textbox and delete icon';
const element = await driver.findElement(By.css('#m45868127f2091b432170a9e864bbdd67 .form-control'));
const elementIcon = await driver.findElement(By.css('#m45868127f2091b432170a9e864bbdd67 > td:nth-child(3) > a'));
//Get text, font, size, and color
const elementText = await element.getAttribute('value');
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
const elementIconTooltip = await elementIcon.getAttribute('title');
//Track all errors
const errors = [];
//text
if (elementText === 'Yes') {
console.log('Passed: Printable data textbox text matched as expected');
} else {
errors.push(`Expected: Printable: "Yes"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === "Poppins, sans-serif") {
console.log('Passed: Printable data textbox font matched as expected');
} else {
errors.push(`Expected: Printable data textbox font "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '16px') {
console.log('Passed: Printabled data textbox font-size matched as expected');
} else {
errors.push(`Expected: Printable data textbox font-size "16px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(73, 80, 87, 1)') {
console.log('Passed: Printable data textbox color matched as expected');
} else {
errors.push(`Expected: Printable data textbox color: "rgba(73, 80, 87, 1)"; Actual: "${elementTextColor}"`);
}
//icon tool-tip
if (elementIconTooltip === 'Remove Field') {
console.log('Passed: Printable Delete icon tool-tip text matched as expected');
} else {
errors.push(`Expected: Printable: "Remove Field"; Actual: "${elementIconTooltip}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Source label
{
description: 'Validate Source label text, size, and color',
action: async () => {
const multipleChecks = 'Source label';
const element = await driver.findElement(By.css('#mec897a8d88912c6d5a93e7375db92d1c > td:nth-child(1)'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//text
if (elementText === 'Source') {
console.log('Passed: Source label text matched as expected');
} else {
errors.push(`Expected: Label: "Source"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Source label font matched as expected');
} else {
errors.push(`Expected: Source label font "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '14.3px') {
console.log('Passed: Source label text font-size matched as expected');
} else {
errors.push(`Expected: Source label text font-size "14.3px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(33, 37, 41, 1)') {
console.log('Passed: Source label text color matched as expected');
} else {
errors.push(`Expected: Source label text color: "rgba(33, 37, 41, 1)"; Actual: "${elementTextColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Source textbox and delete icon
{
description: 'Validate Source textbox and delete icon',
action: async () => {
const multipleChecks = 'Source textbox and delete icon';
const element = await driver.findElement(By.css('#mec897a8d88912c6d5a93e7375db92d1c .form-control'));
const elementIcon = await driver.findElement(By.css('#mec897a8d88912c6d5a93e7375db92d1c > td:nth-child(3) > a'));
//Get text, font, size, and color
const elementText = await element.getAttribute('value');
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
const elementIconTooltip = await elementIcon.getAttribute('title');
//Track all errors
const errors = [];
//text
if (elementText === 'University of Arizona') {
console.log('Passed: Source data textbox text matched as expected');
} else {
errors.push(`Expected: Source: "University of Arizona"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === "Poppins, sans-serif") {
console.log('Passed: Source data textbox font matched as expected');
} else {
errors.push(`Expected: Source data textbox font "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '16px') {
console.log('Passed: Source data textbox font-size matched as expected');
} else {
errors.push(`Expected: Source data textbox font-size "16px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(73, 80, 87, 1)') {
console.log('Passed: Source data textbox color matched as expected');
} else {
errors.push(`Expected: Source data textbox color: "rgba(73, 80, 87, 1)"; Actual: "${elementTextColor}"`);
}
//icon tool-tip
if (elementIconTooltip === 'Remove Field') {
console.log('Passed: Source Delete icon tool-tip text matched as expected');
} else {
errors.push(`Expected: Source: "Remove Field"; Actual: "${elementIconTooltip}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Subject(s) label
{
description: 'Validate Subjects label text, size, and color',
action: async () => {
const multipleChecks = 'Subject(s) label';
const element = await driver.findElement(By.css('#m28b7dfc64f791860c5f2f20f7c1a2027 > td:nth-child(1)'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//text
if (elementText === 'Subject(s)') {
console.log('Passed: Subject(s) label text matched as expected');
} else {
errors.push(`Expected: Label: "Subject(s)"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Subject(s) label font matched as expected');
} else {
errors.push(`Expected: Subject(s) label font "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '14.3px') {
console.log('Passed: Subject(s) label text font-size matched as expected');
} else {
errors.push(`Expected: Subject(s) label text font-size "14.3px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(33, 37, 41, 1)') {
console.log('Passed: Subject(s) label text color matched as expected');
} else {
errors.push(`Expected: Subject(s) label text color: "rgba(33, 37, 41, 1)"; Actual: "${elementTextColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Subject(s) textbox and delete icon
{
description: 'Validate Subjects textbox and delete icon',
action: async () => {
const multipleChecks = 'Subject(s) textbox and delete icon';
const element = await driver.findElement(By.css('#m28b7dfc64f791860c5f2f20f7c1a2027 .form-control'));
const elementIcon = await driver.findElement(By.css('#m28b7dfc64f791860c5f2f20f7c1a2027 > td:nth-child(3) > a'));
//Get text, font, size, and color
const elementText = await element.getAttribute('value');
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
const elementIconTooltip = await elementIcon.getAttribute('title');
//Track all errors
const errors = [];
//text
if (elementText === 'Science,Social Studies') {
console.log('Passed: Subject(s) data textbox text matched as expected');
} else {
errors.push(`Expected: Subject(s): "Science,Social Studies"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === "Poppins, sans-serif") {
console.log('Passed: Subject(s) data textbox font matched as expected');
} else {
errors.push(`Expected: Subject(s) data textbox font "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '16px') {
console.log('Passed: Subject(s) data textbox font-size matched as expected');
} else {
errors.push(`Expected: Subject(s) data textbox font-size "16px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(73, 80, 87, 1)') {
console.log('Passed: Subject(s) data textbox color matched as expected');
} else {
errors.push(`Expected: Subject(s) data textbox color: "rgba(73, 80, 87, 1)"; Actual: "${elementTextColor}"`);
}
//icon tool-tip
if (elementIconTooltip === 'Remove Field') {
console.log('Passed: Subject(s) Delete icon tool-tip text matched as expected');
} else {
errors.push(`Expected: Subject(s): "Remove Field"; Actual: "${elementIconTooltip}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Target Audience label
{
description: 'Validate Target Audience label text, size, and color',
action: async () => {
const multipleChecks = 'Target Audience label';
const element = await driver.findElement(By.css('#mfd8a2f5a0931f475e59ebbe64afc045b > td:nth-child(1)'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//text
if (elementText === 'Target Audience') {
console.log('Passed: Target Audience label text matched as expected');
} else {
errors.push(`Expected: Label: "Target Audience"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Target Audience label font matched as expected');
} else {
errors.push(`Expected: Target Audience label font "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '14.3px') {
console.log('Passed: Target Audience label text font-size matched as expected');
} else {
errors.push(`Expected: Target Audience label text font-size "14.3px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(33, 37, 41, 1)') {
console.log('Passed: Target Audience label text color matched as expected');
} else {
errors.push(`Expected: Target Audience label text color: "rgba(33, 37, 41, 1)"; Actual: "${elementTextColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Target Audience dropdown and delete icon
{
description: 'Validate Target Audience dropdown and delete icon',
action: async () => {
const multipleChecks = 'Target Audiencee dropdown and delete icon';
const element = await driver.findElement(By.css('#mfd8a2f5a0931f475e59ebbe64afc045b .form-control'));
const selectedOption = await element.findElement(By.css('option:checked'));
const elementIcon = await driver.findElement(By.css('#mfd8a2f5a0931f475e59ebbe64afc045b > td:nth-child(3) > a'));
//Get text, font, size, and color
const elementText = await element.getAttribute('value');
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
const elementIconTooltip = await elementIcon.getAttribute('title');
const options = await element.findElements(By.css('option'));
//Track all errors
const errors = [];
//text
if (elementText === 'Teacher') {
console.log('Passed: Target Audience data dropdown text matched as expected');
} else {
errors.push(`Expected: Target Audience: "English"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === "Poppins, sans-serif") {
console.log('Passed: Target Audience data dropdown font matched as expected');
} else {
errors.push(`Expected: Target Audience data dropdown font "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '16px') {
console.log('Passed: Target Audience data dropdown font-size matched as expected');
} else {
errors.push(`Expected: Target Audience data dropdown font-size "16px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(73, 80, 87, 1)') {
console.log('Passed: Target Audience data dropdown color matched as expected');
} else {
errors.push(`Expected: Target Audiencee data dropdown color: "rgba(73, 80, 87, 1)"; Actual: "${elementTextColor}"`);
}
const expected = [
'Administrator',
'Adult',
'College/ University Instructor',
'Curriculum Supervisor',
'Educator',
'Elementary School Teacher',
'General Public',
'Librarian / Media Specialist',
'Medical Professional',
'Middle School Teacher',
'Other Educational Professional',
'Parent',
'Patient',
'Policy-Maker',
'Professional',
'Secondary School Teacher',
'Student',
'Student Teacher',
'Supervisor',
'Teacher',
'Teacher Educator',
'Teaching Professional',
'Technology Coordinator'
];
const actual = [];
for (const opt of options) {
const text = (await opt.getText()).trim();
actual.push(text);
}
if (JSON.stringify(actual) === JSON.stringify(expected)) {
console.log('Passed: Target Audience - Dropdown list matched as expected');
} else {
throw new Error(`Expected: Target Audience - Dropdown list: ${JSON.stringify(expected)}, Actual: ${JSON.stringify(actual)}`);
}
//icon tool-tip
if (elementIconTooltip === 'Remove Field') {
console.log('Passed: Target Audience Delete icon tool-tip text matched as expected');
} else {
errors.push(`Expected: Target Audience: "Remove Field"; Actual: "${elementIconTooltip}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Terms of Use label
{
description: 'Validate Terms of Use label text, size, and color',
action: async () => {
const multipleChecks = 'Terms of Use label';
const element = await driver.findElement(By.css('#m65386aa4c4a432df8917936cd48ce822 > td:nth-child(1)'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//text
if (elementText === 'Terms of Use') {
console.log('Passed: Terms of Use label text matched as expected');
} else {
errors.push(`Expected: Label: "Terms of Use"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Terms of Use label font matched as expected');
} else {
errors.push(`Expected: Terms of Use label font "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '14.3px') {
console.log('Passed: Terms of Use label text font-size matched as expected');
} else {
errors.push(`Expected: Terms of Use label text font-size "14.3px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(33, 37, 41, 1)') {
console.log('Passed: Terms of Use label text color matched as expected');
} else {
errors.push(`Expected: Terms of Use label text color: "rgba(33, 37, 41, 1)"; Actual: "${elementTextColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Terms of Use textbox and delete icon
{
description: 'Validate Terms of Use textbox and delete icon',
action: async () => {
const multipleChecks = 'Terms of Use textbox and delete icon';
const element = await driver.findElement(By.css('#m65386aa4c4a432df8917936cd48ce822 .form-control'));
const elementIcon = await driver.findElement(By.css('#m65386aa4c4a432df8917936cd48ce822 > td:nth-child(3) > a'));
//Get text, font, size, and color
const elementText = await element.getAttribute('value');
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
const elementIconTooltip = await elementIcon.getAttribute('title');
//Track all errors
const errors = [];
//text
if (elementText === 'http://pulse.pharmacy.arizona.edu/about/index.html') {
console.log('Passed: Terms of Use data textbox text matched as expected');
} else {
errors.push(`Expected: Terms of Use: "http://pulse.pharmacy.arizona.edu/about/index.html"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === "Poppins, sans-serif") {
console.log('Passed: Terms of Use data textbox font matched as expected');
} else {
errors.push(`Expected: Terms of Use data textbox font "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '16px') {
console.log('Passed: Terms of Use data textbox font-size matched as expected');
} else {
errors.push(`Expected: Terms of Use data textbox font-size "16px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(73, 80, 87, 1)') {
console.log('Passed: Terms of Use data textbox color matched as expected');
} else {
errors.push(`Expected: Terms of Use data textbox color: "rgba(73, 80, 87, 1)"; Actual: "${elementTextColor}"`);
}
//icon tool-tip
if (elementIconTooltip === 'Remove Field') {
console.log('Passed: Terms of Use Delete icon tool-tip text matched as expected');
} else {
errors.push(`Expected: Terms of Use: "Remove Field"; Actual: "${elementIconTooltip}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Alignment Status label
{
description: 'Validate Alignment Status label text, size, and color',
action: async () => {
const multipleChecks = 'Alignment Status label';
const element = await driver.findElement(By.css('#mda419069683b65df715651e536180454 > td:nth-child(1)'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//text
if (elementText === 'Alignment Status') {
console.log('Passed: Alignment Status label text matched as expected');
} else {
errors.push(`Expected: Label: "Alignment Status"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Alignment Status label font matched as expected');
} else {
errors.push(`Expected: Alignment Status label font "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '14.3px') {
console.log('Passed: Alignment Status label text font-size matched as expected');
} else {
errors.push(`Expected: Alignment Status label text font-size "14.3px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(33, 37, 41, 1)') {
console.log('Passed: Alignment Status label text color matched as expected');
} else {
errors.push(`Expected: Alignment Status label text color: "rgba(33, 37, 41, 1)"; Actual: "${elementTextColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Alignment Status textbox and delete icon
{
description: 'Validate Alignment Status textbox and delete icon',
action: async () => {
const multipleChecks = 'Alignment Status textbox and delete icon';
const element = await driver.findElement(By.css('#mda419069683b65df715651e536180454 .form-control'));
const elementIcon = await driver.findElement(By.css('#mda419069683b65df715651e536180454 > td:nth-child(3) > a'));
//Get text, font, size, and color
const elementText = await element.getAttribute('value');
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
const elementIconTooltip = await elementIcon.getAttribute('title');
//Track all errors
const errors = [];
//text
if (elementText === 'Not Aligned') {
console.log('Passed: Alignment Status data textbox text matched as expected');
} else {
errors.push(`Expected: Alignment Status: "Not Aligned"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === "Poppins, sans-serif") {
console.log('Passed: Alignment Status data textbox font matched as expected');
} else {
errors.push(`Expected: Alignment Status data textbox font "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '16px') {
console.log('Passed: Alignment Status data textbox font-size matched as expected');
} else {
errors.push(`Expected: Alignment Status data textbox font-size "16px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(73, 80, 87, 1)') {
console.log('Passed: Alignment Status data textbox color matched as expected');
} else {
errors.push(`Expected: Alignment Status data textbox color: "rgba(73, 80, 87, 1)"; Actual: "${elementTextColor}"`);
}
//icon tool-tip
if (elementIconTooltip === 'Remove Field') {
console.log('Passed: Alignment Status Delete icon tool-tip text matched as expected');
} else {
errors.push(`Expected: Alignment Status: "Remove Field"; Actual: "${elementIconTooltip}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//NEXT ACTION
{
description: 'Add Metadata',
action: async () => {
await driver.findElement(By.css('.input-group-text')).click();
await driver.sleep(2000);
await driver.findElement(By.linkText('Descriptors')).click();
await driver.sleep(2000);
await driver.findElement(By.css('#meta_value')).sendKeys('Metadata automated check');
await driver.sleep(2000);
await driver.findElement(By.css('.btn:nth-child(5)')).click();
console.log('----->| NEXT ACTION: Enter Field Name, value, then click Add Metadata button');
//Wait until the element exists in the DOM
const newMetadataRow = await driver.wait(
until.elementLocated(By.xpath('//tbody[2]/tr/td')),
30000
);
//Wait until it becomes visible
await driver.wait(
until.elementIsVisible(newMetadataRow),
30000
);
}
},
//Field Name header
{
description: 'Validate Field Name header text, size, and color',
action: async () => {
const multipleChecks = 'Field Name header';
const element = await driver.findElement(By.css('#tabsr-4 > div:nth-child(1) > b'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//text
if (elementText === 'Field Name') {
console.log('Passed: Field Name header text matched as expected');
} else {
errors.push(`Expected: "Field Name"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Field Name header font matched as expected');
} else {
errors.push(`Expected: Field Name header font "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '13px') {
console.log('Passed: Field Name header text font-size matched as expected');
} else {
errors.push(`Expected: Field Name header text font-size "13px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(40, 39, 90, 1)') {
console.log('Passed: Field Name header text color matched as expected');
} else {
errors.push(`Expected: Field Name header text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Field Name dropdown (SPECIAL CASE: <li> elements with data-value)
{
description: 'Validate Field Name dropdown',
action: async () => {
const multipleChecks = 'Field Name dropdown';
const errors = [];
//Target the combobox input
const elementDropdown = await driver.wait(until.elementLocated(By.css('input.combobox.form-control')), 5000);
const elementText = await elementDropdown.getAttribute('placeholder');
const elementTextFont = await elementDropdown.getCssValue('font-family');
const elementTextSize = await elementDropdown.getCssValue('font-size');
const elementTextColor = await elementDropdown.getCssValue('color');
//Click to open dropdown
await driver.findElement(By.css('.input-group-text')).click();
console.log('----->| NEXT ACTION: Clicked Field Name dropdown arrow to open list');
//Wait for typeahead list to populate
await driver.wait(async () => {
const count = await driver.executeScript(`
return document.querySelectorAll('ul.typeahead li[data-value]').length;
`);
return count > 0;
}, 5000, 'Typeahead dropdown did not populate within 5 seconds');
//Now get the options
const actual = await driver.executeScript(`
const items = document.querySelectorAll('ul.typeahead li[data-value]');
return Array.from(items).map(li => li.getAttribute('data-value'));
`);
//console.log('----->| DEBUG actual options:', JSON.stringify(actual));
//placeholder text
if (elementText === 'Select/Enter Field...') {
console.log('Passed: Field Name dropdown placeholder matched as expected');
} else {
errors.push(`Expected: Field Name dropdown placeholder "Select/Enter Field..."; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Field Name dropdown font matched as expected');
} else {
errors.push(`Expected: Field Name dropdown font "Poppins, sans-serif"; Actual: "${elementTextFont}"`);
}
//font-size
if (elementTextSize === '16px') {
console.log('Passed: Field Name dropdown font-size matched as expected');
} else {
errors.push(`Expected: Field Name dropdown font-size "16px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(73, 80, 87, 1)') {
console.log('Passed: Field Name dropdown color matched as expected');
} else {
errors.push(`Expected: Field Name dropdown color "rgba(73, 80, 87, 1)"; Actual: "${elementTextColor}"`);
}
const expected = [
'Author Name',
'Career Cluster',
'Career Pathway',
'Content Type',
'Copyright Date',
'Descriptors',
'Entry-Level Education',
'For Kids',
'Format',
'Free or Fee',
'Grade Range',
'Grouping',
'High Grade',
'ICD 9',
'Includes',
'InstructorRequired',
'Language',
'Learning Style',
'Length',
'Level - Challenging',
'Level - On Target',
'Level - Skill Builder',
'Lexile Scale',
'Low Grade',
'Medical Focus',
'Method',
'Notes',
'Occupation',
'Pedagogy',
'Price',
'Producer',
'Reading Level',
'Source',
'StudentFacingDigital ',
'StudentFacingPrint',
'Subject',
'Submitted By',
'Target Audience',
'TeacherMaterials',
'Technology',
'Terms of Use'
];
if (JSON.stringify(actual) === JSON.stringify(expected)) {
console.log('Passed: Field Name dropdown list matched as expected');
} else {
errors.push(`Expected: Field Name dropdown list: ${JSON.stringify(expected)}\nActual: ${JSON.stringify(actual)}`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
throw new Error(errors.join('\n'));
}
}
},
//Value header
{
description: 'Validate Value header text, size, and color',
action: async () => {
const multipleChecks = 'Value header';
const element = await driver.findElement(By.css('div:nth-child(2) > b'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//text
if (elementText === 'Value') {
console.log('Passed: Value header text matched as expected');
} else {
errors.push(`Expected: "Value"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Value header font matched as expected');
} else {
errors.push(`Expected: Value header font "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '13px') {
console.log('Passed: Value header text font-size matched as expected');
} else {
errors.push(`Expected: Value header text font-size "13px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(40, 39, 90, 1)') {
console.log('Passed: Value header text color matched as expected');
} else {
errors.push(`Expected: Value header text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Value textbox
{
description: 'Verify Value textbox is present',
action: async () => {
const element = await driver.wait(until.elementLocated(By.css('#meta_value')), 5000).catch(() => false);
//Track all errors
const errors = [];
if (element) {
console.log('Passed: Value textbox appeared as expected');
} else {
errors.push('Value textbox not found');
}
}
},
//Add Metadata button
{
description: 'Validate Add Metadata button',
action: async () => {
const multipleChecks = 'Add Metadata button';
const element = await driver.findElement(By.css('.btn:nth-child(5)'));
//Get text, font, color, and size
const elementText = await element.getAttribute('value');
const elementFont = await element.getCssValue('font-family');
const elementSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
const elementButtonColor = await element.getCssValue('background-color');
//Track all errors
const errors = [];
//text
if (elementText === 'Add Metadata') {
console.log('Passed: Add Metadata button text matched as expected');
} else {
errors.push(`Expected: Button text: "Add Metadata"; Actual: "${elementText}"`);
}
//font-family
if (elementFont === "Poppins, sans-serif") {
console.log('Passed: Add Metadata button text font matched as expected');
} else {
errors.push(`Expected: Add Metadata button text font "Poppins, sans-serif"; Actual: ${elementFont}`);
}
//font size
if (elementSize === '16px') {
console.log('Passed: Add Metadata button text font-size matched as expected');
} else {
errors.push(`Expected: Add Metadata button text font-size "16px"; Actual: "${elementSize}"`);
}
//text color
if (elementTextColor === 'rgba(255, 255, 255, 1)') {
console.log('Passed: Add Metadata button text color matched as expected');
} else {
errors.push(`Expected: Add Metadata button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`);
}
//button color (button highlighted)
if (elementButtonColor === 'rgba(46, 163, 153, 1)') {
console.log('Passed: Add Metadata button background color matched as expected');
} else {
errors.push(`Expected: Add Metadata button background color: "rgba(46, 163, 153, 1)"; Actual: "${elementButtonColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Current Metadata header
{
description: 'Validate Current Metadata header text, size, and color',
action: async () => {
const multipleChecks = 'Current Metadata header';
const element = await driver.findElement(By.css('span:nth-child(7)'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//text
if (elementText === 'Current Metadata') {
console.log('Passed: Current Metadata header text matched as expected');
} else {
errors.push(`Expected: "Current Metadata"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Current Metadata header font matched as expected');
} else {
errors.push(`Expected: Current Metadata header font "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '13px') {
console.log('Passed: Current Metadata header text font-size matched as expected');
} else {
errors.push(`Expected: Current Metadata header text font-size "13px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(40, 39, 90, 1)') {
console.log('Passed: Current Metadata header text color matched as expected');
} else {
errors.push(`Expected: Current Metadata header text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Name header
{
description: 'Validate Name header text, size, and color',
action: async () => {
const multipleChecks = 'Name header';
const element = await driver.findElement(By.css('th:nth-child(1)'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//text
if (elementText === 'Name') {
console.log('Passed: Name header text matched as expected');
} else {
errors.push(`Expected: "Name"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Name header font matched as expected');
} else {
errors.push(`Expected: Name header font "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '14.3px') {
console.log('Passed: Name header text font-size matched as expected');
} else {
errors.push(`Expected: Name header text font-size "14.3px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(33, 37, 41, 1)') {
console.log('Passed: Name header text color matched as expected');
} else {
errors.push(`Expected: Name header text color: "rgba(33, 37, 41, 1)"; Actual: "${elementTextColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Data header
{
description: 'Validate Data header text, size, and color',
action: async () => {
const multipleChecks = 'Data header';
const element = await driver.findElement(By.css('th:nth-child(2)'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//text
if (elementText === 'Data') {
console.log('Passed: Data header text matched as expected');
} else {
errors.push(`Expected: "Data"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Data header font matched as expected');
} else {
errors.push(`Expected: Data header font "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '14.3px') {
console.log('Passed: Data header text font-size matched as expected');
} else {
errors.push(`Expected: Data header text font-size "14.3px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(33, 37, 41, 1)') {
console.log('Passed: Data header text color matched as expected');
} else {
errors.push(`Expected: Data header text color: "rgba(33, 37, 41, 1)"; Actual: "${elementTextColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Ads label
{
description: 'Validate Ads label text, size, and color',
action: async () => {
const multipleChecks = 'Ads label';
const element = await driver.findElement(By.css('#m718311f909243a985798d8f4937c4308 > td:nth-child(1)'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//text
if (elementText === 'Ads') {
console.log('Passed: Ads label text matched as expected');
} else {
errors.push(`Expected: Label: "Ads"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Ads label font matched as expected');
} else {
errors.push(`Expected: Ads label font "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '14.3px') {
console.log('Passed: Ads label text font-size matched as expected');
} else {
errors.push(`Expected: Ads label text font-size "14.3px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(33, 37, 41, 1)') {
console.log('Passed: Ads label text color matched as expected');
} else {
errors.push(`Expected: Ads label text color: "rgba(33, 37, 41, 1)"; Actual: "${elementTextColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Ads textbox and delete icon
{
description: 'Validate Ads textbox and delete icon',
action: async () => {
const multipleChecks = 'Ads textbox and delete icon';
const element = await driver.findElement(By.css('#m718311f909243a985798d8f4937c4308 .form-control'));
const elementIcon = await driver.findElement(By.css('#m718311f909243a985798d8f4937c4308 > td:nth-child(3) > a'));
//Get text, font, size, and color
const elementText = await element.getAttribute('value');
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
const elementIconTooltip = await elementIcon.getAttribute('title');
//Track all errors
const errors = [];
//text
if (elementText === 'No') {
console.log('Passed: Ads data textbox text matched as expected');
} else {
errors.push(`Expected: Ads: "No"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === "Poppins, sans-serif") {
console.log('Passed: Ads data textbox font matched as expected');
} else {
errors.push(`Expected: Ads data textbox font "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '16px') {
console.log('Passed: Ads data textbox font-size matched as expected');
} else {
errors.push(`Expected: Ads data textbox font-size "16px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(73, 80, 87, 1)') {
console.log('Passed: Ads data textbox color matched as expected');
} else {
errors.push(`Expected: Ads data textbox color: "rgba(73, 80, 87, 1)"; Actual: "${elementTextColor}"`);
}
//icon tool-tip
if (elementIconTooltip === 'Remove Field') {
console.log('Passed: Ads Delete icon tool-tip text matched as expected');
} else {
errors.push(`Expected: Ads: "Remove Field"; Actual: "${elementIconTooltip}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Content Type label
{
description: 'Validate Content Type label text, size, and color',
action: async () => {
const multipleChecks = 'Content Type label';
const element = await driver.findElement(By.css('#mb2fa2c551d7d04604b3a90dfbffcde87 > td:nth-child(1)'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//text
if (elementText === 'Content Type') {
console.log('Passed: Content Type label text matched as expected');
} else {
errors.push(`Expected: Label: "Content Type"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Content Type label font matched as expected');
} else {
errors.push(`Expected: Content Type label font "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '14.3px') {
console.log('Passed: Content Type label text font-size matched as expected');
} else {
errors.push(`Expected: Content Type label text font-size "14.3px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(33, 37, 41, 1)') {
console.log('Passed: Content Type label text color matched as expected');
} else {
errors.push(`Expected: Content Type label text color: "rgba(33, 37, 41, 1)"; Actual: "${elementTextColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Content Type dropdown and delete icon
{
description: 'Validate Content Type dropdown and delete icon',
action: async () => {
const multipleChecks = 'Content Type dropdown and delete icon';
const element = await driver.findElement(By.css('#mb2fa2c551d7d04604b3a90dfbffcde87 .form-control'));
const selectedOption = await element.findElement(By.css('option:checked'));
const elementIcon = await driver.findElement(By.css('#mb2fa2c551d7d04604b3a90dfbffcde87 > td:nth-child(3) > a'));
//Get text, font, size, and color
const elementText = await element.getAttribute('value');
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
const elementIconTooltip = await elementIcon.getAttribute('title');
const options = await element.findElements(By.css('option'));
//Track all errors
const errors = [];
//text
if (elementText === 'Lesson Plan') {
console.log('Passed: Content Type data dropdown text matched as expected');
} else {
errors.push(`Expected: Content Type: "Lesson Plan"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === "Poppins, sans-serif") {
console.log('Passed: Content Type data dropdown font matched as expected');
} else {
errors.push(`Expected: Content Type data dropdown font "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '16px') {
console.log('Passed: Content Type data dropdown font-size matched as expected');
} else {
errors.push(`Expected: Content Type data dropdown font-size "16px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(73, 80, 87, 1)') {
console.log('Passed: Content Type data dropdown color matched as expected');
} else {
errors.push(`Expected: Content Type data dropdown color: "rgba(73, 80, 87, 1)"; Actual: "${elementTextColor}"`);
}
const expected = [
'Activity',
'Article',
'Assessment Question',
'Course',
'Curricular Theme',
'General Resource',
'Interactive Exercise',
'Interactive Resource',
'Lab Experiment',
'Lesson Plan',
'Quiz / Test',
'Teacher Guide',
'Timeline Resource',
'Tutorial',
'Unit',
'Worksheet'
];
const actual = [];
for (const opt of options) {
const text = (await opt.getText()).trim();
actual.push(text);
}
if (JSON.stringify(actual) === JSON.stringify(expected)) {
console.log('Passed: Content Type - Dropdown list matched as expected');
} else {
throw new Error(`Expected: Content Type - Dropdown list: ${JSON.stringify(expected)}, Actual: ${JSON.stringify(actual)}`);
}
//icon tool-tip
if (elementIconTooltip === 'Remove Field') {
console.log('Passed: Content Type Delete icon tool-tip text matched as expected');
} else {
errors.push(`Expected: Content Type: "Remove Field"; Actual: "${elementIconTooltip}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Format label
{
description: 'Validate Format label text, size, and color',
action: async () => {
const multipleChecks = 'Format label';
const element = await driver.findElement(By.css('#maf6ee65f869419e9bf9b091223b6da37 > td:nth-child(1)'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//text
if (elementText === 'Format') {
console.log('Passed: Format label text matched as expected');
} else {
errors.push(`Expected: Label: "Format"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Format label font matched as expected');
} else {
errors.push(`Expected: Format label font "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '14.3px') {
console.log('Passed: Format label text font-size matched as expected');
} else {
errors.push(`Expected: Format label text font-size "14.3px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(33, 37, 41, 1)') {
console.log('Passed: Format label text color matched as expected');
} else {
errors.push(`Expected: Format label text color: "rgba(33, 37, 41, 1)"; Actual: "${elementTextColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Format dropdown and delete icon
{
description: 'Validate Format dropdown and delete icon',
action: async () => {
const multipleChecks = 'Format dropdown and delete icon';
const element = await driver.findElement(By.css('#maf6ee65f869419e9bf9b091223b6da37 .form-control'));
const selectedOption = await element.findElement(By.css('option:checked'));
const elementIcon = await driver.findElement(By.css('#maf6ee65f869419e9bf9b091223b6da37 > td:nth-child(3) > a'));
//Get text, font, size, and color
const elementText = await element.getAttribute('value');
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
const elementIconTooltip = await elementIcon.getAttribute('title');
const options = await element.findElements(By.css('option'));
//Track all errors
const errors = [];
//text
if (elementText === 'HTML') {
console.log('Passed: Format data dropdown text matched as expected');
} else {
errors.push(`Expected: Format: "HTML"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === "Poppins, sans-serif") {
console.log('Passed: Format data dropdown font matched as expected');
} else {
errors.push(`Expected: Format data dropdown font "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '16px') {
console.log('Passed: Format data dropdown font-size matched as expected');
} else {
errors.push(`Expected: Format data dropdown font-size "16px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(73, 80, 87, 1)') {
console.log('Passed: Format data dropdown color matched as expected');
} else {
errors.push(`Expected: Format data dropdown color: "rgba(73, 80, 87, 1)"; Actual: "${elementTextColor}"`);
}
const expected = [
'HTML',
'Online Video',
'PDF'
];
const actual = [];
for (const opt of options) {
const text = (await opt.getText()).trim();
actual.push(text);
}
if (JSON.stringify(actual) === JSON.stringify(expected)) {
console.log('Passed: Format: Dropdown list matched as expected');
} else {
throw new Error(`Expected: Format - Dropdown list: ${JSON.stringify(expected)}, Actual: ${JSON.stringify(actual)}`);
}
//icon tool-tip
if (elementIconTooltip === 'Remove Field') {
console.log('Passed: Format Delete icon tool-tip text matched as expected');
} else {
errors.push(`Expected: Format: "Remove Field"; Actual: "${elementIconTooltip}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Free or Fee label
{
description: 'Validate Free or Fee label text, size, and color',
action: async () => {
const multipleChecks = 'Free or Fee label';
const element = await driver.findElement(By.css('#m351eb217b1f32cca4bafbfa2131bc449 > td:nth-child(1)'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//text
if (elementText === 'Free or Fee') {
console.log('Passed: Free or Fee label text matched as expected');
} else {
errors.push(`Expected: Label: "Free or Fee"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Free or Fee label font matched as expected');
} else {
errors.push(`Expected: Free or Fee label font "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '14.3px') {
console.log('Passed: Free or Fee label text font-size matched as expected');
} else {
errors.push(`Expected: Free or Fee label text font-size "14.3px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(33, 37, 41, 1)') {
console.log('Passed: Free or Fee label text color matched as expected');
} else {
errors.push(`Expected: Free or Fee label text color: "rgba(33, 37, 41, 1)"; Actual: "${elementTextColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Free or Fee dropdown and delete icon
{
description: 'Validate Free or Fee dropdown and delete icon',
action: async () => {
const multipleChecks = 'Free or Fee dropdown and delete icon';
const element = await driver.findElement(By.css('#m351eb217b1f32cca4bafbfa2131bc449 .form-control'));
const selectedOption = await element.findElement(By.css('option:checked'));
const elementIcon = await driver.findElement(By.css('#m351eb217b1f32cca4bafbfa2131bc449 > td:nth-child(3) > a'));
//Get text, font, size, and color
const elementText = await element.getAttribute('value');
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
const elementIconTooltip = await elementIcon.getAttribute('title');
const options = await element.findElements(By.css('option'));
//Track all errors
const errors = [];
//text
if (elementText === 'Free') {
console.log('Passed: Free or Fee data dropdown text matched as expected');
} else {
errors.push(`Expected: Free or Fee: "Free"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === "Poppins, sans-serif") {
console.log('Passed: Free or Fee data dropdown font matched as expected');
} else {
errors.push(`Expected: Free or Fee data dropdown font "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '16px') {
console.log('Passed: Free or Fee data dropdown font-size matched as expected');
} else {
errors.push(`Expected: Free or Fee data dropdown font-size "16px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(73, 80, 87, 1)') {
console.log('Passed: Free or Fee data dropdown color matched as expected');
} else {
errors.push(`Expected: Free or Fee data dropdown color: "rgba(73, 80, 87, 1)"; Actual: "${elementTextColor}"`);
}
const expected = [
'$$',
'Free',
'Free Samples'
];
const actual = [];
for (const opt of options) {
const text = (await opt.getText()).trim();
actual.push(text);
}
if (JSON.stringify(actual) === JSON.stringify(expected)) {
console.log('Passed: Free or Fee - Dropdown list matched as expected');
} else {
throw new Error(`Expected: Free or Fee - Dropdown list: ${JSON.stringify(expected)}, Actual: ${JSON.stringify(actual)}`);
}
//icon tool-tip
if (elementIconTooltip === 'Remove Field') {
console.log('Passed: Free or Fee Delete icon tool-tip text matched as expected');
} else {
errors.push(`Expected: Free or Fee: "Remove Field"; Actual: "${elementIconTooltip}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Grade Range label
{
description: 'Validate Grade Range label text, size, and color',
action: async () => {
const multipleChecks = 'Grade Range label';
const element = await driver.findElement(By.css('#mff2cd573a71e3519aed5b913db085dcf > td:nth-child(1)'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//text
if (elementText === 'Grade Range') {
console.log('Passed: Grade Range label text matched as expected');
} else {
errors.push(`Expected: Label: "Grade Range"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Grade Range label font matched as expected');
} else {
errors.push(`Expected: Grade Range label font "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '14.3px') {
console.log('Passed: Grade Range label text font-size matched as expected');
} else {
errors.push(`Expected: Grade Range label text font-size "14.3px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(33, 37, 41, 1)') {
console.log('Passed: Grade Range label text color matched as expected');
} else {
errors.push(`Expected: Grade Range label text color: "rgba(33, 37, 41, 1)"; Actual: "${elementTextColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Grade Range textbox and delete icon
{
description: 'Validate Grade Range textbox and delete icon',
action: async () => {
const multipleChecks = 'Grade Range textbox and delete icon';
const element = await driver.findElement(By.css('#mff2cd573a71e3519aed5b913db085dcf .form-control'));
const elementIcon = await driver.findElement(By.css('#mff2cd573a71e3519aed5b913db085dcf > td:nth-child(3) > a'));
//Get text, font, size, and color
const elementText = await element.getAttribute('value');
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
const elementIconTooltip = await elementIcon.getAttribute('title');
//Track all errors
const errors = [];
//text
if (elementText === '8 to 12') {
console.log('Passed: Grade Range data textbox text matched as expected');
} else {
errors.push(`Expected: Grade Range: "8 to 12"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === "Poppins, sans-serif") {
console.log('Passed: Grade Range data textbox font matched as expected');
} else {
errors.push(`Expected: Grade Range data textbox font "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '16px') {
console.log('Passed: Grade Range data textbox font-size matched as expected');
} else {
errors.push(`Expected: Grade Range data textbox font-size "16px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(73, 80, 87, 1)') {
console.log('Passed: Grade Range data textbox color matched as expected');
} else {
errors.push(`Expected: Grade Range data textbox color: "rgba(73, 80, 87, 1)"; Actual: "${elementTextColor}"`);
}
//icon tool-tip
if (elementIconTooltip === 'Remove Field') {
console.log('Passed: Grade Range Delete icon tool-tip text matched as expected');
} else {
errors.push(`Expected: Grade Range: "Remove Field"; Actual: "${elementIconTooltip}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Language label
{
description: 'Validate Language label text, size, and color',
action: async () => {
const multipleChecks = 'Language label';
const element = await driver.findElement(By.css('#m69a67e85dc8d37db26e54e93a8731eef > td:nth-child(1)'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//text
if (elementText === 'Language') {
console.log('Passed: Language label text matched as expected');
} else {
errors.push(`Expected: Label: "Language"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Language label font matched as expected');
} else {
errors.push(`Expected: Language label font "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '14.3px') {
console.log('Passed: Language label text font-size matched as expected');
} else {
errors.push(`Expected: Language label text font-size "14.3px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(33, 37, 41, 1)') {
console.log('Passed: Language label text color matched as expected');
} else {
errors.push(`Expected: Language label text color: "rgba(33, 37, 41, 1)"; Actual: "${elementTextColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Language dropdown and delete icon
{
description: 'Validate Language dropdown and delete icon',
action: async () => {
const multipleChecks = 'Language dropdown and delete icon';
const element = await driver.findElement(By.css('#m69a67e85dc8d37db26e54e93a8731eef .form-control'));
const selectedOption = await element.findElement(By.css('option:checked'));
const elementIcon = await driver.findElement(By.css('#m69a67e85dc8d37db26e54e93a8731eef > td:nth-child(3) > a'));
//Get text, font, size, and color
const elementText = await element.getAttribute('value');
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
const elementIconTooltip = await elementIcon.getAttribute('title');
const options = await element.findElements(By.css('option'));
//Track all errors
const errors = [];
//text
if (elementText === 'English') {
console.log('Passed: Language data dropdown text matched as expected');
} else {
errors.push(`Expected: Language: "English"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === "Poppins, sans-serif") {
console.log('Passed: Language data dropdown font matched as expected');
} else {
errors.push(`Expected: Language data dropdown font "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '16px') {
console.log('Passed: Language data dropdown font-size matched as expected');
} else {
errors.push(`Expected: Language data dropdown font-size "16px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(73, 80, 87, 1)') {
console.log('Passed: Language data dropdown color matched as expected');
} else {
errors.push(`Expected: Language data dropdown color: "rgba(73, 80, 87, 1)"; Actual: "${elementTextColor}"`);
}
const expected = [
'Arabic',
'English',
'French',
'German',
'Italian',
'Japanese',
'Latin',
'More Than One',
'Pacific Language',
'Portuguese',
'Spanish'
];
const actual = [];
for (const opt of options) {
const text = (await opt.getText()).trim();
actual.push(text);
}
if (JSON.stringify(actual) === JSON.stringify(expected)) {
console.log('Passed: Language - Dropdown list matched as expected');
} else {
throw new Error(`Expected: Language - Dropdown list: ${JSON.stringify(expected)}, Actual: ${JSON.stringify(actual)}`);
}
//icon tool-tip
if (elementIconTooltip === 'Remove Field') {
console.log('Passed: Language Delete icon tool-tip text matched as expected');
} else {
errors.push(`Expected: Language: "Remove Field"; Actual: "${elementIconTooltip}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Level-Challenging label
{
description: 'Validate LevelChallenging label text, size, and color',
action: async () => {
const multipleChecks = 'Level-Challenging label';
const element = await driver.findElement(By.css('#m8dd4934d544003c3ca1af42caaaf7985 > td:nth-child(1)'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//text
if (elementText === 'Level-Challenging') {
console.log('Passed: Level-Challenging label text matched as expected');
} else {
errors.push(`Expected: Label: "Level-Challenging"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Level-Challenging label font matched as expected');
} else {
errors.push(`Expected: Level-Challenging label font "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '14.3px') {
console.log('Passed: Level-Challenging label text font-size matched as expected');
} else {
errors.push(`Expected: Level-Challenging label text font-size "14.3px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(33, 37, 41, 1)') {
console.log('Passed: Level-Challenging label text color matched as expected');
} else {
errors.push(`Expected: Level-Challenging label text color: "rgba(33, 37, 41, 1)"; Actual: "${elementTextColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Level-Challenging textbox and delete icon
{
description: 'Validate LevelChallenging textbox and delete icon',
action: async () => {
const multipleChecks = 'Level-Challenging textbox and delete icon';
const element = await driver.findElement(By.css('#m8dd4934d544003c3ca1af42caaaf7985 .form-control'));
const elementIcon = await driver.findElement(By.css('#m8dd4934d544003c3ca1af42caaaf7985 > td:nth-child(3) > a'));
//Get text, font, size, and color
const elementText = await element.getAttribute('value');
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
const elementIconTooltip = await elementIcon.getAttribute('title');
//Track all errors
const errors = [];
//text
if (elementText === '8') {
console.log('Passed: Level-Challenging data textbox text matched as expected');
} else {
errors.push(`Expected: Level-Challenging: "8"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === "Poppins, sans-serif") {
console.log('Passed: Level-Challenging data textbox font matched as expected');
} else {
errors.push(`Expected: Level-Challenging data textbox font "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '16px') {
console.log('Passed: Level-Challenging data textbox font-size matched as expected');
} else {
errors.push(`Expected: Level-Challenging data textbox font-size "16px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(73, 80, 87, 1)') {
console.log('Passed: Level-Challenging data textbox color matched as expected');
} else {
errors.push(`Expected: Level-Challenging data textbox color: "rgba(73, 80, 87, 1)"; Actual: "${elementTextColor}"`);
}
//icon tool-tip
if (elementIconTooltip === 'Remove Field') {
console.log('Passed: Level-Challenging Delete icon tool-tip text matched as expected');
} else {
errors.push(`Expected: Level-Challenging: "Remove Field"; Actual: "${elementIconTooltip}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Level-On Target label
{
description: 'Validate LevelOn Target label text, size, and color',
action: async () => {
const multipleChecks = 'Level-On Target label';
const element = await driver.findElement(By.css('#md1a8bc96f5a2edcfa8ee134238cd5ead > td:nth-child(1)'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//text
if (elementText === 'Level-On Target') {
console.log('Passed: Level-On Target label text matched as expected');
} else {
errors.push(`Expected: Label: "Level-On Target"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Level-On Target label font matched as expected');
} else {
errors.push(`Expected: Level-On Target label font "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '14.3px') {
console.log('Passed: Level-On Target label text font-size matched as expected');
} else {
errors.push(`Expected: Level-On Target label text font-size "14.3px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(33, 37, 41, 1)') {
console.log('Passed: Level-On Target label text color matched as expected');
} else {
errors.push(`Expected: Level-On Target label text color: "rgba(33, 37, 41, 1)"; Actual: "${elementTextColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Level-On Target textbox and delete icon
{
description: 'Validate LevelOn Target textbox and delete icon',
action: async () => {
const multipleChecks = 'Level-On Target textbox and delete icon';
const element = await driver.findElement(By.css('#md1a8bc96f5a2edcfa8ee134238cd5ead .form-control'));
const elementIcon = await driver.findElement(By.css('#md1a8bc96f5a2edcfa8ee134238cd5ead > td:nth-child(3) > a'));
//Get text, font, size, and color
const elementText = await element.getAttribute('value');
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
const elementIconTooltip = await elementIcon.getAttribute('title');
//Track all errors
const errors = [];
//text
if (elementText === '12') {
console.log('Passed: Level-On Target data textbox text matched as expected');
} else {
errors.push(`Expected: Level-On Target: "12"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === "Poppins, sans-serif") {
console.log('Passed: Level-On Target data textbox font matched as expected');
} else {
errors.push(`Expected: Level-On Target data textbox font "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '16px') {
console.log('Passed: Level-On Target data textbox font-size matched as expected');
} else {
errors.push(`Expected: Level-On Target data textbox font-size "16px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(73, 80, 87, 1)') {
console.log('Passed: Level-On Target data textbox color matched as expected');
} else {
errors.push(`Expected: Level-On Target data textbox color: "rgba(73, 80, 87, 1)"; Actual: "${elementTextColor}"`);
}
//icon tool-tip
if (elementIconTooltip === 'Remove Field') {
console.log('Passed: Level-On Target Delete icon tool-tip text matched as expected');
} else {
errors.push(`Expected: Level-On Target: "Remove Field"; Actual: "${elementIconTooltip}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Level_Challenging label
{
description: 'Validate LevelChallenging label text, size, and color',
action: async () => {
const multipleChecks = 'Level_Challenging label';
const element = await driver.findElement(By.css('#m4aa48829c2cbcee79bc0d5c9c6b3a6c2 > td:nth-child(1)'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//text
if (elementText === 'Level_Challenging') {
console.log('Passed: Level_Challenging label text matched as expected');
} else {
errors.push(`Expected: Label: "Level_Challenging"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Level_Challenging label font matched as expected');
} else {
errors.push(`Expected: Level_Challenging label font "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '14.3px') {
console.log('Passed: Level_Challenging label text font-size matched as expected');
} else {
errors.push(`Expected: Level_Challenging label text font-size "14.3px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(33, 37, 41, 1)') {
console.log('Passed: Level_Challenging label text color matched as expected');
} else {
errors.push(`Expected: Level_Challenging label text color: "rgba(33, 37, 41, 1)"; Actual: "${elementTextColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Level_Challenging textbox and delete icon
{
description: 'Validate LevelChallenging textbox and delete icon',
action: async () => {
const multipleChecks = 'Level_Challenging textbox and delete icon';
const element = await driver.findElement(By.css('#m4aa48829c2cbcee79bc0d5c9c6b3a6c2 .form-control'));
const elementIcon = await driver.findElement(By.css('#m4aa48829c2cbcee79bc0d5c9c6b3a6c2 > td:nth-child(3) > a'));
//Get text, font, size, and color
const elementText = await element.getAttribute('value');
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
const elementIconTooltip = await elementIcon.getAttribute('title');
//Track all errors
const errors = [];
//text
if (elementText === '8') {
console.log('Passed: Level_Challenging data textbox text matched as expected');
} else {
errors.push(`Expected: Level_Challenging: "8"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === "Poppins, sans-serif") {
console.log('Passed: Level_Challenging data textbox font matched as expected');
} else {
errors.push(`Expected: Level_Challenging data textbox font "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '16px') {
console.log('Passed: Level_Challenging data textbox font-size matched as expected');
} else {
errors.push(`Expected: Level_Challenging data textbox font-size "16px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(73, 80, 87, 1)') {
console.log('Passed: Level_Challenging data textbox color matched as expected');
} else {
errors.push(`Expected: Level_Challenging data textbox color: "rgba(73, 80, 87, 1)"; Actual: "${elementTextColor}"`);
}
//icon tool-tip
if (elementIconTooltip === 'Remove Field') {
console.log('Passed: Level_Challenging Delete icon tool-tip text matched as expected');
} else {
errors.push(`Expected: Level_Challenging: "Remove Field"; Actual: "${elementIconTooltip}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Level_On Target label
{
description: 'Validate LevelOn Target label text, size, and color',
action: async () => {
const multipleChecks = 'Level_On Target label';
const element = await driver.findElement(By.css('#m19a1d038868c30f294ee5045203780c1 > td:nth-child(1)'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//text
if (elementText === 'Level_On Target') {
console.log('Passed: Level_On Target label text matched as expected');
} else {
errors.push(`Expected: Label: "Level_On Target"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Level_On Target label font matched as expected');
} else {
errors.push(`Expected: Level_On Target label font "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '14.3px') {
console.log('Passed: Level_On Target label text font-size matched as expected');
} else {
errors.push(`Expected: Level_On Target label text font-size "14.3px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(33, 37, 41, 1)') {
console.log('Passed: Level_On Target label text color matched as expected');
} else {
errors.push(`Expected: Level_On Target label text color: "rgba(33, 37, 41, 1)"; Actual: "${elementTextColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Level_On Target textbox and delete icon
{
description: 'Validate LevelOn Target textbox and delete icon',
action: async () => {
const multipleChecks = 'Level_On Target textbox and delete icon';
const element = await driver.findElement(By.css('#m19a1d038868c30f294ee5045203780c1 .form-control'));
const elementIcon = await driver.findElement(By.css('#m19a1d038868c30f294ee5045203780c1 > td:nth-child(3) > a'));
//Get text, font, size, and color
const elementText = await element.getAttribute('value');
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
const elementIconTooltip = await elementIcon.getAttribute('title');
//Track all errors
const errors = [];
//text
if (elementText === '9,10,11,12') {
console.log('Passed: Level_On Target data textbox text matched as expected');
} else {
errors.push(`Expected: Level_On Target: "9,10,11,12"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === "Poppins, sans-serif") {
console.log('Passed: Level_On Target data textbox font matched as expected');
} else {
errors.push(`Expected: Level_On Target data textbox font "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '16px') {
console.log('Passed: Level_On Target data textbox font-size matched as expected');
} else {
errors.push(`Expected: Level_On Target data textbox font-size "16px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(73, 80, 87, 1)') {
console.log('Passed: Level_On Target data textbox color matched as expected');
} else {
errors.push(`Expected: Level_On Target data textbox color: "rgba(73, 80, 87, 1)"; Actual: "${elementTextColor}"`);
}
//icon tool-tip
if (elementIconTooltip === 'Remove Field') {
console.log('Passed: Level_On Target Delete icon tool-tip text matched as expected');
} else {
errors.push(`Expected: Level_On Target: "Remove Field"; Actual: "${elementIconTooltip}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Login Required label
{
description: 'Validate Login Required label text, size, and color',
action: async () => {
const multipleChecks = 'Login Required label';
const element = await driver.findElement(By.css('#m66634eae9c5df8a656d5862b2f3c61b1 > td:nth-child(1)'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//text
if (elementText === 'Login Required') {
console.log('Passed: Login Required label text matched as expected');
} else {
errors.push(`Expected: Label: "Login Required"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Login Required label font matched as expected');
} else {
errors.push(`Expected: Login Required label font "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '14.3px') {
console.log('Passed: Login Required label text font-size matched as expected');
} else {
errors.push(`Expected: Login Required label text font-size "14.3px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(33, 37, 41, 1)') {
console.log('Passed: Login Required label text color matched as expected');
} else {
errors.push(`Expected: Login Required label text color: "rgba(33, 37, 41, 1)"; Actual: "${elementTextColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Login Required textbox and delete icon
{
description: 'Validate Login Required textbox and delete icon',
action: async () => {
const multipleChecks = 'Login Required textbox and delete icon';
const element = await driver.findElement(By.css('#m66634eae9c5df8a656d5862b2f3c61b1 .form-control'));
const elementIcon = await driver.findElement(By.css('#m66634eae9c5df8a656d5862b2f3c61b1 > td:nth-child(3) > a'));
//Get text, font, size, and color
const elementText = await element.getAttribute('value');
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
const elementIconTooltip = await elementIcon.getAttribute('title');
//Track all errors
const errors = [];
//text
if (elementText === 'No') {
console.log('Passed: Login Required data textbox text matched as expected');
} else {
errors.push(`Expected: Login Required: "No"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === "Poppins, sans-serif") {
console.log('Passed: Login Required data textbox font matched as expected');
} else {
errors.push(`Expected: Login Required data textbox font "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '16px') {
console.log('Passed: Login Required data textbox font-size matched as expected');
} else {
errors.push(`Expected: Login Required data textbox font-size "16px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(73, 80, 87, 1)') {
console.log('Passed: Login Required data textbox color matched as expected');
} else {
errors.push(`Expected: Login Required data textbox color: "rgba(73, 80, 87, 1)"; Actual: "${elementTextColor}"`);
}
//icon tool-tip
if (elementIconTooltip === 'Remove Field') {
console.log('Passed: Login Required Delete icon tool-tip text matched as expected');
} else {
errors.push(`Expected: Login Required: "Remove Field"; Actual: "${elementIconTooltip}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Printable label
{
description: 'Validate Printable label text, size, and color',
action: async () => {
const multipleChecks = 'Printable label';
const element = await driver.findElement(By.css('#m45868127f2091b432170a9e864bbdd67 > td:nth-child(1)'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//text
if (elementText === 'Printable') {
console.log('Passed: Printable label text matched as expected');
} else {
errors.push(`Expected: Label: "Printable"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Printable label font matched as expected');
} else {
errors.push(`Expected: Printable label font "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '14.3px') {
console.log('Passed: Printable label text font-size matched as expected');
} else {
errors.push(`Expected: Printable label text font-size "14.3px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(33, 37, 41, 1)') {
console.log('Passed: Printable label text color matched as expected');
} else {
errors.push(`Expected: Printable label text color: "rgba(33, 37, 41, 1)"; Actual: "${elementTextColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Printable textbox and delete icon
{
description: 'Validate Printable textbox and delete icon',
action: async () => {
const multipleChecks = 'Printable textbox and delete icon';
const element = await driver.findElement(By.css('#m45868127f2091b432170a9e864bbdd67 .form-control'));
const elementIcon = await driver.findElement(By.css('#m45868127f2091b432170a9e864bbdd67 > td:nth-child(3) > a'));
//Get text, font, size, and color
const elementText = await element.getAttribute('value');
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
const elementIconTooltip = await elementIcon.getAttribute('title');
//Track all errors
const errors = [];
//text
if (elementText === 'Yes') {
console.log('Passed: Printable data textbox text matched as expected');
} else {
errors.push(`Expected: Printable: "Yes"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === "Poppins, sans-serif") {
console.log('Passed: Printable data textbox font matched as expected');
} else {
errors.push(`Expected: Printable data textbox font "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '16px') {
console.log('Passed: Printabled data textbox font-size matched as expected');
} else {
errors.push(`Expected: Printable data textbox font-size "16px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(73, 80, 87, 1)') {
console.log('Passed: Printable data textbox color matched as expected');
} else {
errors.push(`Expected: Printable data textbox color: "rgba(73, 80, 87, 1)"; Actual: "${elementTextColor}"`);
}
//icon tool-tip
if (elementIconTooltip === 'Remove Field') {
console.log('Passed: Printable Delete icon tool-tip text matched as expected');
} else {
errors.push(`Expected: Printable: "Remove Field"; Actual: "${elementIconTooltip}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Source label
{
description: 'Validate Source label text, size, and color',
action: async () => {
const multipleChecks = 'Source label';
const element = await driver.findElement(By.css('#mec897a8d88912c6d5a93e7375db92d1c > td:nth-child(1)'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//text
if (elementText === 'Source') {
console.log('Passed: Source label text matched as expected');
} else {
errors.push(`Expected: Label: "Source"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Source label font matched as expected');
} else {
errors.push(`Expected: Source label font "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '14.3px') {
console.log('Passed: Source label text font-size matched as expected');
} else {
errors.push(`Expected: Source label text font-size "14.3px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(33, 37, 41, 1)') {
console.log('Passed: Source label text color matched as expected');
} else {
errors.push(`Expected: Source label text color: "rgba(33, 37, 41, 1)"; Actual: "${elementTextColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Source textbox and delete icon
{
description: 'Validate Source textbox and delete icon',
action: async () => {
const multipleChecks = 'Source textbox and delete icon';
const element = await driver.findElement(By.css('#mec897a8d88912c6d5a93e7375db92d1c .form-control'));
const elementIcon = await driver.findElement(By.css('#mec897a8d88912c6d5a93e7375db92d1c > td:nth-child(3) > a'));
//Get text, font, size, and color
const elementText = await element.getAttribute('value');
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
const elementIconTooltip = await elementIcon.getAttribute('title');
//Track all errors
const errors = [];
//text
if (elementText === 'University of Arizona') {
console.log('Passed: Source data textbox text matched as expected');
} else {
errors.push(`Expected: Source: "University of Arizona"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === "Poppins, sans-serif") {
console.log('Passed: Source data textbox font matched as expected');
} else {
errors.push(`Expected: Source data textbox font "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '16px') {
console.log('Passed: Source data textbox font-size matched as expected');
} else {
errors.push(`Expected: Source data textbox font-size "16px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(73, 80, 87, 1)') {
console.log('Passed: Source data textbox color matched as expected');
} else {
errors.push(`Expected: Source data textbox color: "rgba(73, 80, 87, 1)"; Actual: "${elementTextColor}"`);
}
//icon tool-tip
if (elementIconTooltip === 'Remove Field') {
console.log('Passed: Source Delete icon tool-tip text matched as expected');
} else {
errors.push(`Expected: Source: "Remove Field"; Actual: "${elementIconTooltip}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Subject(s) label
{
description: 'Validate Subjects label text, size, and color',
action: async () => {
const multipleChecks = 'Subject(s) label';
const element = await driver.findElement(By.css('#m28b7dfc64f791860c5f2f20f7c1a2027 > td:nth-child(1)'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//text
if (elementText === 'Subject(s)') {
console.log('Passed: Subject(s) label text matched as expected');
} else {
errors.push(`Expected: Label: "Subject(s)"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Subject(s) label font matched as expected');
} else {
errors.push(`Expected: Subject(s) label font "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '14.3px') {
console.log('Passed: Subject(s) label text font-size matched as expected');
} else {
errors.push(`Expected: Subject(s) label text font-size "14.3px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(33, 37, 41, 1)') {
console.log('Passed: Subject(s) label text color matched as expected');
} else {
errors.push(`Expected: Subject(s) label text color: "rgba(33, 37, 41, 1)"; Actual: "${elementTextColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Subject(s) textbox and delete icon
{
description: 'Validate Subjects textbox and delete icon',
action: async () => {
const multipleChecks = 'Subject(s) textbox and delete icon';
const element = await driver.findElement(By.css('#m28b7dfc64f791860c5f2f20f7c1a2027 .form-control'));
const elementIcon = await driver.findElement(By.css('#m28b7dfc64f791860c5f2f20f7c1a2027 > td:nth-child(3) > a'));
//Get text, font, size, and color
const elementText = await element.getAttribute('value');
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
const elementIconTooltip = await elementIcon.getAttribute('title');
//Track all errors
const errors = [];
//text
if (elementText === 'Science,Social Studies') {
console.log('Passed: Subject(s) data textbox text matched as expected');
} else {
errors.push(`Expected: Subject(s): "Science,Social Studies"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === "Poppins, sans-serif") {
console.log('Passed: Subject(s) data textbox font matched as expected');
} else {
errors.push(`Expected: Subject(s) data textbox font "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '16px') {
console.log('Passed: Subject(s) data textbox font-size matched as expected');
} else {
errors.push(`Expected: Subject(s) data textbox font-size "16px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(73, 80, 87, 1)') {
console.log('Passed: Subject(s) data textbox color matched as expected');
} else {
errors.push(`Expected: Subject(s) data textbox color: "rgba(73, 80, 87, 1)"; Actual: "${elementTextColor}"`);
}
//icon tool-tip
if (elementIconTooltip === 'Remove Field') {
console.log('Passed: Subject(s) Delete icon tool-tip text matched as expected');
} else {
errors.push(`Expected: Subject(s): "Remove Field"; Actual: "${elementIconTooltip}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Target Audience label
{
description: 'Validate Target Audience label text, size, and color',
action: async () => {
const multipleChecks = 'Target Audience label';
const element = await driver.findElement(By.css('#mfd8a2f5a0931f475e59ebbe64afc045b > td:nth-child(1)'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//text
if (elementText === 'Target Audience') {
console.log('Passed: Target Audience label text matched as expected');
} else {
errors.push(`Expected: Label: "Target Audience"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Target Audience label font matched as expected');
} else {
errors.push(`Expected: Target Audience label font "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '14.3px') {
console.log('Passed: Target Audience label text font-size matched as expected');
} else {
errors.push(`Expected: Target Audience label text font-size "14.3px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(33, 37, 41, 1)') {
console.log('Passed: Target Audience label text color matched as expected');
} else {
errors.push(`Expected: Target Audience label text color: "rgba(33, 37, 41, 1)"; Actual: "${elementTextColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Target Audience dropdown and delete icon
{
description: 'Validate Target Audience dropdown and delete icon',
action: async () => {
const multipleChecks = 'Target Audiencee dropdown and delete icon';
const element = await driver.findElement(By.css('#mfd8a2f5a0931f475e59ebbe64afc045b .form-control'));
const selectedOption = await element.findElement(By.css('option:checked'));
const elementIcon = await driver.findElement(By.css('#mfd8a2f5a0931f475e59ebbe64afc045b > td:nth-child(3) > a'));
//Get text, font, size, and color
const elementText = await element.getAttribute('value');
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
const elementIconTooltip = await elementIcon.getAttribute('title');
const options = await element.findElements(By.css('option'));
//Track all errors
const errors = [];
//text
if (elementText === 'Teacher') {
console.log('Passed: Target Audience data dropdown text matched as expected');
} else {
errors.push(`Expected: Target Audience: "English"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === "Poppins, sans-serif") {
console.log('Passed: Target Audience data dropdown font matched as expected');
} else {
errors.push(`Expected: Target Audience data dropdown font "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '16px') {
console.log('Passed: Target Audience data dropdown font-size matched as expected');
} else {
errors.push(`Expected: Target Audience data dropdown font-size "16px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(73, 80, 87, 1)') {
console.log('Passed: Target Audience data dropdown color matched as expected');
} else {
errors.push(`Expected: Target Audiencee data dropdown color: "rgba(73, 80, 87, 1)"; Actual: "${elementTextColor}"`);
}
const expected = [
'Administrator',
'Adult',
'College/ University Instructor',
'Curriculum Supervisor',
'Educator',
'Elementary School Teacher',
'General Public',
'Librarian / Media Specialist',
'Medical Professional',
'Middle School Teacher',
'Other Educational Professional',
'Parent',
'Patient',
'Policy-Maker',
'Professional',
'Secondary School Teacher',
'Student',
'Student Teacher',
'Supervisor',
'Teacher',
'Teacher Educator',
'Teaching Professional',
'Technology Coordinator'
];
const actual = [];
for (const opt of options) {
const text = (await opt.getText()).trim();
actual.push(text);
}
if (JSON.stringify(actual) === JSON.stringify(expected)) {
console.log('Passed: Target Audience - Dropdown list matched as expected');
} else {
throw new Error(`Expected: Target Audience - Dropdown list: ${JSON.stringify(expected)}, Actual: ${JSON.stringify(actual)}`);
}
//icon tool-tip
if (elementIconTooltip === 'Remove Field') {
console.log('Passed: Target Audience Delete icon tool-tip text matched as expected');
} else {
errors.push(`Expected: Target Audience: "Remove Field"; Actual: "${elementIconTooltip}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Terms of Use label
{
description: 'Validate Terms of Use label text, size, and color',
action: async () => {
const multipleChecks = 'Terms of Use label';
const element = await driver.findElement(By.css('#m65386aa4c4a432df8917936cd48ce822 > td:nth-child(1)'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//text
if (elementText === 'Terms of Use') {
console.log('Passed: Terms of Use label text matched as expected');
} else {
errors.push(`Expected: Label: "Terms of Use"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Terms of Use label font matched as expected');
} else {
errors.push(`Expected: Terms of Use label font "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '14.3px') {
console.log('Passed: Terms of Use label text font-size matched as expected');
} else {
errors.push(`Expected: Terms of Use label text font-size "14.3px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(33, 37, 41, 1)') {
console.log('Passed: Terms of Use label text color matched as expected');
} else {
errors.push(`Expected: Terms of Use label text color: "rgba(33, 37, 41, 1)"; Actual: "${elementTextColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Terms of Use textbox and delete icon
{
description: 'Validate Terms of Use textbox and delete icon',
action: async () => {
const multipleChecks = 'Terms of Use textbox and delete icon';
const element = await driver.findElement(By.css('#m65386aa4c4a432df8917936cd48ce822 .form-control'));
const elementIcon = await driver.findElement(By.css('#m65386aa4c4a432df8917936cd48ce822 > td:nth-child(3) > a'));
//Get text, font, size, and color
const elementText = await element.getAttribute('value');
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
const elementIconTooltip = await elementIcon.getAttribute('title');
//Track all errors
const errors = [];
//text
if (elementText === 'http://pulse.pharmacy.arizona.edu/about/index.html') {
console.log('Passed: Terms of Use data textbox text matched as expected');
} else {
errors.push(`Expected: Terms of Use: "http://pulse.pharmacy.arizona.edu/about/index.html"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === "Poppins, sans-serif") {
console.log('Passed: Terms of Use data textbox font matched as expected');
} else {
errors.push(`Expected: Terms of Use data textbox font "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '16px') {
console.log('Passed: Terms of Use data textbox font-size matched as expected');
} else {
errors.push(`Expected: Terms of Use data textbox font-size "16px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(73, 80, 87, 1)') {
console.log('Passed: Terms of Use data textbox color matched as expected');
} else {
errors.push(`Expected: Terms of Use data textbox color: "rgba(73, 80, 87, 1)"; Actual: "${elementTextColor}"`);
}
//icon tool-tip
if (elementIconTooltip === 'Remove Field') {
console.log('Passed: Terms of Use Delete icon tool-tip text matched as expected');
} else {
errors.push(`Expected: Terms of Use: "Remove Field"; Actual: "${elementIconTooltip}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Alignment Status label
{
description: 'Validate Alignment Status label text, size, and color',
action: async () => {
const multipleChecks = 'Alignment Status label';
const element = await driver.findElement(By.css('#mda419069683b65df715651e536180454 > td:nth-child(1)'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//text
if (elementText === 'Alignment Status') {
console.log('Passed: Alignment Status label text matched as expected');
} else {
errors.push(`Expected: Label: "Alignment Status"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Alignment Status label font matched as expected');
} else {
errors.push(`Expected: Alignment Status label font "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '14.3px') {
console.log('Passed: Alignment Status label text font-size matched as expected');
} else {
errors.push(`Expected: Alignment Status label text font-size "14.3px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(33, 37, 41, 1)') {
console.log('Passed: Alignment Status label text color matched as expected');
} else {
errors.push(`Expected: Alignment Status label text color: "rgba(33, 37, 41, 1)"; Actual: "${elementTextColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Alignment Status textbox and delete icon
{
description: 'Validate Alignment Status textbox and delete icon',
action: async () => {
const multipleChecks = 'Alignment Status textbox and delete icon';
const element = await driver.findElement(By.css('#mda419069683b65df715651e536180454 .form-control'));
const elementIcon = await driver.findElement(By.css('#mda419069683b65df715651e536180454 > td:nth-child(3) > a'));
//Get text, font, size, and color
const elementText = await element.getAttribute('value');
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
const elementIconTooltip = await elementIcon.getAttribute('title');
//Track all errors
const errors = [];
//text
if (elementText === 'Not Aligned') {
console.log('Passed: Alignment Status data textbox text matched as expected');
} else {
errors.push(`Expected: Alignment Status: "Not Aligned"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === "Poppins, sans-serif") {
console.log('Passed: Alignment Status data textbox font matched as expected');
} else {
errors.push(`Expected: Alignment Status data textbox font "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '16px') {
console.log('Passed: Alignment Status data textbox font-size matched as expected');
} else {
errors.push(`Expected: Alignment Status data textbox font-size "16px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(73, 80, 87, 1)') {
console.log('Passed: Alignment Status data textbox color matched as expected');
} else {
errors.push(`Expected: Alignment Status data textbox color: "rgba(73, 80, 87, 1)"; Actual: "${elementTextColor}"`);
}
//icon tool-tip
if (elementIconTooltip === 'Remove Field') {
console.log('Passed: Alignment Status Delete icon tool-tip text matched as expected');
} else {
errors.push(`Expected: Alignment Status: "Remove Field"; Actual: "${elementIconTooltip}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Descriptors label
{
description: 'Validate Descriptors label text, size, and color',
action: async () => {
const multipleChecks = 'Descriptors label';
const element = await driver.findElement(By.xpath('//tbody[2]/tr/td'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//text
if (elementText === 'Descriptors') {
console.log('Passed: Descriptors label text matched as expected');
} else {
errors.push(`Expected: Label: "Descriptors"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Descriptors label font matched as expected');
} else {
errors.push(`Expected: Descriptors label font "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '14.3px') {
console.log('Passed: Descriptors label text font-size matched as expected');
} else {
errors.push(`Expected: Descriptors label text font-size "14.3px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(33, 37, 41, 1)') {
console.log('Passed: Descriptors label text color matched as expected');
} else {
errors.push(`Expected: Descriptors label text color: "rgba(33, 37, 41, 1)"; Actual: "${elementTextColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Descriptors textbox and delete icon
{
description: 'Validate Descriptors textbox and delete icon',
action: async () => {
const multipleChecks = 'Descriptors textbox and delete icon';
const element = await driver.findElement(By.xpath('//tbody[2]/tr/td[2]/input'));
const elementIcon = await driver.findElement(By.xpath('//tbody[2]/tr/td[3]/a/img'));
//Get text, font, size, and color
const elementText = await element.getAttribute('value');
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//text
if (elementText === 'Metadata automated check') {
console.log('Passed: Descriptors data textbox text matched as expected');
} else {
errors.push(`Expected: Descriptors: "Metadata automated check"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === "Poppins, sans-serif") {
console.log('Passed: Descriptors data textbox font matched as expected');
} else {
errors.push(`Expected: Descriptors data textbox font "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '16px') {
console.log('Passed: Descriptors data textbox font-size matched as expected');
} else {
errors.push(`Expected: Descriptors data textbox font-size "16px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(73, 80, 87, 1)') {
console.log('Passed: Descriptors data textbox color matched as expected');
} else {
errors.push(`Expected: Descriptors data textbox color: "rgba(73, 80, 87, 1)"; Actual: "${elementTextColor}"`);
}
//icon
if (elementIcon) {
console.log('Passed: Descriptors data Delete icon icon is present');
} else {
errors.push('Descriptors data Delete icon icon was not found');
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//NEXT ACTION
{
description: 'Delete added metadata and validate alert message',
action: async () => {
const multipleChecks = 'Delete metadata alert';
const errors = [];
//Click delete button
const deleteButton = await driver.wait(until.elementLocated(By.xpath('//tbody[2]/tr/td[3]/a/img')), 5000);
await deleteButton.click();
await driver.sleep(5000);
console.log('----->| NEXT ACTION: Clicked Delete icon for added metadata');
//Wait for confirm dialog to appear
const alert = await driver.wait(until.alertIsPresent(), 5000);
console.log('----->| NEXT ACTION: Alert dialog appeared as expected');
//Get alert text
const alertText = await alert.getText();
//Validate alert message text
const expectedText = 'Are you sure you want to delete this?';
if (alertText === expectedText) {
console.log('Passed: Delete Alert dialog text matched as expected');
} else {
errors.push(`Expected: "${expectedText}"; Actual: "${alertText}"`);
}
//Throw summary before dismissing if errors found
if (errors.length > 0) {
await alert.dismiss(); //Cancel the delete if validation failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
throw new Error(errors.join('\n'));
}
//Accept the alert (click OK) to proceed with deletion
await alert.accept();
console.log('----->| NEXT ACTION: Clicked OK to confirm alert div Content Set deletion');
await driver.sleep(5000);
//Wait until the element is no longer visible
await driver.wait(async () => {
try {
const element = await driver.findElement(By.xpath('//tbody[2]/tr/td'));
return !(await element.isDisplayed()); //! flips visible to not visible
} catch (e) {
return true; //Element not found at all = also acceptable
}
}, 20000, 'Field Name: Descriptors did not disappear within 20 seconds');
console.log('Passed: Field Name: Descriptors is no longer visible as expected');
}
},
//NEXT ACTION
{
description: 'Click ConceptsCorrelate tab link',
action: async () => {
await driver.executeScript('window.scrollTo(0, 0);');
await driver.sleep(2000);
await driver.findElement(By.linkText('Concepts/Correlate')).click();
console.log('----->| NEXT ACTION: Scrolled to top of page and clicked Concepts/Correlate tab link');
//Wait for page to load completely
await driver.wait(async () => {
const readyState = await driver.executeScript('return document.readyState');
return readyState === 'complete';
}, 30000, 'Edit Item - Concepts/Correlate page did not fully load within 30 seconds');
//Wait until the element exists in the DOM
const pageHeader = await driver.wait(
until.elementLocated(By.css('.ui-widget-heading')),
30000
);
//Wait until it becomes visible
await driver.wait(
until.elementIsVisible(pageHeader),
30000
);
//Wait for page to load completely
await driver.wait(async () => {
const readyState = await driver.executeScript('return document.readyState');
return readyState === 'complete';
}, 30000, 'Edit Item - Concepts/Correlate page did not fully load within 30 seconds');
console.log('Passed: Edit Item - Concepts/Correlate page loaded successfully');
}
},
//Edit Item - Concepts/Correlate page
//Page title
{
description: 'Validate Edit page title text, size, and color',
action: async () => {
const multipleChecks = 'Edit page title';
const element = await driver.findElement(By.css('#myModalLabel'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//text
if (elementText === 'Edit Item') {
console.log('Passed: Edit page title text matched as expected');
} else {
errors.push(`Expected: "Edit Item"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === `"DM Serif Display", serif`) {
console.log('Passed: Edit page title font matched as expected');
} else {
errors.push(`Expected: Edit page title font "DM Serif Display, serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '32px') {
console.log('Passed: Edit page title text font-size matched as expected');
} else {
errors.push(`Expected: Edit page title text font-size "32px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(40, 39, 90, 1)') {
console.log('Passed: Edit page title text color matched as expected');
} else {
errors.push(`Expected: Edit page title text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Resource tab title
{
description: 'Validate Resource tab title text, size, and color',
action: async () => {
const multipleChecks = 'Resource title';
const element = await driver.findElement(By.linkText('Resource'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//text
if (elementText === 'Resource') {
console.log('Passed: Resource tab title text matched as expected');
} else {
errors.push(`Expected: "Resource"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Resource tab title font matched as expected');
} else {
errors.push(`Expected: Resource tab title font "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '14px') {
console.log('Passed: Resource tab title text font-size matched as expected');
} else {
errors.push(`Expected: Resource tab title text font-size "14px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(182, 186, 181, 1)') {
console.log('Passed: Resource tab title text color matched as expected');
} else {
errors.push(`Expected: Resource tab title text color: "rgba(182, 186, 181, 1)"; Actual: "${elementTextColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Metadata tab tab title
{
description: 'Validate Metadata tab title text, size, and color',
action: async () => {
const multipleChecks = 'Metadata tab title';
const element = await driver.findElement(By.linkText('Metadata'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//text
if (elementText === 'Metadata') {
console.log('Passed: Metadata tab title text matched as expected');
} else {
errors.push(`Expected: "Metadata"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Metadata tab title font matched as expected');
} else {
errors.push(`Expected: Metadata tab title font "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '14px') {
console.log('Passed: Metadata tab title text font-size matched as expected');
} else {
errors.push(`Expected: Metadata tab title text font-size "14px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(182, 186, 181, 1)') {
console.log('Passed: Metadata tab title text color matched as expected');
} else {
errors.push(`Expected: Metadata tab title text color: "rgba(182, 186, 181, 1)"; Actual: "${elementTextColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Concepts/Correlate tab title (active)
{
description: 'Validate ConceptsCorrelate tab title text, size, and color',
action: async () => {
const multipleChecks = 'Concepts/Correlate title';
const element = await driver.findElement(By.linkText('Concepts/Correlate'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//text
if (elementText === 'Concepts/Correlate') {
console.log('Passed: Concepts/Correlate tab title text matched as expected');
} else {
errors.push(`Expected: "Concepts/Correlate"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Concepts/Correlate tab title font matched as expected');
} else {
errors.push(`Expected: Concepts/Correlate tab title font "DM Serif Display, serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '14px') {
console.log('Passed: Concepts/Correlate tab title text font-size matched as expected');
} else {
errors.push(`Expected: Concepts/Correlate tab title text font-size "14px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(40, 39, 90, 1)') {
console.log('Passed: Concepts/Correlate tab title text color matched as expected');
} else {
errors.push(`Expected: Concepts/Correlate tab title text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Save Changes button
{
description: 'Validate Save Changes button',
action: async () => {
const multipleChecks = 'Save Changes button';
const elementIcon = await driver.findElement(By.css('.glyphicon-save'));
const element = await driver.findElement(By.css('.submit-content-button'));
//Get text, font, color, and size
const elementText = await element.getText('');
const elementFont = await element.getCssValue('font-family');
const elementSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
const elementButtonColor = await element.getCssValue('background-color');
//Track all errors
const errors = [];
//icon
if (elementIcon) {
console.log('Passed: Save Changes icon is present');
} else {
errors.push('Save Changes icon was not found');
}
//text
if (elementText === 'Save Changes') {
console.log('Passed: Save Changes button text matched as expected');
} else {
errors.push(`Expected: Button text: "Save Changes"; Actual: "${elementText}"`);
}
//font-family
if (elementFont === "Poppins, sans-serif") {
console.log('Passed: Save Changes button text font matched as expected');
} else {
errors.push(`Expected: Save Changes button text font "Poppins, sans-serif"; Actual: ${elementFont}`);
}
//font size
if (elementSize === '14px') {
console.log('Passed: Save Changes button text font-size matched as expected');
} else {
errors.push(`Expected: Save Changes button text font-size "14px"; Actual: "${elementSize}"`);
}
//text color
if (elementTextColor === 'rgba(255, 255, 255, 1)') {
console.log('Passed: Save Changes button text color matched as expected');
} else {
errors.push(`Expected: Save Changes button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`);
}
//button color
if (elementButtonColor === 'rgba(48, 200, 172, 1)') {
console.log('Passed: Save Changes button background color matched as expected');
} else {
errors.push(`Expected: Save Changes button background color: "rgba(48, 200, 172, 1)"; Actual: "${elementButtonColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Tagged Concepts: header
{
description: 'Validate Tagged Concepts header text, size, and color',
action: async () => {
const multipleChecks = 'Tagged Concepts: header';
const element = await driver.findElement(By.css('.ui-widget-heading'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//text
if (elementText === 'Tagged Concepts:') {
console.log('Passed: Tagged Concepts: header text matched as expected');
} else {
errors.push(`Expected: "Tagged Concepts:"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Tagged Concepts: header font matched as expected');
} else {
errors.push(`Expected: Tagged Concepts: header font "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '16px') {
console.log('Passed: Tagged Concepts: header text font-size matched as expected');
} else {
errors.push(`Expected: Tagged Concepts: header text font-size "16px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(40, 39, 90, 1)') {
console.log('Passed: Tagged Concepts: header text color matched as expected');
} else {
errors.push(`Expected: Tagged Concepts: header text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Tagged Concepts: Language Arts | General text
{
description: 'Validate Tagged Concepts Language Arts General text, size, and color',
action: async () => {
const multipleChecks = 'Tagged Concepts: Language Arts | General';
const element = await driver.findElement(By.css('#k425604097'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//text
if (elementText.includes('Language Arts | General')) {
console.log('Passed: Tagged Concepts: Language Arts | General text matched as expected');
} else {
errors.push(`Expected: "Language Arts | General"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Tagged Concepts: Language Arts | General text font matched as expected');
} else {
errors.push(`Expected: Tagged Concepts: Language Arts | General text font "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '12px') {
console.log('Passed: Tagged Concepts: Language Arts | General text font-size matched as expected');
} else {
errors.push(`Expected: Tagged Concepts: Language Arts | General text font-size "12px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(99, 99, 99, 1)') {
console.log('Passed: Tagged Concepts: Language Arts | General text color matched as expected');
} else {
errors.push(`Expected: Tagged Concepts: Language Arts | General text color: "rgba(99, 99, 99, 1)"; Actual: "${elementTextColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Remove button1
{
description: 'Validate Remove button1',
action: async () => {
const multipleChecks = 'Save Changes button1';
const elementIcon = await driver.findElement(By.css('#k425604097 .glyphicon'));
const element = await driver.findElement(By.css('#k425604097 > .btn'));
//Get text, font, color, and size
const elementText = await element.getText('');
const elementFont = await element.getCssValue('font-family');
const elementSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
const elementButtonColor = await element.getCssValue('background-color');
const elementTooltip = await element.getAttribute('title');
//Track all errors
const errors = [];
//icon
if (elementIcon) {
console.log('Passed: Remove button 1 icon is present');
} else {
errors.push('Save Remove button 1 icon was not found');
}
//text
if (elementText === 'Remove') {
console.log('Passed: Remove button 1 text matched as expected');
} else {
errors.push(`Expected: Button 1 text: "Remove"; Actual: "${elementText}"`);
}
//font-family
if (elementFont === "Poppins, sans-serif") {
console.log('Passed: Remove button 1 text font matched as expected');
} else {
errors.push(`Expected: Remove button 1 text font "Poppins, sans-serif"; Actual: ${elementFont}`);
}
//font size
if (elementSize === '12px') {
console.log('Passed: Remove button 1 text font-size matched as expected');
} else {
errors.push(`Expected: Remove button 1 text font-size "12px"; Actual: "${elementSize}"`);
}
//text color
if (elementTextColor === 'rgba(255, 255, 255, 1)') {
console.log('Passed: Remove button 1 text color matched as expected');
} else {
errors.push(`Expected: Remove button 1 text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`);
}
//button color
if (elementButtonColor === 'rgba(246, 60, 40, 1)') {
console.log('Passed: Remove button 1 background color matched as expected');
} else {
errors.push(`Expected: Remove button 1 background color: "rgba(246, 60, 40, 1)"; Actual: "${elementButtonColor}"`);
}
//tool-tip
if (elementTooltip === 'Remove Concept') {
console.log('Passed: Remove button 1 tool-tip text matched as expected');
} else {
errors.push(`Expected: Button 1 tool-tip text: "Remove Concept"; Actual: "${elementTooltip}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Primary toggle icon1
{
description: 'Verify Primary toggle icon1 is present',
action: async () => {
const element = await driver.wait(until.elementLocated(By.css('#k425604097 label')), 5000).catch(() => false);
//Get the switch-toggle div class
const toggleClass = await driver.executeScript(`
const listItem = document.querySelector('li#k425604097');
const toggle = listItem ? listItem.querySelector('div.switch-toggle') : null;
return toggle ? toggle.className : 'not found';
`);
//console.log('----->| DEBUG toggle class:', toggleClass);
//Track all errors
const errors = [];
if (element) {
console.log('Passed: Primary toggle icon 1 appeared as expected');
} else {
errors.push('Primary toggle icon 1 not found');
}
//Validate it's a toggle not a regular button
if (toggleClass.includes('switch-toggle')) {
console.log('Passed: Primary toggle icon 1 toggle switch listed as expected');
} else {
errors.push(`Expected: Primary toggle icon 1: "switch-toggle"; Actual: "${toggleClass}"`);
}
}
},
//Tagged Concepts: Mathematics | General text
{
description: 'Validate Tagged Concepts Mathematics General text, size, and color',
action: async () => {
const multipleChecks = 'Tagged Concepts: Mathematics | General';
const element = await driver.findElement(By.css('#k425604098'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//text
if (elementText.includes('Mathematics | General')) {
console.log('Passed: Tagged Concepts: Mathematics | General text matched as expected');
} else {
errors.push(`Expected: "Mathematics | General"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Tagged Concepts: Mathematics | General text font matched as expected');
} else {
errors.push(`Expected: Tagged Concepts: Mathematics | General text font "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '12px') {
console.log('Passed: Tagged Concepts: Mathematics | General text font-size matched as expected');
} else {
errors.push(`Expected: Tagged Concepts: Mathematics | General text font-size "12px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(99, 99, 99, 1)') {
console.log('Passed: Tagged Concepts: Mathematics | General text color matched as expected');
} else {
errors.push(`Expected: Tagged Concepts: Mathematics | General text color: "rgba(99, 99, 99, 1)"; Actual: "${elementTextColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Remove button2
{
description: 'Validate Remove button2',
action: async () => {
const multipleChecks = 'Save Changes button2';
const elementIcon = await driver.findElement(By.css('#k425604098 .glyphicon'));
const element = await driver.findElement(By.css('#k425604098 > .btn'));
//Get text, font, color, and size
const elementText = await element.getText('');
const elementFont = await element.getCssValue('font-family');
const elementSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
const elementButtonColor = await element.getCssValue('background-color');
const elementTooltip = await element.getAttribute('title');
//Track all errors
const errors = [];
//icon
if (elementIcon) {
console.log('Passed: Remove button 2 icon is present');
} else {
errors.push('Save Remove button 2 icon was not found');
}
//text
if (elementText === 'Remove') {
console.log('Passed: Remove button 2 text matched as expected');
} else {
errors.push(`Expected: Button 2 text: "Remove"; Actual: "${elementText}"`);
}
//font-family
if (elementFont === "Poppins, sans-serif") {
console.log('Passed: Remove button 2 text font matched as expected');
} else {
errors.push(`Expected: Remove button 2 text font "Poppins, sans-serif"; Actual: ${elementFont}`);
}
//font size
if (elementSize === '12px') {
console.log('Passed: Remove button 2 text font-size matched as expected');
} else {
errors.push(`Expected: Remove button 2 text font-size "12px"; Actual: "${elementSize}"`);
}
//text color
if (elementTextColor === 'rgba(255, 255, 255, 1)') {
console.log('Passed: Remove button 2 text color matched as expected');
} else {
errors.push(`Expected: Remove button 2 text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`);
}
//button color
if (elementButtonColor === 'rgba(246, 60, 40, 1)') {
console.log('Passed: Remove button 2 background color matched as expected');
} else {
errors.push(`Expected: Remove button 2 background color: "rgba(246, 60, 40, 1)"; Actual: "${elementButtonColor}"`);
}
//tool-tip
if (elementTooltip === 'Remove Concept') {
console.log('Passed: Remove button 2 tool-tip text matched as expected');
} else {
errors.push(`Expected: Button 2 tool-tip text: "Remove Concept"; Actual: "${elementTooltip}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Primary toggle icon2
{
description: 'Verify Primary toggle icon2 is present',
action: async () => {
const element = await driver.wait(until.elementLocated(By.css('#k425604098 label')), 5000).catch(() => false);
//Get the switch-toggle div class
const toggleClass = await driver.executeScript(`
const listItem = document.querySelector('li#k425604098');
const toggle = listItem ? listItem.querySelector('div.switch-toggle') : null;
return toggle ? toggle.className : 'not found';
`);
//console.log('----->| DEBUG toggle class:', toggleClass);
//Track all errors
const errors = [];
if (element) {
console.log('Passed: Primary toggle icon 2 appeared as expected');
} else {
errors.push('Primary toggle icon 2 not found');
}
//Validate it's a toggle not a regular button
if (toggleClass.includes('switch-toggle')) {
console.log('Passed: Primary toggle icon 2 toggle switch listed as expected');
} else {
errors.push(`Expected: Primary toggle icon 2: "switch-toggle"; Actual: "${toggleClass}"`);
}
}
},
//Tagged Concepts: Science | General text
{
description: 'Validate Tagged Concepts Science General text, size, and color',
action: async () => {
const multipleChecks = 'Tagged Concepts: Science | General';
const element = await driver.findElement(By.css('#k425604099'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//text
if (elementText.includes('Science | General')) {
console.log('Passed: Tagged Concepts: Science | General text matched as expected');
} else {
errors.push(`Expected: "Science | General"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Tagged Concepts: Science | General text font matched as expected');
} else {
errors.push(`Expected: Tagged Concepts: Science | General text font "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '12px') {
console.log('Passed: Tagged Concepts: Science | General text font-size matched as expected');
} else {
errors.push(`Expected: Tagged Concepts: Science | General text font-size "12px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(99, 99, 99, 1)') {
console.log('Passed: Tagged Concepts: Science | General text color matched as expected');
} else {
errors.push(`Expected: Tagged Concepts: Science | General text color: "rgba(99, 99, 99, 1)"; Actual: "${elementTextColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Remove button3
{
description: 'Validate Remove button3',
action: async () => {
const multipleChecks = 'Save Changes button3';
const elementIcon = await driver.findElement(By.css('#k425604099 .glyphicon'));
const element = await driver.findElement(By.css('#k425604099 > .btn'));
//Get text, font, color, and size
const elementText = await element.getText('');
const elementFont = await element.getCssValue('font-family');
const elementSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
const elementButtonColor = await element.getCssValue('background-color');
const elementTooltip = await element.getAttribute('title');
//Track all errors
const errors = [];
//icon
if (elementIcon) {
console.log('Passed: Remove button 3 icon is present');
} else {
errors.push('Save Remove button 3 icon was not found');
}
//text
if (elementText === 'Remove') {
console.log('Passed: Remove button 3 text matched as expected');
} else {
errors.push(`Expected: Button 3 text: "Remove"; Actual: "${elementText}"`);
}
//font-family
if (elementFont === "Poppins, sans-serif") {
console.log('Passed: Remove button 3 text font matched as expected');
} else {
errors.push(`Expected: Remove button 3 text font "Poppins, sans-serif"; Actual: ${elementFont}`);
}
//font size
if (elementSize === '12px') {
console.log('Passed: Remove button 3 text font-size matched as expected');
} else {
errors.push(`Expected: Remove button 3 text font-size "12px"; Actual: "${elementSize}"`);
}
//text color
if (elementTextColor === 'rgba(255, 255, 255, 1)') {
console.log('Passed: Remove button 3 text color matched as expected');
} else {
errors.push(`Expected: Remove button 3 text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`);
}
//button color
if (elementButtonColor === 'rgba(246, 60, 40, 1)') {
console.log('Passed: Remove button 3 background color matched as expected');
} else {
errors.push(`Expected: Remove button 3 background color: "rgba(246, 60, 40, 1)"; Actual: "${elementButtonColor}"`);
}
//tool-tip
if (elementTooltip === 'Remove Concept') {
console.log('Passed: Remove button 3 tool-tip text matched as expected');
} else {
errors.push(`Expected: Button 3 tool-tip text: "Remove Concept"; Actual: "${elementTooltip}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Primary toggle icon3
{
description: 'Verify Primary toggle icon3 is present',
action: async () => {
const element = await driver.wait(until.elementLocated(By.css('#k425604099 label')), 5000).catch(() => false);
//Get the switch-toggle div class
const toggleClass = await driver.executeScript(`
const listItem = document.querySelector('li#k425604099');
const toggle = listItem ? listItem.querySelector('div.switch-toggle') : null;
return toggle ? toggle.className : 'not found';
`);
//console.log('----->| DEBUG toggle class:', toggleClass);
//Track all errors
const errors = [];
if (element) {
console.log('Passed: Primary toggle icon 3 appeared as expected');
} else {
errors.push('Primary toggle icon 3 not found');
}
//Validate it's a toggle not a regular button
if (toggleClass.includes('switch-toggle')) {
console.log('Passed: Primary toggle icon 3 toggle switch listed as expected');
} else {
errors.push(`Expected: Primary toggle icon 3: "switch-toggle"; Actual: "${toggleClass}"`);
}
}
},
//Tagged Concepts: Social Studies | General text
{
description: 'Validate Tagged Concepts Social Studies General text, size, and color',
action: async () => {
const multipleChecks = 'Tagged Concepts: Social Studies | General';
const element = await driver.findElement(By.css('#k425604100'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//text
if (elementText.includes('Social Studies | General')) {
console.log('Passed: Tagged Concepts: Social Studies | General text matched as expected');
} else {
errors.push(`Expected: "Social Studies | General"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Tagged Concepts: Social Studies | General text font matched as expected');
} else {
errors.push(`Expected: Tagged Concepts: Social Studies | General text font "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '12px') {
console.log('Passed: Tagged Concepts: Social Studies | General text font-size matched as expected');
} else {
errors.push(`Expected: Tagged Concepts: Social Studies | General text font-size "12px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(99, 99, 99, 1)') {
console.log('Passed: Tagged Concepts: Social Studies | General text color matched as expected');
} else {
errors.push(`Expected: Tagged Concepts: Social Studies | General text color: "rgba(99, 99, 99, 1)"; Actual: "${elementTextColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Remove button4
{
description: 'Validate Remove button4',
action: async () => {
const multipleChecks = 'Save Changes button4';
const elementIcon = await driver.findElement(By.css('#k425604100 .glyphicon'));
const element = await driver.findElement(By.css('#k425604100 > .btn'));
//Get text, font, color, and size
const elementText = await element.getText('');
const elementFont = await element.getCssValue('font-family');
const elementSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
const elementButtonColor = await element.getCssValue('background-color');
const elementTooltip = await element.getAttribute('title');
//Track all errors
const errors = [];
//icon
if (elementIcon) {
console.log('Passed: Remove button 4 icon is present');
} else {
errors.push('Save Remove button 4 icon was not found');
}
//text
if (elementText === 'Remove') {
console.log('Passed: Remove button 4 text matched as expected');
} else {
errors.push(`Expected: Button 4 text: "Remove"; Actual: "${elementText}"`);
}
//font-family
if (elementFont === "Poppins, sans-serif") {
console.log('Passed: Remove button 4 text font matched as expected');
} else {
errors.push(`Expected: Remove button 4 text font "Poppins, sans-serif"; Actual: ${elementFont}`);
}
//font size
if (elementSize === '12px') {
console.log('Passed: Remove button 4 text font-size matched as expected');
} else {
errors.push(`Expected: Remove button 4 text font-size "12px"; Actual: "${elementSize}"`);
}
//text color
if (elementTextColor === 'rgba(255, 255, 255, 1)') {
console.log('Passed: Remove button 4 text color matched as expected');
} else {
errors.push(`Expected: Remove button 4 text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`);
}
//button color
if (elementButtonColor === 'rgba(246, 60, 40, 1)') {
console.log('Passed: Remove button 4 background color matched as expected');
} else {
errors.push(`Expected: Remove button 4 background color: "rgba(246, 60, 40, 1)"; Actual: "${elementButtonColor}"`);
}
//tool-tip
if (elementTooltip === 'Remove Concept') {
console.log('Passed: Remove button 4 tool-tip text matched as expected');
} else {
errors.push(`Expected: Button 4 tool-tip text: "Remove Concept"; Actual: "${elementTooltip}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Primary toggle icon4
{
description: 'Verify Primary toggle icon4 is present',
action: async () => {
const element = await driver.wait(until.elementLocated(By.css('#k425604100 label')), 5000).catch(() => false);
//Get the switch-toggle div class
const toggleClass = await driver.executeScript(`
const listItem = document.querySelector('li#k425604100');
const toggle = listItem ? listItem.querySelector('div.switch-toggle') : null;
return toggle ? toggle.className : 'not found';
`);
//console.log('----->| DEBUG toggle class:', toggleClass);
//Track all errors
const errors = [];
if (element) {
console.log('Passed: Primary toggle icon 4 appeared as expected');
} else {
errors.push('Primary toggle icon 4 not found');
}
//Validate it's a toggle not a regular button
if (toggleClass.includes('switch-toggle')) {
console.log('Passed: Primary toggle icon 4 toggle switch listed as expected');
} else {
errors.push(`Expected: Primary toggle icon 4: "switch-toggle"; Actual: "${toggleClass}"`);
}
}
},
//NEXT ACTION
{
description: 'Click Primary toggle for tagged Science concept',
action: async () => {
await driver.findElement(By.css('#k425604099 label')).click();
console.log('----->| NEXT ACTION: Clicked Primary toggle for tagged concept');
//Wait for page to load completely
await driver.wait(async () => {
const readyState = await driver.executeScript('return document.readyState');
return readyState === 'complete';
}, 30000, 'Edit Item page did not fully load within 30 seconds');
//Wait until the element exists in the DOM
const primaryToggleEnabled = await driver.wait(
until.elementLocated(By.css('#k425604099 .switch-primary')),
30000
);
//Wait until it becomes visible
await driver.wait(
until.elementIsVisible(primaryToggleEnabled),
30000
);
//Wait for page to load completely
await driver.wait(async () => {
const readyState = await driver.executeScript('return document.readyState');
return readyState === 'complete';
}, 30000, 'Edit Item page did not fully load within 30 seconds');
console.log('Passed: Edit Item page loaded successfully');
}
},
//Tagged Concepts: header
{
description: 'Validate Tagged Concepts header text, size, and color',
action: async () => {
const multipleChecks = 'Tagged Concepts: header';
const element = await driver.findElement(By.css('.ui-widget-heading'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//text
if (elementText === 'Tagged Concepts:') {
console.log('Passed: Tagged Concepts: header text matched as expected');
} else {
errors.push(`Expected: "Tagged Concepts:"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Tagged Concepts: header font matched as expected');
} else {
errors.push(`Expected: Tagged Concepts: header font "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '16px') {
console.log('Passed: Tagged Concepts: header text font-size matched as expected');
} else {
errors.push(`Expected: Tagged Concepts: header text font-size "16px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(40, 39, 90, 1)') {
console.log('Passed: Tagged Concepts: header text color matched as expected');
} else {
errors.push(`Expected: Tagged Concepts: header text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Tagged Concepts: Language Arts | General text
{
description: 'Validate Tagged Concepts Language Arts General text, size, and color',
action: async () => {
const multipleChecks = 'Tagged Concepts: Language Arts | General';
const element = await driver.findElement(By.css('#k425604097'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//text
if (elementText.includes('Language Arts | General')) {
console.log('Passed: Tagged Concepts: Language Arts | General text matched as expected');
} else {
errors.push(`Expected: "Language Arts | General"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Tagged Concepts: Language Arts | General text font matched as expected');
} else {
errors.push(`Expected: Tagged Concepts: Language Arts | General text font "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '12px') {
console.log('Passed: Tagged Concepts: Language Arts | General text font-size matched as expected');
} else {
errors.push(`Expected: Tagged Concepts: Language Arts | General text font-size "12px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(99, 99, 99, 1)') {
console.log('Passed: Tagged Concepts: Language Arts | General text color matched as expected');
} else {
errors.push(`Expected: Tagged Concepts: Language Arts | General text color: "rgba(99, 99, 99, 1)"; Actual: "${elementTextColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Remove button1
{
description: 'Validate Remove button1',
action: async () => {
const multipleChecks = 'Save Changes button1';
const elementIcon = await driver.findElement(By.css('#k425604097 .glyphicon'));
const element = await driver.findElement(By.css('#k425604097 > .btn'));
//Get text, font, color, and size
const elementText = await element.getText('');
const elementFont = await element.getCssValue('font-family');
const elementSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
const elementButtonColor = await element.getCssValue('background-color');
const elementTooltip = await element.getAttribute('title');
//Track all errors
const errors = [];
//icon
if (elementIcon) {
console.log('Passed: Remove button 1 icon is present');
} else {
errors.push('Save Remove button 1 icon was not found');
}
//text
if (elementText === 'Remove') {
console.log('Passed: Remove button 1 text matched as expected');
} else {
errors.push(`Expected: Button 1 text: "Remove"; Actual: "${elementText}"`);
}
//font-family
if (elementFont === "Poppins, sans-serif") {
console.log('Passed: Remove button 1 text font matched as expected');
} else {
errors.push(`Expected: Remove button 1 text font "Poppins, sans-serif"; Actual: ${elementFont}`);
}
//font size
if (elementSize === '12px') {
console.log('Passed: Remove button 1 text font-size matched as expected');
} else {
errors.push(`Expected: Remove button 1 text font-size "12px"; Actual: "${elementSize}"`);
}
//text color
if (elementTextColor === 'rgba(255, 255, 255, 1)') {
console.log('Passed: Remove button 1 text color matched as expected');
} else {
errors.push(`Expected: Remove button 1 text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`);
}
//button color
if (elementButtonColor === 'rgba(246, 60, 40, 1)') {
console.log('Passed: Remove button 1 background color matched as expected');
} else {
errors.push(`Expected: Remove button 1 background color: "rgba(246, 60, 40, 1)"; Actual: "${elementButtonColor}"`);
}
//tool-tip
if (elementTooltip === 'Remove Concept') {
console.log('Passed: Remove button 1 tool-tip text matched as expected');
} else {
errors.push(`Expected: Button 1 tool-tip text: "Remove Concept"; Actual: "${elementTooltip}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Primary toggle icon1
{
description: 'Verify Primary toggle icon1 is present',
action: async () => {
const element = await driver.wait(until.elementLocated(By.css('#k425604097 label')), 5000).catch(() => false);
//Get the switch-toggle div class
const toggleClass = await driver.executeScript(`
const listItem = document.querySelector('li#k425604097');
const toggle = listItem ? listItem.querySelector('div.switch-toggle') : null;
return toggle ? toggle.className : 'not found';
`);
//console.log('----->| DEBUG toggle class:', toggleClass);
//Track all errors
const errors = [];
if (element) {
console.log('Passed: Primary toggle icon 1 appeared as expected');
} else {
errors.push('Primary toggle icon 1 not found');
}
//Validate it's a toggle not a regular button
if (toggleClass.includes('switch-toggle')) {
console.log('Passed: Primary toggle icon 1 toggle switch listed as expected');
} else {
errors.push(`Expected: Primary toggle icon 1: "switch-toggle"; Actual: "${toggleClass}"`);
}
}
},
//Tagged Concepts: Mathematics | General text
{
description: 'Validate Tagged Concepts Mathematics General text, size, and color',
action: async () => {
const multipleChecks = 'Tagged Concepts: Mathematics | General';
const element = await driver.findElement(By.css('#k425604098'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//text
if (elementText.includes('Mathematics | General')) {
console.log('Passed: Tagged Concepts: Mathematics | General text matched as expected');
} else {
errors.push(`Expected: "Mathematics | General"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Tagged Concepts: Mathematics | General text font matched as expected');
} else {
errors.push(`Expected: Tagged Concepts: Mathematics | General text font "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '12px') {
console.log('Passed: Tagged Concepts: Mathematics | General text font-size matched as expected');
} else {
errors.push(`Expected: Tagged Concepts: Mathematics | General text font-size "12px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(99, 99, 99, 1)') {
console.log('Passed: Tagged Concepts: Mathematics | General text color matched as expected');
} else {
errors.push(`Expected: Tagged Concepts: Mathematics | General text color: "rgba(99, 99, 99, 1)"; Actual: "${elementTextColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Remove button2
{
description: 'Validate Remove button2',
action: async () => {
const multipleChecks = 'Save Changes button2';
const elementIcon = await driver.findElement(By.css('#k425604098 .glyphicon'));
const element = await driver.findElement(By.css('#k425604098 > .btn'));
//Get text, font, color, and size
const elementText = await element.getText('');
const elementFont = await element.getCssValue('font-family');
const elementSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
const elementButtonColor = await element.getCssValue('background-color');
const elementTooltip = await element.getAttribute('title');
//Track all errors
const errors = [];
//icon
if (elementIcon) {
console.log('Passed: Remove button 2 icon is present');
} else {
errors.push('Save Remove button 2 icon was not found');
}
//text
if (elementText === 'Remove') {
console.log('Passed: Remove button 2 text matched as expected');
} else {
errors.push(`Expected: Button 2 text: "Remove"; Actual: "${elementText}"`);
}
//font-family
if (elementFont === "Poppins, sans-serif") {
console.log('Passed: Remove button 2 text font matched as expected');
} else {
errors.push(`Expected: Remove button 2 text font "Poppins, sans-serif"; Actual: ${elementFont}`);
}
//font size
if (elementSize === '12px') {
console.log('Passed: Remove button 2 text font-size matched as expected');
} else {
errors.push(`Expected: Remove button 2 text font-size "12px"; Actual: "${elementSize}"`);
}
//text color
if (elementTextColor === 'rgba(255, 255, 255, 1)') {
console.log('Passed: Remove button 2 text color matched as expected');
} else {
errors.push(`Expected: Remove button 2 text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`);
}
//button color
if (elementButtonColor === 'rgba(246, 60, 40, 1)') {
console.log('Passed: Remove button 2 background color matched as expected');
} else {
errors.push(`Expected: Remove button 2 background color: "rgba(246, 60, 40, 1)"; Actual: "${elementButtonColor}"`);
}
//tool-tip
if (elementTooltip === 'Remove Concept') {
console.log('Passed: Remove button 2 tool-tip text matched as expected');
} else {
errors.push(`Expected: Button 2 tool-tip text: "Remove Concept"; Actual: "${elementTooltip}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Primary toggle icon2
{
description: 'Verify Primary toggle icon2 is present',
action: async () => {
const element = await driver.wait(until.elementLocated(By.css('#k425604098 label')), 5000).catch(() => false);
//Get the switch-toggle div class
const toggleClass = await driver.executeScript(`
const listItem = document.querySelector('li#k425604098');
const toggle = listItem ? listItem.querySelector('div.switch-toggle') : null;
return toggle ? toggle.className : 'not found';
`);
//console.log('----->| DEBUG toggle class:', toggleClass);
//Track all errors
const errors = [];
if (element) {
console.log('Passed: Primary toggle icon 2 appeared as expected');
} else {
errors.push('Primary toggle icon 2 not found');
}
//Validate it's a toggle not a regular button
if (toggleClass.includes('switch-toggle')) {
console.log('Passed: Primary toggle icon 2 toggle switch listed as expected');
} else {
errors.push(`Expected: Primary toggle icon 2: "switch-toggle"; Actual: "${toggleClass}"`);
}
}
},
//Tagged Concepts: Science | General text
{
description: 'Validate Tagged Concepts Science General text, size, and color',
action: async () => {
const multipleChecks = 'Tagged Concepts: Science | General';
const element = await driver.findElement(By.css('#k425604099'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//text
if (elementText.includes('Science | General')) {
console.log('Passed: Tagged Concepts: Science | General text matched as expected');
} else {
errors.push(`Expected: "Science | General"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Tagged Concepts: Science | General text font matched as expected');
} else {
errors.push(`Expected: Tagged Concepts: Science | General text font "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '12px') {
console.log('Passed: Tagged Concepts: Science | General text font-size matched as expected');
} else {
errors.push(`Expected: Tagged Concepts: Science | General text font-size "12px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(99, 99, 99, 1)') {
console.log('Passed: Tagged Concepts: Science | General text color matched as expected');
} else {
errors.push(`Expected: Tagged Concepts: Science | General text color: "rgba(99, 99, 99, 1)"; Actual: "${elementTextColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Remove button3
{
description: 'Validate Remove button3',
action: async () => {
const multipleChecks = 'Save Changes button3';
const elementIcon = await driver.findElement(By.css('#k425604099 .glyphicon'));
const element = await driver.findElement(By.css('#k425604099 > .btn'));
//Get text, font, color, and size
const elementText = await element.getText('');
const elementFont = await element.getCssValue('font-family');
const elementSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
const elementButtonColor = await element.getCssValue('background-color');
const elementTooltip = await element.getAttribute('title');
//Track all errors
const errors = [];
//icon
if (elementIcon) {
console.log('Passed: Remove button 3 icon is present');
} else {
errors.push('Save Remove button 3 icon was not found');
}
//text
if (elementText === 'Remove') {
console.log('Passed: Remove button 3 text matched as expected');
} else {
errors.push(`Expected: Button 3 text: "Remove"; Actual: "${elementText}"`);
}
//font-family
if (elementFont === "Poppins, sans-serif") {
console.log('Passed: Remove button 3 text font matched as expected');
} else {
errors.push(`Expected: Remove button 3 text font "Poppins, sans-serif"; Actual: ${elementFont}`);
}
//font size
if (elementSize === '12px') {
console.log('Passed: Remove button 3 text font-size matched as expected');
} else {
errors.push(`Expected: Remove button 3 text font-size "12px"; Actual: "${elementSize}"`);
}
//text color
if (elementTextColor === 'rgba(255, 255, 255, 1)') {
console.log('Passed: Remove button 3 text color matched as expected');
} else {
errors.push(`Expected: Remove button 3 text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`);
}
//button color
if (elementButtonColor === 'rgba(246, 60, 40, 1)') {
console.log('Passed: Remove button 3 background color matched as expected');
} else {
errors.push(`Expected: Remove button 3 background color: "rgba(246, 60, 40, 1)"; Actual: "${elementButtonColor}"`);
}
//tool-tip
if (elementTooltip === 'Remove Concept') {
console.log('Passed: Remove button 3 tool-tip text matched as expected');
} else {
errors.push(`Expected: Button 3 tool-tip text: "Remove Concept"; Actual: "${elementTooltip}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Primary toggle icon3 (SPECIAL CASE: use executeScript for all CSS values)
{
description: 'Verify Primary toggle icon3 is present',
action: async () => {
const element = await driver.wait(until.elementLocated(By.css('#k425604099 .switch-primary')), 5000).catch(() => false);
const errors = [];
//Get text
const elementText = await element.getText();
//Get all CSS values via executeScript
const styles = await driver.executeScript(`
const span = document.querySelector('#k425604099 .switch-primary');
if (!span) return null;
const style = window.getComputedStyle(span);
return {
fontFamily: style.getPropertyValue('font-family'),
fontSize: style.getPropertyValue('font-size'),
color: style.getPropertyValue('color'),
backgroundColor: style.getPropertyValue('background-color')
};
`);
//console.log('----->| DEBUG styles:', JSON.stringify(styles));
//Get toggle class from correct parent element
const toggleClass = await driver.executeScript(`
const span = document.querySelector('#k425604099 .switch-primary');
if (!span) return 'not found';
// Navigate up to find the switch-toggle div
let element = span.parentElement;
while (element) {
if (element.classList.contains('switch-toggle')) return element.className;
element = element.parentElement;
}
return 'switch-toggle not found in parents';
`);
//console.log('----->| DEBUG toggle class:', toggleClass);
//text
if (elementText === 'Primary') {
console.log('Passed: Enabled Primary toggle icon 3 text matched as expected');
} else {
errors.push(`Expected: Enabled Primary toggle icon 3 text: "Primary"; Actual: "${elementText}"`);
}
//font-family
if (styles.fontFamily === 'Poppins, sans-serif') {
console.log('Passed: Enabled Primary toggle icon 3 text font matched as expected');
} else {
errors.push(`Expected: Enabled Primary toggle icon 3 font "Poppins, sans-serif"; Actual: "${styles.fontFamily}"`);
}
//font-size
if (styles.fontSize === '10px') {
console.log('Passed: Enabled Primary toggle icon 3 font-size matched as expected');
} else {
errors.push(`Expected: Enabled Primary toggle icon 3 font-size "10px"; Actual: "${styles.fontSize}"`);
}
//color
if (styles.color === 'rgb(255, 255, 255)') {
console.log('Passed: Enabled Primary toggle icon 3 text color matched as expected');
} else {
errors.push(`Expected: Enabled Primary toggle icon 3 color "rgb(255, 255, 255)"; Actual: "${styles.color}"`);
}
//background color
if (styles.backgroundColor === 'rgba(0, 0, 0, 0)') {
console.log('Passed: Enabled Primary toggle icon 3 background color matched as expected');
} else {
errors.push(`Expected: Enabled Primary toggle icon 3 background color "rgba(0, 0, 0, 0)"; Actual: "${styles.backgroundColor}"`);
}
//toggle class
if (toggleClass.includes('switch-toggle')) {
console.log('Passed: Enabled Primary toggle icon 3 is a toggle switch as expected');
} else {
errors.push(`Expected: "switch-toggle" in parent; Actual: "${toggleClass}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
if (errors.length > 1) {
errors.unshift('Primary toggle icon 3 - Multiple validation checks did not pass');
}
throw new Error(errors.join('\n'));
}
}
},
//Tagged Concepts: Social Studies | General text
{
description: 'Validate Tagged Concepts Social Studies General text, size, and color',
action: async () => {
const multipleChecks = 'Tagged Concepts: Social Studies | General';
const element = await driver.findElement(By.css('#k425604100'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//text
if (elementText.includes('Social Studies | General')) {
console.log('Passed: Tagged Concepts: Social Studies | General text matched as expected');
} else {
errors.push(`Expected: "Social Studies | General"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Tagged Concepts: Social Studies | General text font matched as expected');
} else {
errors.push(`Expected: Tagged Concepts: Social Studies | General text font "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '12px') {
console.log('Passed: Tagged Concepts: Social Studies | General text font-size matched as expected');
} else {
errors.push(`Expected: Tagged Concepts: Social Studies | General text font-size "12px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(99, 99, 99, 1)') {
console.log('Passed: Tagged Concepts: Social Studies | General text color matched as expected');
} else {
errors.push(`Expected: Tagged Concepts: Social Studies | General text color: "rgba(99, 99, 99, 1)"; Actual: "${elementTextColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Remove button4
{
description: 'Validate Remove button4',
action: async () => {
const multipleChecks = 'Save Changes button4';
const elementIcon = await driver.findElement(By.css('#k425604100 .glyphicon'));
const element = await driver.findElement(By.css('#k425604100 > .btn'));
//Get text, font, color, and size
const elementText = await element.getText('');
const elementFont = await element.getCssValue('font-family');
const elementSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
const elementButtonColor = await element.getCssValue('background-color');
const elementTooltip = await element.getAttribute('title');
//Track all errors
const errors = [];
//icon
if (elementIcon) {
console.log('Passed: Remove button 4 icon is present');
} else {
errors.push('Save Remove button 4 icon was not found');
}
//text
if (elementText === 'Remove') {
console.log('Passed: Remove button 4 text matched as expected');
} else {
errors.push(`Expected: Button 4 text: "Remove"; Actual: "${elementText}"`);
}
//font-family
if (elementFont === "Poppins, sans-serif") {
console.log('Passed: Remove button 4 text font matched as expected');
} else {
errors.push(`Expected: Remove button 4 text font "Poppins, sans-serif"; Actual: ${elementFont}`);
}
//font size
if (elementSize === '12px') {
console.log('Passed: Remove button 4 text font-size matched as expected');
} else {
errors.push(`Expected: Remove button 4 text font-size "12px"; Actual: "${elementSize}"`);
}
//text color
if (elementTextColor === 'rgba(255, 255, 255, 1)') {
console.log('Passed: Remove button 4 text color matched as expected');
} else {
errors.push(`Expected: Remove button 4 text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`);
}
//button color
if (elementButtonColor === 'rgba(246, 60, 40, 1)') {
console.log('Passed: Remove button 4 background color matched as expected');
} else {
errors.push(`Expected: Remove button 4 background color: "rgba(246, 60, 40, 1)"; Actual: "${elementButtonColor}"`);
}
//tool-tip
if (elementTooltip === 'Remove Concept') {
console.log('Passed: Remove button 4 tool-tip text matched as expected');
} else {
errors.push(`Expected: Button 4 tool-tip text: "Remove Concept"; Actual: "${elementTooltip}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Primary toggle icon4
{
description: 'Verify Primary toggle icon4 is present',
action: async () => {
const element = await driver.wait(until.elementLocated(By.css('#k425604100 label')), 5000).catch(() => false);
//Get the switch-toggle div class
const toggleClass = await driver.executeScript(`
const listItem = document.querySelector('li#k425604100');
const toggle = listItem ? listItem.querySelector('div.switch-toggle') : null;
return toggle ? toggle.className : 'not found';
`);
//console.log('----->| DEBUG toggle class:', toggleClass);
//Track all errors
const errors = [];
if (element) {
console.log('Passed: Primary toggle icon 4 appeared as expected');
} else {
errors.push('Primary toggle icon 4 not found');
}
//Validate it's a toggle not a regular button
if (toggleClass.includes('switch-toggle')) {
console.log('Passed: Primary toggle icon 4 toggle switch listed as expected');
} else {
errors.push(`Expected: Primary toggle icon 4: "switch-toggle"; Actual: "${toggleClass}"`);
}
}
},
//Find Concepts header
{
description: 'Validate Find Concepts header text, size, and color',
action: async () => {
const multipleChecks = 'Find Concepts header';
const element = await driver.findElement(By.css('p'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//text
if (elementText === 'Find Concepts') {
console.log('Passed: Find Concepts header text matched as expected');
} else {
errors.push(`Expected: "Find Concepts"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Find Concepts header font matched as expected');
} else {
errors.push(`Expected: Find Concepts header font "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '13px') {
console.log('Passed: Find Concepts header text font-size matched as expected');
} else {
errors.push(`Expected: Find Concepts header text font-size "13px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(40, 39, 90, 1)') {
console.log('Passed: Find Concepts header text color matched as expected');
} else {
errors.push(`Expected: Find Concepts header text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Browse tab title (active)
{
description: 'Validate Browse tab title text, size, and color',
action: async () => {
const multipleChecks = 'Browse tab title';
const element = await driver.findElement(By.linkText('Browse'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
const elementButtonColor = await element.getCssValue('background-color');
//Track all errors
const errors = [];
//text
if (elementText === 'Browse') {
console.log('Passed: Browse tab title text matched as expected');
} else {
errors.push(`Expected: "Browse"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Browse tab title font matched as expected');
} else {
errors.push(`Expected: Browse tab title font "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '15px') {
console.log('Passed: Browse tab title text font-size matched as expected');
} else {
errors.push(`Expected: Browse tab title text font-size "15px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(255, 255, 255, 1)') {
console.log('Passed: Browse tab title text color matched as expected');
} else {
errors.push(`Expected: Browse tab title text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`);
}
//button color
if (elementButtonColor === 'rgba(40, 39, 90, 1)') {
console.log('Passed: Browse tab background color matched as expected');
} else {
errors.push(`Expected: Browse tab background color: "rgba(40, 39, 90, 1)"; Actual: "${elementButtonColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//By Standard tab tab title
{
description: 'Validate By Standard tab title text, size, and color',
action: async () => {
const multipleChecks = 'By Standard tab title';
const element = await driver.findElement(By.linkText('By Standard'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
const elementButtonColor = await element.getCssValue('background-color');
//Track all errors
const errors = [];
//text
if (elementText === 'By Standard') {
console.log('Passed: By Standard tab title text matched as expected');
} else {
errors.push(`Expected: "By Standard"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: By Standard tab title font matched as expected');
} else {
errors.push(`Expected: By Standard tab title font "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '15px') {
console.log('Passed: By Standard tab title text font-size matched as expected');
} else {
errors.push(`Expected: By Standard tab title text font-size "15px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(182, 186, 181, 1)') {
console.log('Passed: By Standard tab title text color matched as expected');
} else {
errors.push(`Expected: By Standard tab title text color: "rgba(182, 186, 181, 1)"; Actual: "${elementTextColor}"`);
}
//button color
if (elementButtonColor === 'rgba(0, 0, 0, 0)') {
console.log('Passed: By Standard tab background color matched as expected');
} else {
errors.push(`Expected: By Standard tab background color: "rgba(0, 0, 0, 0)"; Actual: "${elementButtonColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//AutoAlign tab title
{
description: 'Validate AutoAlign tab title text, size, and color',
action: async () => {
const multipleChecks = 'AutoAlign tab title';
const element = await driver.findElement(By.linkText('AutoAlign'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
const elementButtonColor = await element.getCssValue('background-color');
//Track all errors
const errors = [];
//text
if (elementText === 'AutoAlign') {
console.log('Passed: AutoAlign tab title text matched as expected');
} else {
errors.push(`Expected: "AutoAlign"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: AutoAlign tab title font matched as expected');
} else {
errors.push(`Expected: AutoAlign tab title font "DM Serif Display, serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '15px') {
console.log('Passed: AutoAlign tab title text font-size matched as expected');
} else {
errors.push(`Expected: AutoAlign tab title text font-size "15px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(182, 186, 181, 1)') {
console.log('Passed: AutoAlign tab title text color matched as expected');
} else {
errors.push(`Expected: AutoAlign tab title text color: "rgba(182, 186, 181, 1)"; Actual: "${elementTextColor}"`);
}
//button color
if (elementButtonColor === 'rgba(0, 0, 0, 0)') {
console.log('Passed: AutoAlign tab background color matched as expected');
} else {
errors.push(`Expected: AutoAlign tab background color: "rgba(0, 0, 0, 0)"; Actual: "${elementButtonColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Browse concepts header
{
description: 'Validate Browse Concepts header text, size, and color',
action: async () => {
const multipleChecks = 'Find Concepts header';
const element = await driver.findElement(By.css('.mt-2 > h5'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//text
if (elementText === 'Browse the concept list and filter by term') {
console.log('Passed: Browse Concepts header text matched as expected');
} else {
errors.push(`Expected: "Browse the concept list and filter by term"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Browse Concepts header font matched as expected');
} else {
errors.push(`Expected: Browse Concepts header font "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '20px') {
console.log('Passed: Browse Concepts header text font-size matched as expected');
} else {
errors.push(`Expected: Browse Concepts header text font-size "20px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(40, 39, 90, 1)') {
console.log('Passed: Browse Concepts header text color matched as expected');
} else {
errors.push(`Expected: Browse Concepts header text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Filter concepts label
{
description: 'Validate Filter Concepts label text, size, and color',
action: async () => {
const multipleChecks = 'Find Concepts header';
const element = await driver.findElement(By.css('.mr-1'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//text
if (elementText === 'Filter Concepts') {
console.log('Passed: Filter Concepts header text matched as expected');
} else {
errors.push(`Expected: "Filter Concepts"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Filter Concepts label font matched as expected');
} else {
errors.push(`Expected: Filter Concepts label font "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '13px') {
console.log('Passed: Filter Concepts label text font-size matched as expected');
} else {
errors.push(`Expected: Filter Concepts label text font-size "13px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(40, 39, 90, 1)') {
console.log('Passed: Filter Concepts label text color matched as expected');
} else {
errors.push(`Expected: Filter Concepts label text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Filter Concepts textbox placeholder
{
description: 'Validate Filter Concepts placeholder text',
action: async () => {
const multipleChecks = 'Filter Concepts textbox placeholder';
const element = await driver.findElement(By.css('#q'));
//Get text, font, size, and color
const elementText = await element.getAttribute('placeholder');
//Get placeholder styles via executeScript since it's a pseudo-element
const elementFont = await driver.executeScript(
`return window.getComputedStyle(arguments[0], '::placeholder').getPropertyValue('font-family')`,
element
);
const elementSize = await driver.executeScript(
`return window.getComputedStyle(arguments[0], '::placeholder').getPropertyValue('font-size')`,
element
);
const elementColor = await driver.executeScript(
`return window.getComputedStyle(arguments[0], '::placeholder').getPropertyValue('color')`,
element
);
//Track all errors
const errors = [];
//text
if (elementText === 'Enter Term...') {
console.log('Passed: Filter Concepts placeholder text matched as expected');
} else {
errors.push(`Expected: "Enter Term..." placeholder; Actual: "${elementText}"`);
}
//font-family
if (elementFont === "Poppins, sans-serif") {
console.log('Passed: Filter Concepts placeholder text font matched as expected');
} else {
errors.push(`Expected: Filter Concepts placeholder text font "Poppins, sans-serif"; Actual: ${elementFont}`);
}
//font size
if (elementSize === '14.4px') {
console.log('Passed: Filter Concepts placeholder text font-size matched as expected');
} else {
errors.push(`Expected: Filter Concepts placeholder text font-size "14.4px"; Actual: "${elementSize}"`);
}
//color
if (elementColor === 'rgb(108, 117, 125)') {
console.log('Passed: Filter Concepts placeholder text color matched as expected');
} else {
errors.push(`Expected: Filter Concepts placeholder text color: "rgb(108, 117, 125)"; Actual: "${elementColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Filter button
{
description: 'Validate Filter button',
action: async () => {
const multipleChecks = 'Filter button';
const element = await driver.findElement(By.css('#qbutton'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
const elementButtonColor = await element.getCssValue('background-color');
//Track all errors
const errors = [];
//text
if (elementText === 'Filter') {
console.log('Passed: Filter button text matched as expected');
} else {
errors.push(`Expected: "Filter"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Filter button font matched as expected');
} else {
errors.push(`Expected: Filter button font "DM Serif Display, serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '16px') {
console.log('Passed: Filter button text font-size matched as expected');
} else {
errors.push(`Expected: Filter button text font-size "16px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(255, 255, 255, 1)') {
console.log('Passed: Filter button text color matched as expected');
} else {
errors.push(`Expected: Filter button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`);
}
//button color
if (elementButtonColor === 'rgba(48, 200, 172, 1)') {
console.log('Passed: Filter button background color matched as expected');
} else {
errors.push(`Expected: Filter button background color: "rgba(48, 200, 172, 1)"; Actual: "${elementButtonColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Health and PE
{
description: 'Validate Health and PE handle text, size, and color',
action: async () => {
const multipleChecks = 'Health and PE handle';
const element = await driver.findElement(By.css('.list-group-item:nth-child(1) > div:nth-child(3)'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//text
if (elementText === 'Health and PE') {
console.log('Passed: Health and PE handle text matched as expected');
} else {
errors.push(`Expected: "Health and PE"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Health and PE handle font matched as expected');
} else {
errors.push(`Expected: Health and PE handle font "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '14.3px') {
console.log('Passed: Health and PE handle text font-size matched as expected');
} else {
errors.push(`Expected: Health and PE handle text font-size "14.3px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(40, 39, 90, 1)') {
console.log('Passed: Health and PE handle text color matched as expected');
} else {
errors.push(`Expected: Health and PE handle text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Health and PE count button and icon
{
description: 'Validate Health and PE count button and icon',
action: async () => {
const multipleChecks = 'Health and PE count button and icon';
const element = await driver.findElement(By.css('.list-group-item:nth-child(1) > .badge'));
const elementIcon = await driver.findElement(By.css('.list-group-item:nth-child(1) > .fa'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
const elementButtonColor = await element.getCssValue('background-color');
const elementTooltip = await element.getAttribute('title');
const elementIconColor = await elementIcon.getCssValue('color');
//Track all errors
const errors = [];
//text
if (elementText === '1267') {
console.log('Passed: Health and PE count button text matched as expected');
} else {
errors.push(`Expected: "1267"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Health and PE count button font matched as expected');
} else {
errors.push(`Expected: Health and PE count button font "DM Serif Display, serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '12.87px') {
console.log('Passed: Health and PE count button text font-size matched as expected');
} else {
errors.push(`Expected: Health and PE count button text font-size "12.87px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(255, 255, 255, 1)') {
console.log('Passed: Health and PE count button text color matched as expected');
} else {
errors.push(`Expected: Health and PE count button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`);
}
//button color
if (elementButtonColor === 'rgba(40, 39, 90, 1)') {
console.log('Passed: Health and PE countr button background color matched as expected');
} else {
errors.push(`Expected: Health and PE count button background color: "rgba(40, 39, 90, 1)"; Actual: "${elementButtonColor}"`);
}
//icon color
if (elementIconColor === 'rgba(40, 39, 90, 1)') {
console.log('Passed: Health and PE count button text color matched as expected');
} else {
errors.push(`Expected: Health and PE count button text color: "rgba(40, 39, 90, 1)"; Actual: "${elementIconColor}"`);
}
//icon tool-tip
if (elementTooltip === '1267 sub-concepts') {
console.log('Passed: Health and PE count button tool-tip text matched as expected');
} else {
errors.push(`Expected: Health and PE count button tool-tip: "1267 sub-concepts"; Actual: "${elementTooltip}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Language Arts
{
description: 'Validate Language Arts handle text, size, and color',
action: async () => {
const multipleChecks = 'Language Arts handle';
const element = await driver.findElement(By.css('.list-group-item:nth-child(2) > div:nth-child(3)'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//text
if (elementText === 'Language Arts') {
console.log('Passed: Language Arts handle text matched as expected');
} else {
errors.push(`Expected: "Language Arts"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Language Arts handle font matched as expected');
} else {
errors.push(`Expected: Language Arts handle font "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '14.3px') {
console.log('Passed: Language Arts handle text font-size matched as expected');
} else {
errors.push(`Expected: Language Arts handle text font-size "14.3px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(40, 39, 90, 1)') {
console.log('Passed: Language Arts handle text color matched as expected');
} else {
errors.push(`Expected: Language Arts handle text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Language Arts count button and icon
{
description: 'Validate Language Arts count button and icon',
action: async () => {
const multipleChecks = 'Language Arts count button and icon';
const element = await driver.findElement(By.css('.list-group-item:nth-child(2) > .badge'));
const elementIcon = await driver.findElement(By.css('.list-group-item:nth-child(2) > .fa'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
const elementButtonColor = await element.getCssValue('background-color');
const elementTooltip = await element.getAttribute('title');
const elementIconColor = await elementIcon.getCssValue('color');
//Track all errors
const errors = [];
//text
if (elementText === '2046') {
console.log('Passed: Language Arts count button text matched as expected');
} else {
errors.push(`Expected: "2046"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Language Arts count button font matched as expected');
} else {
errors.push(`Expected: Language Arts count button font "DM Serif Display, serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '12.87px') {
console.log('Passed: Language Arts count button text font-size matched as expected');
} else {
errors.push(`Expected: Language Arts count button text font-size "12.87px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(255, 255, 255, 1)') {
console.log('Passed: Language Arts count button text color matched as expected');
} else {
errors.push(`Expected: Language Arts count button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`);
}
//button color
if (elementButtonColor === 'rgba(40, 39, 90, 1)') {
console.log('Passed: Language Arts countr button background color matched as expected');
} else {
errors.push(`Expected: Language Arts count button background color: "rgba(40, 39, 90, 1)"; Actual: "${elementButtonColor}"`);
}
//icon color
if (elementIconColor === 'rgba(40, 39, 90, 1)') {
console.log('Passed: Language Arts count button text color matched as expected');
} else {
errors.push(`Expected: Language Arts count button text color: "rgba(40, 39, 90, 1)"; Actual: "${elementIconColor}"`);
}
//icon tool-tip
if (elementTooltip === '2046 sub-concepts') {
console.log('Passed: Language Arts count button tool-tip text matched as expected');
} else {
errors.push(`Expected: Language Arts count button tool-tip: "2046 sub-concepts"; Actual: "${elementTooltip}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Mathematics
{
description: 'Validate Mathematics handle text, size, and color',
action: async () => {
const multipleChecks = 'Mathematics handle';
const element = await driver.findElement(By.css('.list-group-item:nth-child(3) > div:nth-child(3)'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//text
if (elementText === 'Mathematics') {
console.log('Passed: Mathematics handle text matched as expected');
} else {
errors.push(`Expected: "Mathematics"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Mathematics handle font matched as expected');
} else {
errors.push(`Expected: Mathematics handle font "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '14.3px') {
console.log('Passed: Mathematics handle text font-size matched as expected');
} else {
errors.push(`Expected: Mathematics handle text font-size "14.3px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(40, 39, 90, 1)') {
console.log('Passed: Mathematics handle text color matched as expected');
} else {
errors.push(`Expected: Mathematics handle text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Mathematics count button and icon
{
description: 'Validate Mathematics count button and icon',
action: async () => {
const multipleChecks = 'Mathematics count button and icon';
const element = await driver.findElement(By.css('.list-group-item:nth-child(3) > .badge'));
const elementIcon = await driver.findElement(By.css('.list-group-item:nth-child(3) > .fa'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
const elementButtonColor = await element.getCssValue('background-color');
const elementTooltip = await element.getAttribute('title');
const elementIconColor = await elementIcon.getCssValue('color');
//Track all errors
const errors = [];
//text
if (elementText === '1760') {
console.log('Passed: Mathematics count button text matched as expected');
} else {
errors.push(`Expected: "1760"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Mathematics count button font matched as expected');
} else {
errors.push(`Expected: Mathematics count button font "DM Serif Display, serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '12.87px') {
console.log('Passed: Mathematics count button text font-size matched as expected');
} else {
errors.push(`Expected: Mathematics count button text font-size "12.87px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(255, 255, 255, 1)') {
console.log('Passed: Mathematics count button text color matched as expected');
} else {
errors.push(`Expected: Mathematics count button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`);
}
//button color
if (elementButtonColor === 'rgba(40, 39, 90, 1)') {
console.log('Passed: Mathematics countr button background color matched as expected');
} else {
errors.push(`Expected: Mathematics count button background color: "rgba(40, 39, 90, 1)"; Actual: "${elementButtonColor}"`);
}
//icon color
if (elementIconColor === 'rgba(40, 39, 90, 1)') {
console.log('Passed: Mathematics count button text color matched as expected');
} else {
errors.push(`Expected: Mathematics count button text color: "rgba(40, 39, 90, 1)"; Actual: "${elementIconColor}"`);
}
//icon tool-tip
if (elementTooltip === '1760 sub-concepts') {
console.log('Passed: Mathematics count button tool-tip text matched as expected');
} else {
errors.push(`Expected: Mathematics count button tool-tip: "1760 sub-concepts"; Actual: "${elementTooltip}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Science
{
description: 'Validate Science handle text, size, and color',
action: async () => {
const multipleChecks = 'Science handle';
const element = await driver.findElement(By.css('.list-group-item:nth-child(4) > div:nth-child(3)'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//text
if (elementText === 'Science') {
console.log('Passed: Science handle text matched as expected');
} else {
errors.push(`Expected: "Science"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Science handle font matched as expected');
} else {
errors.push(`Expected: Science handle font "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '14.3px') {
console.log('Passed: Science handle text font-size matched as expected');
} else {
errors.push(`Expected: Science handle text font-size "14.3px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(40, 39, 90, 1)') {
console.log('Passed: Science handle text color matched as expected');
} else {
errors.push(`Expected: Science handle text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Science count button and icon
{
description: 'Validate Science count button and icon',
action: async () => {
const multipleChecks = 'Science count button and icon';
const element = await driver.findElement(By.css('.list-group-item:nth-child(4) > .badge'));
const elementIcon = await driver.findElement(By.css('.list-group-item:nth-child(4) > .fa'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
const elementButtonColor = await element.getCssValue('background-color');
const elementTooltip = await element.getAttribute('title');
const elementIconColor = await elementIcon.getCssValue('color');
//Track all errors
const errors = [];
//text
if (elementText === '3156') {
console.log('Passed: Science count button text matched as expected');
} else {
errors.push(`Expected: "3156"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Science count button font matched as expected');
} else {
errors.push(`Expected: Science count button font "DM Serif Display, serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '12.87px') {
console.log('Passed: Science count button text font-size matched as expected');
} else {
errors.push(`Expected: Science count button text font-size "12.87px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(255, 255, 255, 1)') {
console.log('Passed: Science count button text color matched as expected');
} else {
errors.push(`Expected: Science count button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`);
}
//button color
if (elementButtonColor === 'rgba(40, 39, 90, 1)') {
console.log('Passed: Science countr button background color matched as expected');
} else {
errors.push(`Expected: Science count button background color: "rgba(40, 39, 90, 1)"; Actual: "${elementButtonColor}"`);
}
//icon color
if (elementIconColor === 'rgba(40, 39, 90, 1)') {
console.log('Passed: Science count button text color matched as expected');
} else {
errors.push(`Expected: Science count button text color: "rgba(40, 39, 90, 1)"; Actual: "${elementIconColor}"`);
}
//icon tool-tip
if (elementTooltip === '3156 sub-concepts') {
console.log('Passed: Science count button tool-tip text matched as expected');
} else {
errors.push(`Expected: Science count button tool-tip: "3156 sub-concepts"; Actual: "${elementTooltip}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Social Studies
{
description: 'Validate Social Studies handle text, size, and color',
action: async () => {
const multipleChecks = 'Social Studies handle';
const element = await driver.findElement(By.css('.list-group-item:nth-child(5) > div:nth-child(3)'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//text
if (elementText === 'Social Studies') {
console.log('Passed: Social Studies handle text matched as expected');
} else {
errors.push(`Expected: "Social Studies"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Social Studies handle font matched as expected');
} else {
errors.push(`Expected: Social Studies handle font "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '14.3px') {
console.log('Passed: Social Studies handle text font-size matched as expected');
} else {
errors.push(`Expected: Social Studies handle text font-size "14.3px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(40, 39, 90, 1)') {
console.log('Passed: Social Studies handle text color matched as expected');
} else {
errors.push(`Expected: Social Studies handle text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Social Studies count button and icon
{
description: 'Validate Social Studies count button and icon',
action: async () => {
const multipleChecks = 'Social Studies count button and icon';
const element = await driver.findElement(By.css('.list-group-item:nth-child(5) > .badge'));
const elementIcon = await driver.findElement(By.css('.list-group-item:nth-child(5) > .fa'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
const elementButtonColor = await element.getCssValue('background-color');
const elementTooltip = await element.getAttribute('title');
const elementIconColor = await elementIcon.getCssValue('color');
//Track all errors
const errors = [];
//text
if (elementText === '4474') {
console.log('Passed: Social Studies count button text matched as expected');
} else {
errors.push(`Expected: "4474"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Social Studies count button font matched as expected');
} else {
errors.push(`Expected: Social Studies count button font "DM Serif Display, serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '12.87px') {
console.log('Passed: Social Studies count button text font-size matched as expected');
} else {
errors.push(`Expected: Social Studies count button text font-size "12.87px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(255, 255, 255, 1)') {
console.log('Passed: Social Studies count button text color matched as expected');
} else {
errors.push(`Expected: Social Studies count button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`);
}
//button color
if (elementButtonColor === 'rgba(40, 39, 90, 1)') {
console.log('Passed: Social Studies countr button background color matched as expected');
} else {
errors.push(`Expected: Social Studies count button background color: "rgba(40, 39, 90, 1)"; Actual: "${elementButtonColor}"`);
}
//icon color
if (elementIconColor === 'rgba(40, 39, 90, 1)') {
console.log('Passed: Social Studies count button text color matched as expected');
} else {
errors.push(`Expected: Social Studies count button text color: "rgba(40, 39, 90, 1)"; Actual: "${elementIconColor}"`);
}
//icon tool-tip
if (elementTooltip === '4474 sub-concepts') {
console.log('Passed: Social Studies count button tool-tip text matched as expected');
} else {
errors.push(`Expected: Social Studies count button tool-tip: "4474 sub-concepts"; Actual: "${elementTooltip}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Technology Education
{
description: 'Validate Technology Education handle text, size, and color',
action: async () => {
const multipleChecks = 'Technology Education handle';
const element = await driver.findElement(By.css('.list-group-item:nth-child(6) > div:nth-child(3)'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//text
if (elementText === 'Technology Education') {
console.log('Passed: Technology Education handle text matched as expected');
} else {
errors.push(`Expected: "Technology Education"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Technology Education handle font matched as expected');
} else {
errors.push(`Expected: Technology Education handle font "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '14.3px') {
console.log('Passed: Technology Education handle text font-size matched as expected');
} else {
errors.push(`Expected: Technology Education handle text font-size "14.3px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(40, 39, 90, 1)') {
console.log('Passed: Technology Education handle text color matched as expected');
} else {
errors.push(`Expected: Technology Education handle text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Technology Education count button and icon
{
description: 'Validate Technology Education count button and icon',
action: async () => {
const multipleChecks = 'Technology Education count button and icon';
const element = await driver.findElement(By.css('.list-group-item:nth-child(6) > .badge'));
const elementIcon = await driver.findElement(By.css('.list-group-item:nth-child(6) > .fa'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
const elementButtonColor = await element.getCssValue('background-color');
const elementTooltip = await element.getAttribute('title');
const elementIconColor = await elementIcon.getCssValue('color');
//Track all errors
const errors = [];
//text
if (elementText === '1211') {
console.log('Passed: Technology Education count button text matched as expected');
} else {
errors.push(`Expected: "1211"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Technology Education count button font matched as expected');
} else {
errors.push(`Expected: Technology Education count button font "DM Serif Display, serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '12.87px') {
console.log('Passed: Technology Education count button text font-size matched as expected');
} else {
errors.push(`Expected: Technology Education count button text font-size "12.87px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(255, 255, 255, 1)') {
console.log('Passed: Technology Education count button text color matched as expected');
} else {
errors.push(`Expected: Technology Education count button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`);
}
//button color
if (elementButtonColor === 'rgba(40, 39, 90, 1)') {
console.log('Passed: Technology Education countr button background color matched as expected');
} else {
errors.push(`Expected: Technology Education count button background color: "rgba(40, 39, 90, 1)"; Actual: "${elementButtonColor}"`);
}
//icon color
if (elementIconColor === 'rgba(40, 39, 90, 1)') {
console.log('Passed: Technology Education count button text color matched as expected');
} else {
errors.push(`Expected: Technology Education count button text color: "rgba(40, 39, 90, 1)"; Actual: "${elementIconColor}"`);
}
//icon tool-tip
if (elementTooltip === '1211 sub-concepts') {
console.log('Passed: Technology Education count button tool-tip text matched as expected');
} else {
errors.push(`Expected: Technology Education count button tool-tip: "1211 sub-concepts"; Actual: "${elementTooltip}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//NEXT ACTION
{
description: 'Click By Standard tab link',
action: async () => {
await driver.findElement(By.linkText('By Standard')).click();
console.log('----->| NEXT ACTION: Clicked By Standard tab link');
//Wait for page to load completely
await driver.wait(async () => {
const readyState = await driver.executeScript('return document.readyState');
return readyState === 'complete';
}, 30000, 'Page did not fully load within 30 seconds');
//Wait until the element exists in the DOM
const sectionHeader = await driver.wait(
until.elementLocated(By.css('#concept-standard > label')),
30000
);
//Wait until it becomes visible
await driver.wait(
until.elementIsVisible(sectionHeader),
30000
);
//Wait for page to load completely
await driver.wait(async () => {
const readyState = await driver.executeScript('return document.readyState');
return readyState === 'complete';
}, 30000, 'By Standards page did not fully load within 30 seconds');
console.log('Passed: By Standards page loaded successfully');
}
},
//Browse tab title
{
description: 'Validate Browse tab title text, size, and color',
action: async () => {
const multipleChecks = 'Browse tab title';
const element = await driver.findElement(By.linkText('Browse'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
const elementButtonColor = await element.getCssValue('background-color');
//Track all errors
const errors = [];
//text
if (elementText === 'Browse') {
console.log('Passed: Browse tab title text matched as expected');
} else {
errors.push(`Expected: "Browse"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Browse tab title font matched as expected');
} else {
errors.push(`Expected: Browse tab title font "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '15px') {
console.log('Passed: Browse tab title text font-size matched as expected');
} else {
errors.push(`Expected: Browse tab title text font-size "15px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(182, 186, 181, 1)') {
console.log('Passed: Browse tab title text color matched as expected');
} else {
errors.push(`Expected: Browse tab title text color: "rgba(182, 186, 181, 1)"; Actual: "${elementTextColor}"`);
}
//button color
if (elementButtonColor === 'rgba(0, 0, 0, 0)') {
console.log('Passed: Browse tab background color matched as expected');
} else {
errors.push(`Expected: Browse tab background color: "rgba(0, 0, 0, 0)"; Actual: "${elementButtonColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//By Standard tab tab title (active)
{
description: 'Validate By Standard tab title text, size, and color',
action: async () => {
const multipleChecks = 'By Standard tab title';
const element = await driver.findElement(By.linkText('By Standard'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
const elementButtonColor = await element.getCssValue('background-color');
//Track all errors
const errors = [];
//text
if (elementText === 'By Standard') {
console.log('Passed: By Standard tab title text matched as expected');
} else {
errors.push(`Expected: "By Standard"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: By Standard tab title font matched as expected');
} else {
errors.push(`Expected: By Standard tab title font "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '15px') {
console.log('Passed: By Standard tab title text font-size matched as expected');
} else {
errors.push(`Expected: By Standard tab title text font-size "15px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(255, 255, 255, 1)') {
console.log('Passed: By Standard tab title text color matched as expected');
} else {
errors.push(`Expected: By Standard tab title text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`);
}
//button color
if (elementButtonColor === 'rgba(40, 39, 90, 1)') {
console.log('Passed: By Standard tab background color matched as expected');
} else {
errors.push(`Expected: By Standard tab background color: "rgba(40, 39, 90, 1)"; Actual: "${elementButtonColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//AutoAlign tab title
{
description: 'Validate AutoAlign tab title text, size, and color',
action: async () => {
const multipleChecks = 'AutoAlign tab title';
const element = await driver.findElement(By.linkText('AutoAlign'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
const elementButtonColor = await element.getCssValue('background-color');
//Track all errors
const errors = [];
//text
if (elementText === 'AutoAlign') {
console.log('Passed: AutoAlign tab title text matched as expected');
} else {
errors.push(`Expected: "AutoAlign"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: AutoAlign tab title font matched as expected');
} else {
errors.push(`Expected: AutoAlign tab title font "DM Serif Display, serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '15px') {
console.log('Passed: AutoAlign tab title text font-size matched as expected');
} else {
errors.push(`Expected: AutoAlign tab title text font-size "15px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(182, 186, 181, 1)') {
console.log('Passed: AutoAlign tab title text color matched as expected');
} else {
errors.push(`Expected: AutoAlign tab title text color: "rgba(182, 186, 181, 1)"; Actual: "${elementTextColor}"`);
}
//button color
if (elementButtonColor === 'rgba(0, 0, 0, 0)') {
console.log('Passed: AutoAlign tab background color matched as expected');
} else {
errors.push(`Expected: AutoAlign tab background color: "rgba(0, 0, 0, 0)"; Actual: "${elementButtonColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Tagged Concepts: header
{
description: 'Validate Tagged Concepts header text, size, and color',
action: async () => {
const multipleChecks = 'Tagged Concepts: header';
const element = await driver.findElement(By.css('.ui-widget-heading'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//text
if (elementText === 'Tagged Concepts:') {
console.log('Passed: Tagged Concepts: header text matched as expected');
} else {
errors.push(`Expected: "Tagged Concepts:"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Tagged Concepts: header font matched as expected');
} else {
errors.push(`Expected: Tagged Concepts: header font "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '16px') {
console.log('Passed: Tagged Concepts: header text font-size matched as expected');
} else {
errors.push(`Expected: Tagged Concepts: header text font-size "16px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(40, 39, 90, 1)') {
console.log('Passed: Tagged Concepts: header text color matched as expected');
} else {
errors.push(`Expected: Tagged Concepts: header text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Tagged Concepts: Language Arts | General text
{
description: 'Validate Tagged Concepts Language Arts General text, size, and color',
action: async () => {
const multipleChecks = 'Tagged Concepts: Language Arts | General';
const element = await driver.findElement(By.css('#k425604097'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//text
if (elementText.includes('Language Arts | General')) {
console.log('Passed: Tagged Concepts: Language Arts | General text matched as expected');
} else {
errors.push(`Expected: "Language Arts | General"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Tagged Concepts: Language Arts | General text font matched as expected');
} else {
errors.push(`Expected: Tagged Concepts: Language Arts | General text font "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '12px') {
console.log('Passed: Tagged Concepts: Language Arts | General text font-size matched as expected');
} else {
errors.push(`Expected: Tagged Concepts: Language Arts | General text font-size "12px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(99, 99, 99, 1)') {
console.log('Passed: Tagged Concepts: Language Arts | General text color matched as expected');
} else {
errors.push(`Expected: Tagged Concepts: Language Arts | General text color: "rgba(99, 99, 99, 1)"; Actual: "${elementTextColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Remove button1
{
description: 'Validate Remove button1',
action: async () => {
const multipleChecks = 'Save Changes button1';
const elementIcon = await driver.findElement(By.css('#k425604097 .glyphicon'));
const element = await driver.findElement(By.css('#k425604097 > .btn'));
//Get text, font, color, and size
const elementText = await element.getText('');
const elementFont = await element.getCssValue('font-family');
const elementSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
const elementButtonColor = await element.getCssValue('background-color');
const elementTooltip = await element.getAttribute('title');
//Track all errors
const errors = [];
//icon
if (elementIcon) {
console.log('Passed: Remove button 1 icon is present');
} else {
errors.push('Save Remove button 1 icon was not found');
}
//text
if (elementText === 'Remove') {
console.log('Passed: Remove button 1 text matched as expected');
} else {
errors.push(`Expected: Button 1 text: "Remove"; Actual: "${elementText}"`);
}
//font-family
if (elementFont === "Poppins, sans-serif") {
console.log('Passed: Remove button 1 text font matched as expected');
} else {
errors.push(`Expected: Remove button 1 text font "Poppins, sans-serif"; Actual: ${elementFont}`);
}
//font size
if (elementSize === '12px') {
console.log('Passed: Remove button 1 text font-size matched as expected');
} else {
errors.push(`Expected: Remove button 1 text font-size "12px"; Actual: "${elementSize}"`);
}
//text color
if (elementTextColor === 'rgba(255, 255, 255, 1)') {
console.log('Passed: Remove button 1 text color matched as expected');
} else {
errors.push(`Expected: Remove button 1 text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`);
}
//button color
if (elementButtonColor === 'rgba(246, 60, 40, 1)') {
console.log('Passed: Remove button 1 background color matched as expected');
} else {
errors.push(`Expected: Remove button 1 background color: "rgba(246, 60, 40, 1)"; Actual: "${elementButtonColor}"`);
}
//tool-tip
if (elementTooltip === 'Remove Concept') {
console.log('Passed: Remove button 1 tool-tip text matched as expected');
} else {
errors.push(`Expected: Button 1 tool-tip text: "Remove Concept"; Actual: "${elementTooltip}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Primary toggle icon1
{
description: 'Verify Primary toggle icon1 is present',
action: async () => {
const element = await driver.wait(until.elementLocated(By.css('#k425604097 label')), 5000).catch(() => false);
//Get the switch-toggle div class
const toggleClass = await driver.executeScript(`
const listItem = document.querySelector('li#k425604097');
const toggle = listItem ? listItem.querySelector('div.switch-toggle') : null;
return toggle ? toggle.className : 'not found';
`);
//console.log('----->| DEBUG toggle class:', toggleClass);
//Track all errors
const errors = [];
if (element) {
console.log('Passed: Primary toggle icon 1 appeared as expected');
} else {
errors.push('Primary toggle icon 1 not found');
}
//Validate it's a toggle not a regular button
if (toggleClass.includes('switch-toggle')) {
console.log('Passed: Primary toggle icon 1 toggle switch listed as expected');
} else {
errors.push(`Expected: Primary toggle icon 1: "switch-toggle"; Actual: "${toggleClass}"`);
}
}
},
//Tagged Concepts: Mathematics | General text
{
description: 'Validate Tagged Concepts Mathematics General text, size, and color',
action: async () => {
const multipleChecks = 'Tagged Concepts: Mathematics | General';
const element = await driver.findElement(By.css('#k425604098'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//text
if (elementText.includes('Mathematics | General')) {
console.log('Passed: Tagged Concepts: Mathematics | General text matched as expected');
} else {
errors.push(`Expected: "Mathematics | General"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Tagged Concepts: Mathematics | General text font matched as expected');
} else {
errors.push(`Expected: Tagged Concepts: Mathematics | General text font "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '12px') {
console.log('Passed: Tagged Concepts: Mathematics | General text font-size matched as expected');
} else {
errors.push(`Expected: Tagged Concepts: Mathematics | General text font-size "12px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(99, 99, 99, 1)') {
console.log('Passed: Tagged Concepts: Mathematics | General text color matched as expected');
} else {
errors.push(`Expected: Tagged Concepts: Mathematics | General text color: "rgba(99, 99, 99, 1)"; Actual: "${elementTextColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Remove button2
{
description: 'Validate Remove button2',
action: async () => {
const multipleChecks = 'Save Changes button2';
const elementIcon = await driver.findElement(By.css('#k425604098 .glyphicon'));
const element = await driver.findElement(By.css('#k425604098 > .btn'));
//Get text, font, color, and size
const elementText = await element.getText('');
const elementFont = await element.getCssValue('font-family');
const elementSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
const elementButtonColor = await element.getCssValue('background-color');
const elementTooltip = await element.getAttribute('title');
//Track all errors
const errors = [];
//icon
if (elementIcon) {
console.log('Passed: Remove button 2 icon is present');
} else {
errors.push('Save Remove button 2 icon was not found');
}
//text
if (elementText === 'Remove') {
console.log('Passed: Remove button 2 text matched as expected');
} else {
errors.push(`Expected: Button 2 text: "Remove"; Actual: "${elementText}"`);
}
//font-family
if (elementFont === "Poppins, sans-serif") {
console.log('Passed: Remove button 2 text font matched as expected');
} else {
errors.push(`Expected: Remove button 2 text font "Poppins, sans-serif"; Actual: ${elementFont}`);
}
//font size
if (elementSize === '12px') {
console.log('Passed: Remove button 2 text font-size matched as expected');
} else {
errors.push(`Expected: Remove button 2 text font-size "12px"; Actual: "${elementSize}"`);
}
//text color
if (elementTextColor === 'rgba(255, 255, 255, 1)') {
console.log('Passed: Remove button 2 text color matched as expected');
} else {
errors.push(`Expected: Remove button 2 text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`);
}
//button color
if (elementButtonColor === 'rgba(246, 60, 40, 1)') {
console.log('Passed: Remove button 2 background color matched as expected');
} else {
errors.push(`Expected: Remove button 2 background color: "rgba(246, 60, 40, 1)"; Actual: "${elementButtonColor}"`);
}
//tool-tip
if (elementTooltip === 'Remove Concept') {
console.log('Passed: Remove button 2 tool-tip text matched as expected');
} else {
errors.push(`Expected: Button 2 tool-tip text: "Remove Concept"; Actual: "${elementTooltip}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Primary toggle icon2
{
description: 'Verify Primary toggle icon2 is present',
action: async () => {
const element = await driver.wait(until.elementLocated(By.css('#k425604098 label')), 5000).catch(() => false);
//Get the switch-toggle div class
const toggleClass = await driver.executeScript(`
const listItem = document.querySelector('li#k425604098');
const toggle = listItem ? listItem.querySelector('div.switch-toggle') : null;
return toggle ? toggle.className : 'not found';
`);
//console.log('----->| DEBUG toggle class:', toggleClass);
//Track all errors
const errors = [];
if (element) {
console.log('Passed: Primary toggle icon 2 appeared as expected');
} else {
errors.push('Primary toggle icon 2 not found');
}
//Validate it's a toggle not a regular button
if (toggleClass.includes('switch-toggle')) {
console.log('Passed: Primary toggle icon 2 toggle switch listed as expected');
} else {
errors.push(`Expected: Primary toggle icon 2: "switch-toggle"; Actual: "${toggleClass}"`);
}
}
},
//Tagged Concepts: Science | General text
{
description: 'Validate Tagged Concepts Science General text, size, and color',
action: async () => {
const multipleChecks = 'Tagged Concepts: Science | General';
const element = await driver.findElement(By.css('#k425604099'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//text
if (elementText.includes('Science | General')) {
console.log('Passed: Tagged Concepts: Science | General text matched as expected');
} else {
errors.push(`Expected: "Science | General"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Tagged Concepts: Science | General text font matched as expected');
} else {
errors.push(`Expected: Tagged Concepts: Science | General text font "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '12px') {
console.log('Passed: Tagged Concepts: Science | General text font-size matched as expected');
} else {
errors.push(`Expected: Tagged Concepts: Science | General text font-size "12px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(99, 99, 99, 1)') {
console.log('Passed: Tagged Concepts: Science | General text color matched as expected');
} else {
errors.push(`Expected: Tagged Concepts: Science | General text color: "rgba(99, 99, 99, 1)"; Actual: "${elementTextColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Remove button3
{
description: 'Validate Remove button3',
action: async () => {
const multipleChecks = 'Save Changes button3';
const elementIcon = await driver.findElement(By.css('#k425604099 .glyphicon'));
const element = await driver.findElement(By.css('#k425604099 > .btn'));
//Get text, font, color, and size
const elementText = await element.getText('');
const elementFont = await element.getCssValue('font-family');
const elementSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
const elementButtonColor = await element.getCssValue('background-color');
const elementTooltip = await element.getAttribute('title');
//Track all errors
const errors = [];
//icon
if (elementIcon) {
console.log('Passed: Remove button 3 icon is present');
} else {
errors.push('Save Remove button 3 icon was not found');
}
//text
if (elementText === 'Remove') {
console.log('Passed: Remove button 3 text matched as expected');
} else {
errors.push(`Expected: Button 3 text: "Remove"; Actual: "${elementText}"`);
}
//font-family
if (elementFont === "Poppins, sans-serif") {
console.log('Passed: Remove button 3 text font matched as expected');
} else {
errors.push(`Expected: Remove button 3 text font "Poppins, sans-serif"; Actual: ${elementFont}`);
}
//font size
if (elementSize === '12px') {
console.log('Passed: Remove button 3 text font-size matched as expected');
} else {
errors.push(`Expected: Remove button 3 text font-size "12px"; Actual: "${elementSize}"`);
}
//text color
if (elementTextColor === 'rgba(255, 255, 255, 1)') {
console.log('Passed: Remove button 3 text color matched as expected');
} else {
errors.push(`Expected: Remove button 3 text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`);
}
//button color
if (elementButtonColor === 'rgba(246, 60, 40, 1)') {
console.log('Passed: Remove button 3 background color matched as expected');
} else {
errors.push(`Expected: Remove button 3 background color: "rgba(246, 60, 40, 1)"; Actual: "${elementButtonColor}"`);
}
//tool-tip
if (elementTooltip === 'Remove Concept') {
console.log('Passed: Remove button 3 tool-tip text matched as expected');
} else {
errors.push(`Expected: Button 3 tool-tip text: "Remove Concept"; Actual: "${elementTooltip}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Primary toggle icon3 (SPECIAL CASE: use executeScript for all CSS values)
{
description: 'Verify Primary toggle icon3 is present',
action: async () => {
const element = await driver.wait(until.elementLocated(By.css('#k425604099 .switch-primary')), 5000).catch(() => false);
const errors = [];
//Get text
const elementText = await element.getText();
//Get all CSS values via executeScript
const styles = await driver.executeScript(`
const span = document.querySelector('#k425604099 .switch-primary');
if (!span) return null;
const style = window.getComputedStyle(span);
return {
fontFamily: style.getPropertyValue('font-family'),
fontSize: style.getPropertyValue('font-size'),
color: style.getPropertyValue('color'),
backgroundColor: style.getPropertyValue('background-color')
};
`);
//console.log('----->| DEBUG styles:', JSON.stringify(styles));
//Get toggle class from correct parent element
const toggleClass = await driver.executeScript(`
const span = document.querySelector('#k425604099 .switch-primary');
if (!span) return 'not found';
// Navigate up to find the switch-toggle div
let element = span.parentElement;
while (element) {
if (element.classList.contains('switch-toggle')) return element.className;
element = element.parentElement;
}
return 'switch-toggle not found in parents';
`);
//console.log('----->| DEBUG toggle class:', toggleClass);
//text
if (elementText === 'Primary') {
console.log('Passed: Enabled Primary toggle icon 3 text matched as expected');
} else {
errors.push(`Expected: Enabled Primary toggle icon 3 text: "Primary"; Actual: "${elementText}"`);
}
//font-family
if (styles.fontFamily === 'Poppins, sans-serif') {
console.log('Passed: Enabled Primary toggle icon 3 text font matched as expected');
} else {
errors.push(`Expected: Enabled Primary toggle icon 3 font "Poppins, sans-serif"; Actual: "${styles.fontFamily}"`);
}
//font-size
if (styles.fontSize === '10px') {
console.log('Passed: Enabled Primary toggle icon 3 font-size matched as expected');
} else {
errors.push(`Expected: Enabled Primary toggle icon 3 font-size "10px"; Actual: "${styles.fontSize}"`);
}
//color
if (styles.color === 'rgb(255, 255, 255)') {
console.log('Passed: Enabled Primary toggle icon 3 text color matched as expected');
} else {
errors.push(`Expected: Enabled Primary toggle icon 3 color "rgb(255, 255, 255)"; Actual: "${styles.color}"`);
}
//background color
if (styles.backgroundColor === 'rgba(0, 0, 0, 0)') {
console.log('Passed: Enabled Primary toggle icon 3 background color matched as expected');
} else {
errors.push(`Expected: Enabled Primary toggle icon 3 background color "rgba(0, 0, 0, 0)"; Actual: "${styles.backgroundColor}"`);
}
//toggle class
if (toggleClass.includes('switch-toggle')) {
console.log('Passed: Enabled Primary toggle icon 3 is a toggle switch as expected');
} else {
errors.push(`Expected: "switch-toggle" in parent; Actual: "${toggleClass}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
if (errors.length > 1) {
errors.unshift('Primary toggle icon 3 - Multiple validation checks did not pass');
}
throw new Error(errors.join('\n'));
}
}
},
//Tagged Concepts: Social Studies | General text
{
description: 'Validate Tagged Concepts Social Studies General text, size, and color',
action: async () => {
const multipleChecks = 'Tagged Concepts: Social Studies | General';
const element = await driver.findElement(By.css('#k425604100'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//text
if (elementText.includes('Social Studies | General')) {
console.log('Passed: Tagged Concepts: Social Studies | General text matched as expected');
} else {
errors.push(`Expected: "Social Studies | General"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Tagged Concepts: Social Studies | General text font matched as expected');
} else {
errors.push(`Expected: Tagged Concepts: Social Studies | General text font "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '12px') {
console.log('Passed: Tagged Concepts: Social Studies | General text font-size matched as expected');
} else {
errors.push(`Expected: Tagged Concepts: Social Studies | General text font-size "12px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(99, 99, 99, 1)') {
console.log('Passed: Tagged Concepts: Social Studies | General text color matched as expected');
} else {
errors.push(`Expected: Tagged Concepts: Social Studies | General text color: "rgba(99, 99, 99, 1)"; Actual: "${elementTextColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Remove button4
{
description: 'Validate Remove button4',
action: async () => {
const multipleChecks = 'Save Changes button4';
const elementIcon = await driver.findElement(By.css('#k425604100 .glyphicon'));
const element = await driver.findElement(By.css('#k425604100 > .btn'));
//Get text, font, color, and size
const elementText = await element.getText('');
const elementFont = await element.getCssValue('font-family');
const elementSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
const elementButtonColor = await element.getCssValue('background-color');
const elementTooltip = await element.getAttribute('title');
//Track all errors
const errors = [];
//icon
if (elementIcon) {
console.log('Passed: Remove button 4 icon is present');
} else {
errors.push('Save Remove button 4 icon was not found');
}
//text
if (elementText === 'Remove') {
console.log('Passed: Remove button 4 text matched as expected');
} else {
errors.push(`Expected: Button 4 text: "Remove"; Actual: "${elementText}"`);
}
//font-family
if (elementFont === "Poppins, sans-serif") {
console.log('Passed: Remove button 4 text font matched as expected');
} else {
errors.push(`Expected: Remove button 4 text font "Poppins, sans-serif"; Actual: ${elementFont}`);
}
//font size
if (elementSize === '12px') {
console.log('Passed: Remove button 4 text font-size matched as expected');
} else {
errors.push(`Expected: Remove button 4 text font-size "12px"; Actual: "${elementSize}"`);
}
//text color
if (elementTextColor === 'rgba(255, 255, 255, 1)') {
console.log('Passed: Remove button 4 text color matched as expected');
} else {
errors.push(`Expected: Remove button 4 text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`);
}
//button color
if (elementButtonColor === 'rgba(246, 60, 40, 1)') {
console.log('Passed: Remove button 4 background color matched as expected');
} else {
errors.push(`Expected: Remove button 4 background color: "rgba(246, 60, 40, 1)"; Actual: "${elementButtonColor}"`);
}
//tool-tip
if (elementTooltip === 'Remove Concept') {
console.log('Passed: Remove button 4 tool-tip text matched as expected');
} else {
errors.push(`Expected: Button 4 tool-tip text: "Remove Concept"; Actual: "${elementTooltip}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Primary toggle icon4
{
description: 'Verify Primary toggle icon4 is present',
action: async () => {
const element = await driver.wait(until.elementLocated(By.css('#k425604100 label')), 5000).catch(() => false);
//Get the switch-toggle div class
const toggleClass = await driver.executeScript(`
const listItem = document.querySelector('li#k425604100');
const toggle = listItem ? listItem.querySelector('div.switch-toggle') : null;
return toggle ? toggle.className : 'not found';
`);
//console.log('----->| DEBUG toggle class:', toggleClass);
//Track all errors
const errors = [];
if (element) {
console.log('Passed: Primary toggle icon 4 appeared as expected');
} else {
errors.push('Primary toggle icon 4 not found');
}
//Validate it's a toggle not a regular button
if (toggleClass.includes('switch-toggle')) {
console.log('Passed: Primary toggle icon 4 toggle switch listed as expected');
} else {
errors.push(`Expected: Primary toggle icon 4: "switch-toggle"; Actual: "${toggleClass}"`);
}
}
},
//Select a set of standards: header
{
description: 'Validate Select a set of standards header text, size, and color',
action: async () => {
const multipleChecks = 'Select a set of standards: header';
const element = await driver.findElement(By.css('#concept-standard > label'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//text
if (elementText === 'Select a set of standards:') {
console.log('Passed: Select a set of standards: header text matched as expected');
} else {
errors.push(`Expected: "Select a set of standards:"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Select a set of standards: header font matched as expected');
} else {
errors.push(`Expected: Select a set of standards: header font "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '13px') {
console.log('Passed: Select a set of standards: header text font-size matched as expected');
} else {
errors.push(`Expected: Select a set of standards: header text font-size "13px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(40, 39, 90, 1)') {
console.log('Passed: Select a set of standards: header text color matched as expected');
} else {
errors.push(`Expected: Select a set of standards: header text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Set of standards dropdown list
{
description: 'Validate Set of standards dropdown list',
action: async () => {
const multipleChecks = 'Set of standards dropdown list';
const element = await driver.findElement(By.css('#correlate-select-state'));
const options = await element.findElements(By.css('option'));
//Track all errors
const errors = [];
const expected = [
'',
'California',
'Common Core State Standards',
'Texas',
'Alabama',
'Arizona',
'Florida',
'Georgia',
'New York',
'Washington',
'Alberta Standards',
'Ontario Curriculum',
'Australian Curriculum (ACARA) v8',
'New South Wales',
'Illinois',
'NCSSFL-ACTFL CAN-DO STATEMENTS',
'WIDA Consortium (2020)',
'Imported Framework Updated',
'Widget Test',
'California Mathematics 1997',
'5th Grade Import ECS-2732',
'Stats Test Framework',
'Georgia Archived Language Arts QA',
'Georgia Current Language Arts QA',
'Georgia Future Language Arts QA',
'create group test',
'ECS-2933 Testing On Prod',
'IMport Test'
];
const actual = [];
for (const opt of options) {
const text = (await opt.getText()).trim();
actual.push(text);
}
if (JSON.stringify(actual) === JSON.stringify(expected)) {
console.log('Passed: Set of standards - Dropdown list matched as expected');
} else {
throw new Error(`Expected: Set of standards - Dropdown list: ${JSON.stringify(expected)}, Actual: ${JSON.stringify(actual)}`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//NEXT ACTION
{
description: 'Click AutoAlign tab link',
action: async () => {
await driver.findElement(By.linkText('AutoAlign')).click();
console.log('----->| NEXT ACTION: Clicked AutoAlign tab link');
//Wait for page to load completely
await driver.wait(async () => {
const readyState = await driver.executeScript('return document.readyState');
return readyState === 'complete';
}, 30000, 'Page did not fully load within 30 seconds');
//Wait until the element exists in the DOM
const sectionHeader = await driver.wait(
until.elementLocated(By.css('#suggest_form > b')),
30000
);
//Wait until it becomes visible
await driver.wait(
until.elementIsVisible(sectionHeader),
30000
);
//Wait for page to load completely
await driver.wait(async () => {
const readyState = await driver.executeScript('return document.readyState');
return readyState === 'complete';
}, 30000, 'AutoAlign page did not fully load within 30 seconds');
console.log('Passed: AutoAlign page loaded successfully');
}
},
//Browse tab title
{
description: 'Validate Browse tab title text, size, and color',
action: async () => {
const multipleChecks = 'Browse tab title';
const element = await driver.findElement(By.linkText('Browse'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
const elementButtonColor = await element.getCssValue('background-color');
//Track all errors
const errors = [];
//text
if (elementText === 'Browse') {
console.log('Passed: Browse tab title text matched as expected');
} else {
errors.push(`Expected: "Browse"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Browse tab title font matched as expected');
} else {
errors.push(`Expected: Browse tab title font "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '15px') {
console.log('Passed: Browse tab title text font-size matched as expected');
} else {
errors.push(`Expected: Browse tab title text font-size "15px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(182, 186, 181, 1)') {
console.log('Passed: Browse tab title text color matched as expected');
} else {
errors.push(`Expected: Browse tab title text color: "rgba(182, 186, 181, 1)"; Actual: "${elementTextColor}"`);
}
//button color
if (elementButtonColor === 'rgba(0, 0, 0, 0)') {
console.log('Passed: Browse tab background color matched as expected');
} else {
errors.push(`Expected: Browse tab background color: "rgba(0, 0, 0, 0)"; Actual: "${elementButtonColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//By Standard tab tab title
{
description: 'Validate By Standard tab title text, size, and color',
action: async () => {
const multipleChecks = 'By Standard tab title';
const element = await driver.findElement(By.linkText('By Standard'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
const elementButtonColor = await element.getCssValue('background-color');
//Track all errors
const errors = [];
//text
if (elementText === 'By Standard') {
console.log('Passed: By Standard tab title text matched as expected');
} else {
errors.push(`Expected: "By Standard"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: By Standard tab title font matched as expected');
} else {
errors.push(`Expected: By Standard tab title font "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '15px') {
console.log('Passed: By Standard tab title text font-size matched as expected');
} else {
errors.push(`Expected: By Standard tab title text font-size "15px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(182, 186, 181, 1)') {
console.log('Passed: By Standard tab title text color matched as expected');
} else {
errors.push(`Expected: By Standard tab title text color: "rgba(182, 186, 181, 1)"; Actual: "${elementTextColor}"`);
}
//button color
if (elementButtonColor === 'rgba(0, 0, 0, 0)') {
console.log('Passed: By Standard tab background color matched as expected');
} else {
errors.push(`Expected: By Standard tab background color: "rgba(0, 0, 0, 0)"; Actual: "${elementButtonColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//AutoAlign tab title (active)
{
description: 'Validate AutoAlign tab title text, size, and color',
action: async () => {
const multipleChecks = 'AutoAlign tab title';
const element = await driver.findElement(By.linkText('AutoAlign'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
const elementButtonColor = await element.getCssValue('background-color');
//Track all errors
const errors = [];
//text
if (elementText === 'AutoAlign') {
console.log('Passed: AutoAlign tab title text matched as expected');
} else {
errors.push(`Expected: "AutoAlign"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: AutoAlign tab title font matched as expected');
} else {
errors.push(`Expected: AutoAlign tab title font "DM Serif Display, serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '15px') {
console.log('Passed: AutoAlign tab title text font-size matched as expected');
} else {
errors.push(`Expected: AutoAlign tab title text font-size "15px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(255, 255, 255, 1)') {
console.log('Passed: AutoAlign tab title text color matched as expected');
} else {
errors.push(`Expected: AutoAlign tab title text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`);
}
//button color
if (elementButtonColor === 'rgba(40, 39, 90, 1)') {
console.log('Passed: AutoAlign tab background color matched as expected');
} else {
errors.push(`Expected: AutoAlign tab background color: "rgba(40, 39, 90, 1)"; Actual: "${elementButtonColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Tagged Concepts: header
{
description: 'Validate Tagged Concepts header text, size, and color',
action: async () => {
const multipleChecks = 'Tagged Concepts: header';
const element = await driver.findElement(By.css('.ui-widget-heading'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//text
if (elementText === 'Tagged Concepts:') {
console.log('Passed: Tagged Concepts: header text matched as expected');
} else {
errors.push(`Expected: "Tagged Concepts:"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Tagged Concepts: header font matched as expected');
} else {
errors.push(`Expected: Tagged Concepts: header font "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '16px') {
console.log('Passed: Tagged Concepts: header text font-size matched as expected');
} else {
errors.push(`Expected: Tagged Concepts: header text font-size "16px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(40, 39, 90, 1)') {
console.log('Passed: Tagged Concepts: header text color matched as expected');
} else {
errors.push(`Expected: Tagged Concepts: header text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Tagged Concepts: Language Arts | General text
{
description: 'Validate Tagged Concepts Language Arts General text, size, and color',
action: async () => {
const multipleChecks = 'Tagged Concepts: Language Arts | General';
const element = await driver.findElement(By.css('#k425604097'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//text
if (elementText.includes('Language Arts | General')) {
console.log('Passed: Tagged Concepts: Language Arts | General text matched as expected');
} else {
errors.push(`Expected: "Language Arts | General"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Tagged Concepts: Language Arts | General text font matched as expected');
} else {
errors.push(`Expected: Tagged Concepts: Language Arts | General text font "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '12px') {
console.log('Passed: Tagged Concepts: Language Arts | General text font-size matched as expected');
} else {
errors.push(`Expected: Tagged Concepts: Language Arts | General text font-size "12px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(99, 99, 99, 1)') {
console.log('Passed: Tagged Concepts: Language Arts | General text color matched as expected');
} else {
errors.push(`Expected: Tagged Concepts: Language Arts | General text color: "rgba(99, 99, 99, 1)"; Actual: "${elementTextColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Remove button1
{
description: 'Validate Remove button1',
action: async () => {
const multipleChecks = 'Save Changes button1';
const elementIcon = await driver.findElement(By.css('#k425604097 .glyphicon'));
const element = await driver.findElement(By.css('#k425604097 > .btn'));
//Get text, font, color, and size
const elementText = await element.getText('');
const elementFont = await element.getCssValue('font-family');
const elementSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
const elementButtonColor = await element.getCssValue('background-color');
const elementTooltip = await element.getAttribute('title');
//Track all errors
const errors = [];
//icon
if (elementIcon) {
console.log('Passed: Remove button 1 icon is present');
} else {
errors.push('Save Remove button 1 icon was not found');
}
//text
if (elementText === 'Remove') {
console.log('Passed: Remove button 1 text matched as expected');
} else {
errors.push(`Expected: Button 1 text: "Remove"; Actual: "${elementText}"`);
}
//font-family
if (elementFont === "Poppins, sans-serif") {
console.log('Passed: Remove button 1 text font matched as expected');
} else {
errors.push(`Expected: Remove button 1 text font "Poppins, sans-serif"; Actual: ${elementFont}`);
}
//font size
if (elementSize === '12px') {
console.log('Passed: Remove button 1 text font-size matched as expected');
} else {
errors.push(`Expected: Remove button 1 text font-size "12px"; Actual: "${elementSize}"`);
}
//text color
if (elementTextColor === 'rgba(255, 255, 255, 1)') {
console.log('Passed: Remove button 1 text color matched as expected');
} else {
errors.push(`Expected: Remove button 1 text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`);
}
//button color
if (elementButtonColor === 'rgba(246, 60, 40, 1)') {
console.log('Passed: Remove button 1 background color matched as expected');
} else {
errors.push(`Expected: Remove button 1 background color: "rgba(246, 60, 40, 1)"; Actual: "${elementButtonColor}"`);
}
//tool-tip
if (elementTooltip === 'Remove Concept') {
console.log('Passed: Remove button 1 tool-tip text matched as expected');
} else {
errors.push(`Expected: Button 1 tool-tip text: "Remove Concept"; Actual: "${elementTooltip}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Primary toggle icon1
{
description: 'Verify Primary toggle icon1 is present',
action: async () => {
const element = await driver.wait(until.elementLocated(By.css('#k425604097 label')), 5000).catch(() => false);
//Get the switch-toggle div class
const toggleClass = await driver.executeScript(`
const listItem = document.querySelector('li#k425604097');
const toggle = listItem ? listItem.querySelector('div.switch-toggle') : null;
return toggle ? toggle.className : 'not found';
`);
//console.log('----->| DEBUG toggle class:', toggleClass);
//Track all errors
const errors = [];
if (element) {
console.log('Passed: Primary toggle icon 1 appeared as expected');
} else {
errors.push('Primary toggle icon 1 not found');
}
//Validate it's a toggle not a regular button
if (toggleClass.includes('switch-toggle')) {
console.log('Passed: Primary toggle icon 1 toggle switch listed as expected');
} else {
errors.push(`Expected: Primary toggle icon 1: "switch-toggle"; Actual: "${toggleClass}"`);
}
}
},
//Tagged Concepts: Mathematics | General text
{
description: 'Validate Tagged Concepts Mathematics General text, size, and color',
action: async () => {
const multipleChecks = 'Tagged Concepts: Mathematics | General';
const element = await driver.findElement(By.css('#k425604098'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//text
if (elementText.includes('Mathematics | General')) {
console.log('Passed: Tagged Concepts: Mathematics | General text matched as expected');
} else {
errors.push(`Expected: "Mathematics | General"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Tagged Concepts: Mathematics | General text font matched as expected');
} else {
errors.push(`Expected: Tagged Concepts: Mathematics | General text font "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '12px') {
console.log('Passed: Tagged Concepts: Mathematics | General text font-size matched as expected');
} else {
errors.push(`Expected: Tagged Concepts: Mathematics | General text font-size "12px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(99, 99, 99, 1)') {
console.log('Passed: Tagged Concepts: Mathematics | General text color matched as expected');
} else {
errors.push(`Expected: Tagged Concepts: Mathematics | General text color: "rgba(99, 99, 99, 1)"; Actual: "${elementTextColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Remove button2
{
description: 'Validate Remove button2',
action: async () => {
const multipleChecks = 'Save Changes button2';
const elementIcon = await driver.findElement(By.css('#k425604098 .glyphicon'));
const element = await driver.findElement(By.css('#k425604098 > .btn'));
//Get text, font, color, and size
const elementText = await element.getText('');
const elementFont = await element.getCssValue('font-family');
const elementSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
const elementButtonColor = await element.getCssValue('background-color');
const elementTooltip = await element.getAttribute('title');
//Track all errors
const errors = [];
//icon
if (elementIcon) {
console.log('Passed: Remove button 2 icon is present');
} else {
errors.push('Save Remove button 2 icon was not found');
}
//text
if (elementText === 'Remove') {
console.log('Passed: Remove button 2 text matched as expected');
} else {
errors.push(`Expected: Button 2 text: "Remove"; Actual: "${elementText}"`);
}
//font-family
if (elementFont === "Poppins, sans-serif") {
console.log('Passed: Remove button 2 text font matched as expected');
} else {
errors.push(`Expected: Remove button 2 text font "Poppins, sans-serif"; Actual: ${elementFont}`);
}
//font size
if (elementSize === '12px') {
console.log('Passed: Remove button 2 text font-size matched as expected');
} else {
errors.push(`Expected: Remove button 2 text font-size "12px"; Actual: "${elementSize}"`);
}
//text color
if (elementTextColor === 'rgba(255, 255, 255, 1)') {
console.log('Passed: Remove button 2 text color matched as expected');
} else {
errors.push(`Expected: Remove button 2 text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`);
}
//button color
if (elementButtonColor === 'rgba(246, 60, 40, 1)') {
console.log('Passed: Remove button 2 background color matched as expected');
} else {
errors.push(`Expected: Remove button 2 background color: "rgba(246, 60, 40, 1)"; Actual: "${elementButtonColor}"`);
}
//tool-tip
if (elementTooltip === 'Remove Concept') {
console.log('Passed: Remove button 2 tool-tip text matched as expected');
} else {
errors.push(`Expected: Button 2 tool-tip text: "Remove Concept"; Actual: "${elementTooltip}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Primary toggle icon2
{
description: 'Verify Primary toggle icon2 is present',
action: async () => {
const element = await driver.wait(until.elementLocated(By.css('#k425604098 label')), 5000).catch(() => false);
//Get the switch-toggle div class
const toggleClass = await driver.executeScript(`
const listItem = document.querySelector('li#k425604098');
const toggle = listItem ? listItem.querySelector('div.switch-toggle') : null;
return toggle ? toggle.className : 'not found';
`);
//console.log('----->| DEBUG toggle class:', toggleClass);
//Track all errors
const errors = [];
if (element) {
console.log('Passed: Primary toggle icon 2 appeared as expected');
} else {
errors.push('Primary toggle icon 2 not found');
}
//Validate it's a toggle not a regular button
if (toggleClass.includes('switch-toggle')) {
console.log('Passed: Primary toggle icon 2 toggle switch listed as expected');
} else {
errors.push(`Expected: Primary toggle icon 2: "switch-toggle"; Actual: "${toggleClass}"`);
}
}
},
//Tagged Concepts: Science | General text
{
description: 'Validate Tagged Concepts Science General text, size, and color',
action: async () => {
const multipleChecks = 'Tagged Concepts: Science | General';
const element = await driver.findElement(By.css('#k425604099'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//text
if (elementText.includes('Science | General')) {
console.log('Passed: Tagged Concepts: Science | General text matched as expected');
} else {
errors.push(`Expected: "Science | General"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Tagged Concepts: Science | General text font matched as expected');
} else {
errors.push(`Expected: Tagged Concepts: Science | General text font "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '12px') {
console.log('Passed: Tagged Concepts: Science | General text font-size matched as expected');
} else {
errors.push(`Expected: Tagged Concepts: Science | General text font-size "12px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(99, 99, 99, 1)') {
console.log('Passed: Tagged Concepts: Science | General text color matched as expected');
} else {
errors.push(`Expected: Tagged Concepts: Science | General text color: "rgba(99, 99, 99, 1)"; Actual: "${elementTextColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Remove button3
{
description: 'Validate Remove button3',
action: async () => {
const multipleChecks = 'Save Changes button3';
const elementIcon = await driver.findElement(By.css('#k425604099 .glyphicon'));
const element = await driver.findElement(By.css('#k425604099 > .btn'));
//Get text, font, color, and size
const elementText = await element.getText('');
const elementFont = await element.getCssValue('font-family');
const elementSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
const elementButtonColor = await element.getCssValue('background-color');
const elementTooltip = await element.getAttribute('title');
//Track all errors
const errors = [];
//icon
if (elementIcon) {
console.log('Passed: Remove button 3 icon is present');
} else {
errors.push('Save Remove button 3 icon was not found');
}
//text
if (elementText === 'Remove') {
console.log('Passed: Remove button 3 text matched as expected');
} else {
errors.push(`Expected: Button 3 text: "Remove"; Actual: "${elementText}"`);
}
//font-family
if (elementFont === "Poppins, sans-serif") {
console.log('Passed: Remove button 3 text font matched as expected');
} else {
errors.push(`Expected: Remove button 3 text font "Poppins, sans-serif"; Actual: ${elementFont}`);
}
//font size
if (elementSize === '12px') {
console.log('Passed: Remove button 3 text font-size matched as expected');
} else {
errors.push(`Expected: Remove button 3 text font-size "12px"; Actual: "${elementSize}"`);
}
//text color
if (elementTextColor === 'rgba(255, 255, 255, 1)') {
console.log('Passed: Remove button 3 text color matched as expected');
} else {
errors.push(`Expected: Remove button 3 text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`);
}
//button color
if (elementButtonColor === 'rgba(246, 60, 40, 1)') {
console.log('Passed: Remove button 3 background color matched as expected');
} else {
errors.push(`Expected: Remove button 3 background color: "rgba(246, 60, 40, 1)"; Actual: "${elementButtonColor}"`);
}
//tool-tip
if (elementTooltip === 'Remove Concept') {
console.log('Passed: Remove button 3 tool-tip text matched as expected');
} else {
errors.push(`Expected: Button 3 tool-tip text: "Remove Concept"; Actual: "${elementTooltip}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Primary toggle icon3 (SPECIAL CASE: use executeScript for all CSS values)
{
description: 'Verify Primary toggle icon3 is present',
action: async () => {
const element = await driver.wait(until.elementLocated(By.css('#k425604099 .switch-primary')), 5000).catch(() => false);
const errors = [];
//Get text
const elementText = await element.getText();
//Get all CSS values via executeScript
const styles = await driver.executeScript(`
const span = document.querySelector('#k425604099 .switch-primary');
if (!span) return null;
const style = window.getComputedStyle(span);
return {
fontFamily: style.getPropertyValue('font-family'),
fontSize: style.getPropertyValue('font-size'),
color: style.getPropertyValue('color'),
backgroundColor: style.getPropertyValue('background-color')
};
`);
//console.log('----->| DEBUG styles:', JSON.stringify(styles));
//Get toggle class from correct parent element
const toggleClass = await driver.executeScript(`
const span = document.querySelector('#k425604099 .switch-primary');
if (!span) return 'not found';
// Navigate up to find the switch-toggle div
let element = span.parentElement;
while (element) {
if (element.classList.contains('switch-toggle')) return element.className;
element = element.parentElement;
}
return 'switch-toggle not found in parents';
`);
//console.log('----->| DEBUG toggle class:', toggleClass);
//text
if (elementText === 'Primary') {
console.log('Passed: Enabled Primary toggle icon 3 text matched as expected');
} else {
errors.push(`Expected: Enabled Primary toggle icon 3 text: "Primary"; Actual: "${elementText}"`);
}
//font-family
if (styles.fontFamily === 'Poppins, sans-serif') {
console.log('Passed: Enabled Primary toggle icon 3 text font matched as expected');
} else {
errors.push(`Expected: Enabled Primary toggle icon 3 font "Poppins, sans-serif"; Actual: "${styles.fontFamily}"`);
}
//font-size
if (styles.fontSize === '10px') {
console.log('Passed: Enabled Primary toggle icon 3 font-size matched as expected');
} else {
errors.push(`Expected: Enabled Primary toggle icon 3 font-size "10px"; Actual: "${styles.fontSize}"`);
}
//color
if (styles.color === 'rgb(255, 255, 255)') {
console.log('Passed: Enabled Primary toggle icon 3 text color matched as expected');
} else {
errors.push(`Expected: Enabled Primary toggle icon 3 color "rgb(255, 255, 255)"; Actual: "${styles.color}"`);
}
//background color
if (styles.backgroundColor === 'rgba(0, 0, 0, 0)') {
console.log('Passed: Enabled Primary toggle icon 3 background color matched as expected');
} else {
errors.push(`Expected: Enabled Primary toggle icon 3 background color "rgba(0, 0, 0, 0)"; Actual: "${styles.backgroundColor}"`);
}
//toggle class
if (toggleClass.includes('switch-toggle')) {
console.log('Passed: Enabled Primary toggle icon 3 is a toggle switch as expected');
} else {
errors.push(`Expected: "switch-toggle" in parent; Actual: "${toggleClass}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
if (errors.length > 1) {
errors.unshift('Primary toggle icon 3 - Multiple validation checks did not pass');
}
throw new Error(errors.join('\n'));
}
}
},
//Tagged Concepts: Social Studies | General text
{
description: 'Validate Tagged Concepts Social Studies General text, size, and color',
action: async () => {
const multipleChecks = 'Tagged Concepts: Social Studies | General';
const element = await driver.findElement(By.css('#k425604100'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//text
if (elementText.includes('Social Studies | General')) {
console.log('Passed: Tagged Concepts: Social Studies | General text matched as expected');
} else {
errors.push(`Expected: "Social Studies | General"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Tagged Concepts: Social Studies | General text font matched as expected');
} else {
errors.push(`Expected: Tagged Concepts: Social Studies | General text font "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '12px') {
console.log('Passed: Tagged Concepts: Social Studies | General text font-size matched as expected');
} else {
errors.push(`Expected: Tagged Concepts: Social Studies | General text font-size "12px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(99, 99, 99, 1)') {
console.log('Passed: Tagged Concepts: Social Studies | General text color matched as expected');
} else {
errors.push(`Expected: Tagged Concepts: Social Studies | General text color: "rgba(99, 99, 99, 1)"; Actual: "${elementTextColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Remove button4
{
description: 'Validate Remove button4',
action: async () => {
const multipleChecks = 'Save Changes button4';
const elementIcon = await driver.findElement(By.css('#k425604100 .glyphicon'));
const element = await driver.findElement(By.css('#k425604100 > .btn'));
//Get text, font, color, and size
const elementText = await element.getText('');
const elementFont = await element.getCssValue('font-family');
const elementSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
const elementButtonColor = await element.getCssValue('background-color');
const elementTooltip = await element.getAttribute('title');
//Track all errors
const errors = [];
//icon
if (elementIcon) {
console.log('Passed: Remove button 4 icon is present');
} else {
errors.push('Save Remove button 4 icon was not found');
}
//text
if (elementText === 'Remove') {
console.log('Passed: Remove button 4 text matched as expected');
} else {
errors.push(`Expected: Button 4 text: "Remove"; Actual: "${elementText}"`);
}
//font-family
if (elementFont === "Poppins, sans-serif") {
console.log('Passed: Remove button 4 text font matched as expected');
} else {
errors.push(`Expected: Remove button 4 text font "Poppins, sans-serif"; Actual: ${elementFont}`);
}
//font size
if (elementSize === '12px') {
console.log('Passed: Remove button 4 text font-size matched as expected');
} else {
errors.push(`Expected: Remove button 4 text font-size "12px"; Actual: "${elementSize}"`);
}
//text color
if (elementTextColor === 'rgba(255, 255, 255, 1)') {
console.log('Passed: Remove button 4 text color matched as expected');
} else {
errors.push(`Expected: Remove button 4 text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`);
}
//button color
if (elementButtonColor === 'rgba(246, 60, 40, 1)') {
console.log('Passed: Remove button 4 background color matched as expected');
} else {
errors.push(`Expected: Remove button 4 background color: "rgba(246, 60, 40, 1)"; Actual: "${elementButtonColor}"`);
}
//tool-tip
if (elementTooltip === 'Remove Concept') {
console.log('Passed: Remove button 4 tool-tip text matched as expected');
} else {
errors.push(`Expected: Button 4 tool-tip text: "Remove Concept"; Actual: "${elementTooltip}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Primary toggle icon4
{
description: 'Verify Primary toggle icon4 is present',
action: async () => {
const element = await driver.wait(until.elementLocated(By.css('#k425604100 label')), 5000).catch(() => false);
//Get the switch-toggle div class
const toggleClass = await driver.executeScript(`
const listItem = document.querySelector('li#k425604100');
const toggle = listItem ? listItem.querySelector('div.switch-toggle') : null;
return toggle ? toggle.className : 'not found';
`);
//console.log('----->| DEBUG toggle class:', toggleClass);
//Track all errors
const errors = [];
if (element) {
console.log('Passed: Primary toggle icon 4 appeared as expected');
} else {
errors.push('Primary toggle icon 4 not found');
}
//Validate it's a toggle not a regular button
if (toggleClass.includes('switch-toggle')) {
console.log('Passed: Primary toggle icon 4 toggle switch listed as expected');
} else {
errors.push(`Expected: Primary toggle icon 4: "switch-toggle"; Actual: "${toggleClass}"`);
}
}
},
//EdGate's AutoAlign system... header
{
description: 'Validate EdGates AutoAlign system header text, size, and color',
action: async () => {
const multipleChecks = 'EdGates AutoAlign system header';
const element = await driver.findElement(By.css('#suggest_form > b'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//text
if (elementText === `EdGate's AutoAlign system can suggest concepts that may be relevant`) {
console.log(`Passed: EdGate's AutoAlign system... header text matched as expected`);
} else {
errors.push(`Expected: "EdGate's AutoAlign system can suggest concepts that may be relevant"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === 'Poppins, sans-serif') {
console.log(`Passed: EdGate's AutoAlign system... header font matched as expected`);
} else {
errors.push(`Expected: EdGate's AutoAlign system... header font "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '13px') {
console.log(`Passed: EdGate's AutoAlign system... header text font-size matched as expected`);
} else {
errors.push(`Expected: EdGate's AutoAlign system... header text font-size "13px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(40, 39, 90, 1)') {
console.log(`Passed: EdGate's AutoAlign system... header text color matched as expected`);
} else {
errors.push(`Expected: EdGate's AutoAlign system... header text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Base Suggestion On: header
{
description: 'Validate Base Suggestion On header text, size, and color',
action: async () => {
const multipleChecks = 'Base Suggestion On: header';
const element = await driver.findElement(By.css('#suggest_form'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//text
if (elementText.includes('Base Suggestion On:')) {
console.log('Passed: Base Suggestion On: header text matched as expected');
} else {
errors.push(`Expected: "Base Suggestion On:"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Base Suggestion On: header font matched as expected');
} else {
errors.push(`Expected: Base Suggestion On: header font "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '13px') {
console.log('Passed: Base Suggestion On: header text font-size matched as expected');
} else {
errors.push(`Expected: Base Suggestion On: header text font-size "13px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(40, 39, 90, 1)') {
console.log('Passed: Base Suggestion On: header text color matched as expected');
} else {
errors.push(`Expected: Base Suggestion On: header text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Title
{
description: 'Validate Title text, size, and color',
action: async () => {
const multipleChecks = 'Title checkbox';
const elementIcon = await driver.findElement(By.css('#inlineCheckbox1'));
const element = await driver.findElement(By.css('.checkbox-inline:nth-child(1)'));
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//icon
if (elementIcon) {
console.log('Passed: Title checkbox is present');
} else {
errors.push('Title checkbox was not found');
}
//text
if (elementText === 'Title') {
console.log('Passed: Title label text matched as expected');
} else {
errors.push(`Expected: "Title"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Title label font matched as expected');
} else {
errors.push(`Expected: Title label font "DM Serif Display, serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '13px') {
console.log('Passed: Title label text font-size matched as expected');
} else {
errors.push(`Expected: Title label text font-size "13px"; Actual: "${elementTextSize}"`);
}
//text color
if (elementTextColor === 'rgba(40, 39, 90, 1)') {
console.log('Passed: Title label text color matched as expected');
} else {
errors.push(`Expected: Title label text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Description
{
description: 'Validate Description text, size, and color',
action: async () => {
const multipleChecks = 'Description checkbox';
const elementIcon = await driver.findElement(By.css('#inlineCheckbox2'));
const element = await driver.findElement(By.css('.checkbox-inline:nth-child(2)'));
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//icon
if (elementIcon) {
console.log('Passed: Description checkbox is present');
} else {
errors.push('Description checkbox was not found');
}
//text
if (elementText === 'Description') {
console.log('Passed: Description label text matched as expected');
} else {
errors.push(`Expected: "Description"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Description label font matched as expected');
} else {
errors.push(`Expected: Description label font "DM Serif Display, serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '13px') {
console.log('Passed: Description label text font-size matched as expected');
} else {
errors.push(`Expected: Description label text font-size "13px"; Actual: "${elementTextSize}"`);
}
//text color
if (elementTextColor === 'rgba(40, 39, 90, 1)') {
console.log('Passed: Description label text color matched as expected');
} else {
errors.push(`Expected: Description label text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Ads
{
description: 'Validate Ads text, size, and color',
action: async () => {
const multipleChecks = 'Ads checkbox';
const elementIcon = await driver.findElement(By.css('#inlineCheckbox3'));
const element = await driver.findElement(By.css('.checkbox-inline:nth-child(3)'));
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//icon
if (elementIcon) {
console.log('Passed: Ads checkbox is present');
} else {
errors.push('Ads checkbox was not found');
}
//text
if (elementText === 'Ads') {
console.log('Passed: Ads label text matched as expected');
} else {
errors.push(`Expected: "Ads"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Ads label font matched as expected');
} else {
errors.push(`Expected: Ads label font "DM Serif Display, serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '13px') {
console.log('Passed: Ads label text font-size matched as expected');
} else {
errors.push(`Expected: Ads label text font-size "13px"; Actual: "${elementTextSize}"`);
}
//text color
if (elementTextColor === 'rgba(40, 39, 90, 1)') {
console.log('Passed: Ads label text color matched as expected');
} else {
errors.push(`Expected: Ads label text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Content Type
{
description: 'Validate Content Type text, size, and color',
action: async () => {
const multipleChecks = 'Content Type checkbox';
const elementIcon = await driver.findElement(By.css('#inlineCheckbox4'));
const element = await driver.findElement(By.css('.checkbox-inline:nth-child(4)'));
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//icon
if (elementIcon) {
console.log('Passed: Content Type checkbox is present');
} else {
errors.push('Content Type checkbox was not found');
}
//text
if (elementText === 'Content Type') {
console.log('Passed: Content Type label text matched as expected');
} else {
errors.push(`Expected: "Content Type"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Content Type label font matched as expected');
} else {
errors.push(`Expected: Content Type label font "DM Serif Display, serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '13px') {
console.log('Passed: Content Type label text font-size matched as expected');
} else {
errors.push(`Expected: Content Type label text font-size "13px"; Actual: "${elementTextSize}"`);
}
//text color
if (elementTextColor === 'rgba(40, 39, 90, 1)') {
console.log('Passed: Content Type label text color matched as expected');
} else {
errors.push(`Expected: Content Type label text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Format
{
description: 'Validate Format text, size, and color',
action: async () => {
const multipleChecks = 'Format checkbox';
const elementIcon = await driver.findElement(By.css('#inlineCheckbox5'));
const element = await driver.findElement(By.css('.checkbox-inline:nth-child(5)'));
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//icon
if (elementIcon) {
console.log('Passed: Format checkbox is present');
} else {
errors.push('Format checkbox was not found');
}
//text
if (elementText === 'Format') {
console.log('Passed: Format label text matched as expected');
} else {
errors.push(`Expected: "Format"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Format label font matched as expected');
} else {
errors.push(`Expected: Format label font "DM Serif Display, serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '13px') {
console.log('Passed: Format label text font-size matched as expected');
} else {
errors.push(`Expected: Format label text font-size "13px"; Actual: "${elementTextSize}"`);
}
//text color
if (elementTextColor === 'rgba(40, 39, 90, 1)') {
console.log('Passed: Format label text color matched as expected');
} else {
errors.push(`Expected: Format label text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Free or Fee
{
description: 'Validate Free or Fee text, size, and color',
action: async () => {
const multipleChecks = 'Free or Fee checkbox';
const elementIcon = await driver.findElement(By.css('#inlineCheckbox6'));
const element = await driver.findElement(By.css('.checkbox-inline:nth-child(6)'));
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//icon
if (elementIcon) {
console.log('Passed: Free or Fee checkbox is present');
} else {
errors.push('Free or Fee checkbox was not found');
}
//text
if (elementText === 'Free or Fee') {
console.log('Passed: Free or Fee label text matched as expected');
} else {
errors.push(`Expected: "Free or Fee"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Free or Fee label font matched as expected');
} else {
errors.push(`Expected: Free or Fee label font "DM Serif Display, serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '13px') {
console.log('Passed: Free or Fee label text font-size matched as expected');
} else {
errors.push(`Expected: Free or Fee label text font-size "13px"; Actual: "${elementTextSize}"`);
}
//text color
if (elementTextColor === 'rgba(40, 39, 90, 1)') {
console.log('Passed: Free or Fee label text color matched as expected');
} else {
errors.push(`Expected: Free or Fee label text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Grade Range
{
description: 'Validate Grade Range text, size, and color',
action: async () => {
const multipleChecks = 'Grade Range checkbox';
const elementIcon = await driver.findElement(By.css('#inlineCheckbox7'));
const element = await driver.findElement(By.css('.checkbox-inline:nth-child(7)'));
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//icon
if (elementIcon) {
console.log('Passed: Grade Range checkbox is present');
} else {
errors.push('Grade Range checkbox was not found');
}
//text
if (elementText === 'Grade Range') {
console.log('Passed: Grade Range label text matched as expected');
} else {
errors.push(`Expected: "Grade Range"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Grade Range label font matched as expected');
} else {
errors.push(`Expected: Grade Range label font "DM Serif Display, serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '13px') {
console.log('Passed: Grade Range label text font-size matched as expected');
} else {
errors.push(`Expected: Grade Range label text font-size "13px"; Actual: "${elementTextSize}"`);
}
//text color
if (elementTextColor === 'rgba(40, 39, 90, 1)') {
console.log('Passed: Grade Range label text color matched as expected');
} else {
errors.push(`Expected: Grade Range label text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Language
{
description: 'Validate Language text, size, and color',
action: async () => {
const multipleChecks = 'Language checkbox';
const elementIcon = await driver.findElement(By.css('#inlineCheckbox8'));
const element = await driver.findElement(By.css('.checkbox-inline:nth-child(8)'));
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//icon
if (elementIcon) {
console.log('Passed: Language checkbox is present');
} else {
errors.push('Language checkbox was not found');
}
//text
if (elementText === 'Language') {
console.log('Passed: Language label text matched as expected');
} else {
errors.push(`Expected: "Language"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Language label font matched as expected');
} else {
errors.push(`Expected: Language label font "DM Serif Display, serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '13px') {
console.log('Passed: Language label text font-size matched as expected');
} else {
errors.push(`Expected: Language label text font-size "13px"; Actual: "${elementTextSize}"`);
}
//text color
if (elementTextColor === 'rgba(40, 39, 90, 1)') {
console.log('Passed: Language label text color matched as expected');
} else {
errors.push(`Expected: Language label text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Level-Challenging
{
description: 'Validate Level-Challenging text, size, and color',
action: async () => {
const multipleChecks = 'Level-Challenging checkbox';
const elementIcon = await driver.findElement(By.css('#inlineCheckbox9'));
const element = await driver.findElement(By.css('.checkbox-inline:nth-child(9)'));
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//icon
if (elementIcon) {
console.log('Passed: Level-Challenging checkbox is present');
} else {
errors.push('Level-Challenging checkbox was not found');
}
//text
if (elementText === 'Level-Challenging') {
console.log('Passed: Level-Challenging label text matched as expected');
} else {
errors.push(`Expected: "Level-Challenging"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Level-Challenging label font matched as expected');
} else {
errors.push(`Expected: Level-Challenging label font "DM Serif Display, serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '13px') {
console.log('Passed: Level-Challenging label text font-size matched as expected');
} else {
errors.push(`Expected: Level-Challenging label text font-size "13px"; Actual: "${elementTextSize}"`);
}
//text color
if (elementTextColor === 'rgba(40, 39, 90, 1)') {
console.log('Passed: Level-Challenging label text color matched as expected');
} else {
errors.push(`Expected: Level-Challenging label text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Level-On Target
{
description: 'Validate Level-On Target text, size, and color',
action: async () => {
const multipleChecks = 'Level-On Target checkbox';
const elementIcon = await driver.findElement(By.css('#inlineCheckbox10'));
const element = await driver.findElement(By.css('.checkbox-inline:nth-child(10)'));
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//icon
if (elementIcon) {
console.log('Passed: Level-On Target checkbox is present');
} else {
errors.push('Level-On Target checkbox was not found');
}
//text
if (elementText === 'Level-On Target') {
console.log('Passed: Level-On Target label text matched as expected');
} else {
errors.push(`Expected: "Level-On Target"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Level-On Target label font matched as expected');
} else {
errors.push(`Expected: Level-On Target label font "DM Serif Display, serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '13px') {
console.log('Passed: Level-On Target label text font-size matched as expected');
} else {
errors.push(`Expected: Level-On Target label text font-size "13px"; Actual: "${elementTextSize}"`);
}
//text color
if (elementTextColor === 'rgba(40, 39, 90, 1)') {
console.log('Passed: Level-On Target label text color matched as expected');
} else {
errors.push(`Expected: Level-On Target label text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Level_Challenging
{
description: 'Validate Level_Challenging text, size, and color',
action: async () => {
const multipleChecks = 'Level_Challenging checkbox';
const elementIcon = await driver.findElement(By.css('#inlineCheckbox11'));
const element = await driver.findElement(By.css('.checkbox-inline:nth-child(11)'));
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//icon
if (elementIcon) {
console.log('Passed: Level_Challenging checkbox is present');
} else {
errors.push('Level_Challenging checkbox was not found');
}
//text
if (elementText === 'Level_Challenging') {
console.log('Passed: Level_Challenging label text matched as expected');
} else {
errors.push(`Expected: "Level_Challenging"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Level_Challenging label font matched as expected');
} else {
errors.push(`Expected: Level_Challenging label font "DM Serif Display, serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '13px') {
console.log('Passed: Level_Challenging label text font-size matched as expected');
} else {
errors.push(`Expected: Level_Challenging label text font-size "13px"; Actual: "${elementTextSize}"`);
}
//text color
if (elementTextColor === 'rgba(40, 39, 90, 1)') {
console.log('Passed: Level_Challenging label text color matched as expected');
} else {
errors.push(`Expected: Level_Challenging label text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Level_On Target
{
description: 'Validate Level_On Target text, size, and color',
action: async () => {
const multipleChecks = 'Level_On Target checkbox';
const elementIcon = await driver.findElement(By.css('#inlineCheckbox12'));
const element = await driver.findElement(By.css('.checkbox-inline:nth-child(12)'));
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//icon
if (elementIcon) {
console.log('Passed: Level_On Target checkbox is present');
} else {
errors.push('Level_On Target checkbox was not found');
}
//text
if (elementText === 'Level_On Target') {
console.log('Passed: Level_On Target label text matched as expected');
} else {
errors.push(`Expected: "Level_On Target"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Level_On Target label font matched as expected');
} else {
errors.push(`Expected: Level_On Target label font "DM Serif Display, serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '13px') {
console.log('Passed: Level_On Target label text font-size matched as expected');
} else {
errors.push(`Expected: Level_On Target label text font-size "13px"; Actual: "${elementTextSize}"`);
}
//text color
if (elementTextColor === 'rgba(40, 39, 90, 1)') {
console.log('Passed: Level_On Target label text color matched as expected');
} else {
errors.push(`Expected: Level_On Target label text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Login Required
{
description: 'Validate Login Required text, size, and color',
action: async () => {
const multipleChecks = 'Login Required checkbox';
const elementIcon = await driver.findElement(By.css('#inlineCheckbox13'));
const element = await driver.findElement(By.css('.checkbox-inline:nth-child(13)'));
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//icon
if (elementIcon) {
console.log('Passed: Login Required checkbox is present');
} else {
errors.push('Login Required checkbox was not found');
}
//text
if (elementText === 'Login Required') {
console.log('Passed: Login Required label text matched as expected');
} else {
errors.push(`Expected: "Login Required"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Login Required label font matched as expected');
} else {
errors.push(`Expected: Login Required label font "DM Serif Display, serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '13px') {
console.log('Passed: Login Required label text font-size matched as expected');
} else {
errors.push(`Expected: Login Required label text font-size "13px"; Actual: "${elementTextSize}"`);
}
//text color
if (elementTextColor === 'rgba(40, 39, 90, 1)') {
console.log('Passed: Login Required label text color matched as expected');
} else {
errors.push(`Expected: Login Required label text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Printable
{
description: 'Validate Printable text, size, and color',
action: async () => {
const multipleChecks = 'Printable checkbox';
const elementIcon = await driver.findElement(By.css('#inlineCheckbox14'));
const element = await driver.findElement(By.css('.checkbox-inline:nth-child(14)'));
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//icon
if (elementIcon) {
console.log('Passed: Printable checkbox is present');
} else {
errors.push('Printable checkbox was not found');
}
//text
if (elementText === 'Printable') {
console.log('Passed: Printable label text matched as expected');
} else {
errors.push(`Expected: "Printable"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Printable label font matched as expected');
} else {
errors.push(`Expected: Printable label font "DM Serif Display, serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '13px') {
console.log('Passed: Printable label text font-size matched as expected');
} else {
errors.push(`Expected: Printable label text font-size "13px"; Actual: "${elementTextSize}"`);
}
//text color
if (elementTextColor === 'rgba(40, 39, 90, 1)') {
console.log('Passed: Printable label text color matched as expected');
} else {
errors.push(`Expected: Printable label text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Source
{
description: 'Validate Source text, size, and color',
action: async () => {
const multipleChecks = 'Source checkbox';
const elementIcon = await driver.findElement(By.css('#inlineCheckbox15'));
const element = await driver.findElement(By.css('.checkbox-inline:nth-child(15)'));
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//icon
if (elementIcon) {
console.log('Passed: Source checkbox is present');
} else {
errors.push('Source checkbox was not found');
}
//text
if (elementText === 'Source') {
console.log('Passed: Source label text matched as expected');
} else {
errors.push(`Expected: "Source"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Source label font matched as expected');
} else {
errors.push(`Expected: Source label font "DM Serif Display, serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '13px') {
console.log('Passed: Source label text font-size matched as expected');
} else {
errors.push(`Expected: Source label text font-size "13px"; Actual: "${elementTextSize}"`);
}
//text color
if (elementTextColor === 'rgba(40, 39, 90, 1)') {
console.log('Passed: Source label text color matched as expected');
} else {
errors.push(`Expected: Source label text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Subject(s)
{
description: 'Validate Subjects text, size, and color',
action: async () => {
const multipleChecks = 'Subject(s) checkbox';
const elementIcon = await driver.findElement(By.css('#inlineCheckbox16'));
const element = await driver.findElement(By.css('.checkbox-inline:nth-child(16)'));
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//icon
if (elementIcon) {
console.log('Passed: Subject(s) checkbox is present');
} else {
errors.push('Subject(s) checkbox was not found');
}
//text
if (elementText === 'Subject(s)') {
console.log('Passed: Subject(s) label text matched as expected');
} else {
errors.push(`Expected: "Subject(s)"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Subject(s) label font matched as expected');
} else {
errors.push(`Expected: Subject(s) label font "DM Serif Display, serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '13px') {
console.log('Passed: Subject(s) label text font-size matched as expected');
} else {
errors.push(`Expected: Subject(s) label text font-size "13px"; Actual: "${elementTextSize}"`);
}
//text color
if (elementTextColor === 'rgba(40, 39, 90, 1)') {
console.log('Passed: Subject(s) label text color matched as expected');
} else {
errors.push(`Expected: Subject(s) label text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Target Audience
{
description: 'Validate Target Audience text, size, and color',
action: async () => {
const multipleChecks = 'Target Audience checkbox';
const elementIcon = await driver.findElement(By.css('#inlineCheckbox17'));
const element = await driver.findElement(By.css('.checkbox-inline:nth-child(17)'));
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//icon
if (elementIcon) {
console.log('Passed: Target Audience checkbox is present');
} else {
errors.push('Target Audience checkbox was not found');
}
//text
if (elementText === 'Target Audience') {
console.log('Passed: Target Audience label text matched as expected');
} else {
errors.push(`Expected: "Target Audience"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Target Audience label font matched as expected');
} else {
errors.push(`Expected: Target Audience label font "DM Serif Display, serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '13px') {
console.log('Passed: Target Audience label text font-size matched as expected');
} else {
errors.push(`Expected: Target Audience label text font-size "13px"; Actual: "${elementTextSize}"`);
}
//text color
if (elementTextColor === 'rgba(40, 39, 90, 1)') {
console.log('Passed: Target Audience label text color matched as expected');
} else {
errors.push(`Expected: Target Audience label text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Terms of Use
{
description: 'Validate Terms of Use text, size, and color',
action: async () => {
const multipleChecks = 'Terms of Use checkbox';
const elementIcon = await driver.findElement(By.css('#inlineCheckbox18'));
const element = await driver.findElement(By.css('.checkbox-inline:nth-child(18)'));
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//icon
if (elementIcon) {
console.log('Passed: Terms of Use checkbox is present');
} else {
errors.push('Terms of Use checkbox was not found');
}
//text
if (elementText === 'Terms of Use') {
console.log('Passed: Terms of Use label text matched as expected');
} else {
errors.push(`Expected: "Terms of Use"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Terms of Use label font matched as expected');
} else {
errors.push(`Expected: Terms of Use label font "DM Serif Display, serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '13px') {
console.log('Passed: Terms of Use label text font-size matched as expected');
} else {
errors.push(`Expected: Terms of Use label text font-size "13px"; Actual: "${elementTextSize}"`);
}
//text color
if (elementTextColor === 'rgba(40, 39, 90, 1)') {
console.log('Passed: Terms of Use label text color matched as expected');
} else {
errors.push(`Expected: Terms of Use label text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Alignment Status
{
description: 'Validate Alignment Status text, size, and color',
action: async () => {
const multipleChecks = 'Alignment Status checkbox';
const elementIcon = await driver.findElement(By.css('#inlineCheckbox19'));
const element = await driver.findElement(By.css('.checkbox-inline:nth-child(19)'));
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//icon
if (elementIcon) {
console.log('Passed: Alignment Status checkbox is present');
} else {
errors.push('Alignment Status checkbox was not found');
}
//text
if (elementText === 'Alignment Status') {
console.log('Passed: Alignment Status label text matched as expected');
} else {
errors.push(`Expected: "Alignment Status"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Alignment Status label font matched as expected');
} else {
errors.push(`Expected: Alignment Status label font "DM Serif Display, serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '13px') {
console.log('Passed: Alignment Status label text font-size matched as expected');
} else {
errors.push(`Expected: Alignment Status label text font-size "13px"; Actual: "${elementTextSize}"`);
}
//text color
if (elementTextColor === 'rgba(40, 39, 90, 1)') {
console.log('Passed: Alignment Status label text color matched as expected');
} else {
errors.push(`Expected: Alignment Status label text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//# Of Concepts: header
{
description: 'Validate # Of Concepts header text, size, and color',
action: async () => {
const multipleChecks = '# Of Concepts: header';
const element = await driver.findElement(By.css('#suggest_form'));
//Get text, font, size, and color
//const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
const conceptsText = await driver.executeScript(`
const div = document.querySelector('#suggest_form');
if (!div) return 'not found';
//Get all text nodes and find the one containing "# of Concepts"
const childNodes = div.childNodes;
for (let node of childNodes) {
if (node.nodeType === 3 && node.textContent.includes('# of Concepts')) {
return node.textContent.trim();
}
}
return 'not found';
`);
//console.log('----->| DEBUG concepts text:', conceptsText);
//Track all errors
const errors = [];
// text
if (conceptsText.includes('# of Concepts')) {
console.log('Passed: # of Concepts header text matched as expected');
} else {
errors.push(`Expected text to contain: "# of Concepts"; Actual: "${conceptsText}"`);
}
//font-family
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: # Of Concepts: header font matched as expected');
} else {
errors.push(`Expected: # Of Concepts: header font "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '13px') {
console.log('Passed: # Of Concepts: header text font-size matched as expected');
} else {
errors.push(`Expected: # Of Concepts: header text font-size "13px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(40, 39, 90, 1)') {
console.log('Passed: # Of Concepts: header text color matched as expected');
} else {
errors.push(`Expected: # Of Concepts: header text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//# of Concepts: dropdown
{
description: 'Validate # of Concepts dropdown',
action: async () => {
const multipleChecks = '# of Concepts: List';
const elementDropdown = await driver.findElement(By.css('#conceptnum'));
const selectedOption = await elementDropdown.findElement(By.css('option:checked'));
const elementText = await selectedOption.getText();
const elementTextFont = await selectedOption.getCssValue('font-family');
const elementTextSize = await selectedOption.getCssValue('font-size');
const elementTextColor = await selectedOption.getCssValue('color');
const options = await elementDropdown.findElements(By.css('option'));
//Track all errors
const errors = [];
//text
if (elementText.includes('1')) {
console.log('Passed: # of Concepts: dropdown text matched as expected');
} else {
throw new Error(`Expected: # of Concepts: "1"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === "Poppins, sans-serif") {
console.log('Passed: # of Concepts: dropdown font matched as expected');
} else {
errors.push(`Expected: # of Concepts: dropdown font "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '13px') {
console.log('Passed: # of Concepts: dropdown font-size matched as expected');
} else {
errors.push(`Expected: # of Concepts: dropdown font-size "13px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(40, 39, 90, 1)') {
console.log('Passed: # of Concepts: dropdown color matched as expected');
} else {
errors.push(`Expected: # of Concepts: dropdown color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`);
}
const expected = [
'1',
'2',
'3',
'4',
'5',
'6',
'7',
'8',
'9',
'10'
];
const actual = [];
for (const opt of options) {
const text = (await opt.getText()).trim();
actual.push(text);
}
if (JSON.stringify(actual) === JSON.stringify(expected)) {
console.log('Passed: Content Set - Dropdown list matched as expected');
} else {
throw new Error(`Expected: Content Set - Dropdown list: ${JSON.stringify(expected)}, Actual: ${JSON.stringify(actual)}`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Subject Areas: header
{
description: 'Validate Subject Areas header text, size, and color',
action: async () => {
const multipleChecks = 'Subject Areas: header';
const element = await driver.findElement(By.css('#suggest_form'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//text
if (elementText.includes('Subject Areas:')) {
console.log('Passed: Subject Areas: header text matched as expected');
} else {
errors.push(`Expected: "Subject Areas:"; Actual: "${elementText}"`);
}
//font-family
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Subject Areas: header font matched as expected');
} else {
errors.push(`Expected: Subject Areas: header font "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '13px') {
console.log('Passed: Subject Areas: header text font-size matched as expected');
} else {
errors.push(`Expected: Subject Areas: header text font-size "13px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(40, 39, 90, 1)') {
console.log('Passed: Subject Areas: header text color matched as expected');
} else {
errors.push(`Expected: Subject Areas: header text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Subject Areas: dropdown
{
description: 'Validate Subject Areas dropdown',
action: async () => {
const multipleChecks = 'Subject Areas: List';
const elementDropdown = await driver.findElement(By.css('#concept_subjects'));
const elementText = await elementDropdown.getText();
const elementTextFont = await elementDropdown.getCssValue('font-family');
const elementTextSize = await elementDropdown.getCssValue('font-size');
const elementTextColor = await elementDropdown.getCssValue('color');
const options = await elementDropdown.findElements(By.css('option'));
//Track all errors
const errors = [];
//font-family
if (elementTextFont === "Poppins, sans-serif") {
console.log('Passed: Subject Areas: dropdown font matched as expected');
} else {
errors.push(`Expected: Subject Areas: dropdown font "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//font size
if (elementTextSize === '16px') {
console.log('Passed: Subject Areas: dropdown font-size matched as expected');
} else {
errors.push(`Expected: Subject Areas: dropdown font-size "16px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(73, 80, 87, 1)') {
console.log('Passed: Subject Areas: dropdown color matched as expected');
} else {
errors.push(`Expected: Subject Areas: dropdown color: "rgba(73, 80, 87, 1)"; Actual: "${elementTextColor}"`);
}
const expected = [
'Health and PE',
'Language Arts',
'Mathematics',
'Science',
'Social Studies',
'Technology Education'
];
const actual = [];
for (const opt of options) {
const text = (await opt.getText()).trim();
actual.push(text);
}
if (JSON.stringify(actual) === JSON.stringify(expected)) {
console.log('Passed: Subject Areas - Dropdown list matched as expected');
} else {
throw new Error(`Expected: Subject Areas - Dropdown list: ${JSON.stringify(expected)}, Actual: ${JSON.stringify(actual)}`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Suggest Concepts button
{
description: 'Validate Suggest Concepts button',
action: async () => {
const multipleChecks = 'Suggest Concepts button';
const elementIcon = await driver.findElement(By.css('.glyphicon-tags'));
const element = await driver.findElement(By.css('.btn:nth-child(9)'));
//Get text, font, color, and size
const elementText = await element.getText('');
const elementFont = await element.getCssValue('font-family');
const elementSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
const elementButtonColor = await element.getCssValue('background-color');
//Track all errors
const errors = [];
//icon
if (elementIcon) {
console.log('Passed: Suggest Concepts icon is present');
} else {
errors.push('Suggest Concepts icon was not found');
}
//text
if (elementText === 'Suggest Concepts') {
console.log('Passed: Suggest Concepts button text matched as expected');
} else {
errors.push(`Expected: Button text: "Suggest Concepts"; Actual: "${elementText}"`);
}
//font-family
if (elementFont === "Poppins, sans-serif") {
console.log('Passed: Suggest Concepts button text font matched as expected');
} else {
errors.push(`Expected: Suggest Concepts button text font "Poppins, sans-serif"; Actual: ${elementFont}`);
}
//font size
if (elementSize === '16px') {
console.log('Passed: Suggest Concepts button text font-size matched as expected');
} else {
errors.push(`Expected: v button text font-size "16px"; Actual: "${elementSize}"`);
}
//text color
if (elementTextColor === 'rgba(255, 255, 255, 1)') {
console.log('Passed: Suggest Concepts button text color matched as expected');
} else {
errors.push(`Expected: Suggest Concepts button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`);
}
//button color
if (elementButtonColor === 'rgba(48, 200, 172, 1)') {
console.log('Passed: Suggest Concepts button background color matched as expected');
} else {
errors.push(`Expected: Suggest Concepts button background color: "rgba(48, 200, 172, 1)"; Actual: "${elementButtonColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//NEXT ACTION
{
description: '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', 'editItem');
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', 'editItem');
if (fs.existsSync(screenshotDir)) {
fs.rmSync(screenshotDir, { recursive: true, force: true });
}
fs.mkdirSync(screenshotDir, { recursive: true });
//Remove old Excel file
if (fs.existsSync('editItemResults.xlsx')) {
fs.unlinkSync('editItemResults.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 - Edit Item (ExACT_editItem); All test steps completed successfully');
testStatus = 'Passed';
} else {
console.log('------------->| THE END |<-------------');
console.log('FAILED: CONTENT - Edit Item (ExACT_editItem); One or more test steps failed');
console.log('FAILED STEPS:');
failedSteps.forEach(step => console.error(` ✗ ${step}`));
testStatus = 'Failed';
}
//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, 'editItemResults.xlsx');
} finally {
await driver.quit();
}
})();
}
export default ExACT_editItem;