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

8413 lines
339 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';
import e from 'express';
//Export JUST the steps so other scripts can import them
export const myStandardsSearch_AlignedContent = (driver) => [
{
description: 'Log Aligned Content start',
action: async () => {
console.log('------------->| MY STANDARDS - ALIGNED CONTENT |<-------------');
}
},
//Search breadcrumb
{
description: 'Validate Search breadcrumb link text, font, size, and color',
action: async () => {
const multipleChecks = 'Search breadcrumb link';
const element = await driver.findElement(By.linkText('Search'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementFont = await element.getCssValue('font-family');
const elementSize = await element.getCssValue('font-size');
const elementColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//text
if (elementText === 'Search') {
console.log("Passed: Search breadcrumb text link matched as expected");
} else {
errors.push(`Expected: "Search" breadcrumb text link; Actual: "${elementText}"`);
}
//font
if (elementFont === 'Poppins, sans-serif') {
console.log('Passed: Search breadcrumb text link font-family matched as expected');
} else {
errors.push(`Expected: Search breadcrumb text link font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
}
//size
if (elementSize === '13px') {
console.log('Passed: Search breadcrumb text link font-size matched as expected');
} else {
errors.push(`Expected: Search breadcrumb text link font-size "13px"; Actual: "${elementSize}"`);
}
//color
if (elementColor === 'rgba(73, 80, 87, 1)') {
console.log('Passed: Search breadcrumb text link color matched as expected');
} else {
errors.push(`Expected: Search breadcrumb text link color "rgba(73, 80, 87, 1)"; Actual: "${elementColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Standards breadcrumb
{
description: 'Validate Standards breadcrumb link text, font, size, and color',
action: async () => {
const multipleChecks = 'Standards breadcrum';
const element = await driver.findElement(By.css('.breadcrumb-item:nth-child(2)'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementFont = await element.getCssValue('font-family');
const elementSize = await element.getCssValue('font-size');
const elementColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//text
if (elementText === 'Standards') {
console.log("Passed: Standards breadcrumb text link matched as expected");
} else {
errors.push(`Expected: "Standards" breadcrumb text link; Actual: "${elementText}"`);
}
//font
if (elementFont === 'Poppins, sans-serif') {
console.log('Passed: Standards breadcrumb text link font-family matched as expected');
} else {
errors.push(`Expected: Standards breadcrumb text link font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
}
//size
if (elementSize === '13px') {
console.log('Passed: Standards breadcrumb text link font-size matched as expected');
} else {
errors.push(`Expected: Standards breadcrumb text link font-size "13px"; Actual: "${elementSize}"`);
}
//color
if (elementColor === 'rgba(48, 200, 172, 1)') {
console.log('Passed: Standards breadcrumb text link color matched as expected');
} else {
errors.push(`Expected: Standards breadcrumb text link color "rgba(48, 200, 172, 1)"; Actual: "${elementColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Save icon
{
description: 'Validate Save icon',
action: async () => {
const multipleChecks = 'Save icon';
const element = await driver.findElement(By.css('body > div.container.body > div > div.right_col > div > div.float-right.ml-1 > a:nth-child(1)'));
const elementText = await element.getAttribute('title');
//Track all errors
const errors = [];
//icon
if (element) {
console.log('Passed: Save icon present');
} else {
errors.push('Save icon was not found');
}
//text
if (elementText === 'Save This Search') {
console.log('Passed: Save icon tool-tip matched as expected');
} else {
errors.push(`Expected: Save icon tool-tip: "Save This Search"; Actual: "${elementText}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Print icon
{
description: 'Validate Print icon',
action: async () => {
const multipleChecks = 'Print icon';
const element = await driver.findElement(By.css('.icon-link > img'));
//Get text, font, size, and color
const elementText = await element.getAttribute('title');
//Track all errors
const errors = [];
//icon
if (element) {
console.log('Passed: Print icon present');
} else {
errors.push('Print icon was not found');
}
//text
if (elementText === 'Print This Page') {
console.log('Passed: Print icon tool-tip matched as expected');
} else {
errors.push(`Expected: Print icon tool-tip: "Print This Page"; Actual: "${elementText}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Standard Set title
{
description: 'Validate Standard Set title text, font, size, and color',
action: async () => {
const multipleChecks = 'Standard Set title';
const element = await driver.findElement(By.css('h1'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementFont = await element.getCssValue('font-family');
const elementSize = await element.getCssValue('font-size');
const elementColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//text
if (elementText === 'Alabama Courses of Study') {
console.log("Passed: Alabama Courses of Study Standard Set title text link matched as expected");
} else {
errors.push(`Expected: "Alabama Courses of Study" Standard Set title text link; Actual: "${elementText}"`);
}
//font
if (elementFont === 'Poppins, sans-serif') {
console.log('Passed: Alabama Courses of Study Standard Set title text link font-family matched as expected');
} else {
errors.push(`Expected: Alabama Courses of Study Standard Set title text link font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
}
//size
if (elementSize === '18.2px') {
console.log('Passed: Alabama Courses of Study Standard Set title text link font-size matched as expected');
} else {
errors.push(`Expected: Alabama Courses of Study Standard Set title text link font-size "18.2px"; Actual: "${elementSize}"`);
}
//color
if (elementColor === 'rgba(40, 39, 90, 1)') {
console.log('Passed: Alabama Courses of Study Standard Set title text link color matched as expected');
} else {
errors.push(`Expected: Alabama Courses of Study Standard Set title text link color "rgba(40, 39, 90, 1)"; Actual: "${elementColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//SubjectGrade title
{
description: 'Validate SubjectGrade title text, font, size, and color',
action: async () => {
const multipleChecks = 'SubjectGrade title';
const element = await driver.findElement(By.css('strong'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementFont = await element.getCssValue('font-family');
const elementSize = await element.getCssValue('font-size');
const elementColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//text
if (elementText === 'Mathematics - Grade 9') {
console.log("Passed: Mathematics - Grade 9 SubjectGrade title text link matched as expected");
} else {
errors.push(`Expected: "Mathematics - Grade 9" SubjectGrade title text link; Actual: "${elementText}"`);
}
//font
if (elementFont === 'Poppins, sans-serif') {
console.log('Passed: Mathematics - Grade 9 SubjectGrade title text link font-family matched as expected');
} else {
errors.push(`Expected: Mathematics - Grade 9 SubjectGrade title text link font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
}
//size
if (elementSize === '13px') {
console.log('Passed: Mathematics - Grade 9 SubjectGrade title text link font-size matched as expected');
} else {
errors.push(`Expected: Mathematics - Grade 9 SubjectGrade title text link font-size "13px"; Actual: "${elementSize}"`);
}
//color
if (elementColor === 'rgba(40, 39, 90, 1)') {
console.log('Passed: Mathematics - Grade 9 SubjectGrade title text link color matched as expected');
} else {
errors.push(`Expected: Mathematics - Grade 9 SubjectGrade title text link color "rgba(40, 39, 90, 1)"; Actual: "${elementColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Info icon
{
description: 'Validate Info icon',
action: async () => {
const multipleChecks = 'Info icon';
const element = await driver.findElement(By.css('body > div.container.body > div > div.right_col > div > div:nth-child(5) > a'));
//Get text, font, size, and color
const elementText = await element.getAttribute('title');
//Track all errors
const errors = [];
//icon
if (element) {
console.log('Passed: Info icon present');
} else {
errors.push('Info icon was not found');
}
//text
if (elementText === 'Alignment Modification Help') {
console.log('Passed: Info icon tool-tip matched as expected');
} else {
errors.push(`Expected: Info icon tool-tip: "Alignment Modification Help"; Actual: "${elementText}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Show All Correlations button
{
description: 'Validate Show All Correlations button text, size, and color',
action: async () => {
const multipleChecks = 'Show All Correlations button';
const element = await driver.findElement(By.css('.btn-primary:nth-child(2)'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
const elementButtonColor = await element.getCssValue('background-color');
//Track all errors
const errors = [];
//text
if (elementText === 'Show All Correlations') {
console.log('Passed: Show All Correlations button text matched as expected');
} else {
errors.push(`Expected: "Show All Correlations"; Actual: "${elementText}"`);
}
//font
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Show All Correlations button text font-family matched as expected');
} else {
errors.push(`Expected: Show All Correlations button text font-family "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//size
if (elementTextSize === '14px') {
console.log('Passed: Show All Correlations button text font-size matched as expected');
} else {
errors.push(`Expected: Show All Correlations button text font-size "14px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(255, 255, 255, 1)') {
console.log('Passed: Show All Correlations button text color matched as expected');
} else {
errors.push(`Expected: Show All Correlations button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`);
}
//button color
if (elementButtonColor === 'rgba(48, 200, 172, 1)') {
console.log('Passed: Show All Correlations button background color matched as expected');
} else {
errors.push(`Expected: Show All Correlations button background color: "rgba(48, 200, 172, 1)"; Actual: "${elementButtonColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Level 1 Standard title
{
description: 'Validate Level 1 Standard title text, font, size, color, and background color',
action: async () => {
const multipleChecks = 'Level 1 Standard title';
const element = await driver.findElement(By.css('.card:nth-child(8) > .card-header'));
//Get text, font, size, color, and background color
const elementText = await element.getText();
const elementFont = await element.getCssValue('font-family');
const elementSize = await element.getCssValue('font-size');
const elementColor = await element.getCssValue('color');
const elementBgColor = await element.getCssValue('background-color')
//Track all errors
const errors = [];
//text
if (elementText === 'Mathematical Practices (Grade 9)') {
console.log("Passed: Mathematical Practices (Grade 9) Level 1 Standard title text matched as expected");
} else {
errors.push(`Expected: "Mathematical Practices (Grade 9)" Level 1 Standard title text; Actual: "${elementText}"`);
}
//font
if (elementFont === 'Poppins, sans-serif') {
console.log('Passed: Mathematical Practices (Grade 9) Level 1 Standard title text font-family matched as expected');
} else {
errors.push(`Expected: Mathematical Practices (Grade 9) Level 1 Standard title text font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
}
//size
if (elementSize === '15px') {
console.log('Passed: Mathematical Practices (Grade 9) Level 1 Standard title text font-size matched as expected');
} else {
errors.push(`Expected: Mathematical Practices (Grade 9) Level 1 Standard title text font-size "15px"; Actual: "${elementSize}"`);
}
//color
if (elementColor === 'rgba(255, 255, 255, 1)') {
console.log('Passed: Mathematical Practices (Grade 9) Level 1 Standard title text color matched as expected');
} else {
errors.push(`Expected: Mathematical Practices (Grade 9) Level 1 Standard title text color "rgba(255, 255, 255, 1)"; Actual: "${elementColor}"`);
}
//background-color
if (elementBgColor === 'rgba(48, 200, 172, 1)') {
console.log('Passed: Mathematical Practices (Grade 9) Level 1 Standard title background color matched as expected');
} else {
errors.push(`Expected: Mathematical Practices (Grade 9) Level 1 Standard title background color "rgba(48, 200, 172, 1)"; Actual: "${elementBgColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Standard Code 1 title
{
description: 'Validate Standard Code 1, title text, font, size, and color',
action: async () => {
const multipleChecks = 'Standard Code 1, title';
const element = await driver.findElement(By.xpath('//div[2]/div/b'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementFont = await element.getCssValue('font-family');
const elementSize = await element.getCssValue('font-size');
const elementColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//text
if (elementText === 'MP1') {
console.log("Passed: Standard Code 1, title text matched as expected");
} else {
errors.push(`Expected: "MP1" Standard Code 1, title text; Actual: "${elementText}"`);
}
//font
if (elementFont === 'Poppins, sans-serif') {
console.log('Passed: Standard Code 1, title text font-family matched as expected');
} else {
errors.push(`Expected: Standard Code 1, title text font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
}
//size
if (elementSize === '13px') {
console.log('Passed: Standard Code 1, title text font-size matched as expected');
} else {
errors.push(`Expected: Standard Code 1, title text font-size "13px"; Actual: "${elementSize}"`);
}
//color
if (elementColor === 'rgba(40, 39, 90, 1)') {
console.log('Passed: Standard Code 1, title text color matched as expected');
} else {
errors.push(`Expected: Standard Code 1, title text color "rgba(40, 39, 90, 1)"; Actual: "${elementColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Standard Code 1 Description
{
description: 'Validate Standard Code 1, description text, font, size, and color',
action: async () => {
const multipleChecks = 'Standard Code 1, description';
const element = await driver.findElement(By.id('stdbox'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementFont = await element.getCssValue('font-family');
const elementSize = await element.getCssValue('font-size');
const elementColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//text
if (elementText.includes ('Make sense of problems and persevere in solving them. (Grade 9)')) {
console.log("Passed: Standard Code 1, description text matched as expected");
} else {
errors.push(`Expected: "Make sense of problems and persevere in solving them. (Grade 9)" Standard Code 1, description text; Actual: "${elementText}"`);
}
//font
if (elementFont === 'Poppins, sans-serif') {
console.log('Passed: Standard Code 1, description text font-family matched as expected');
} else {
errors.push(`Expected: Standard Code 1, description text font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
}
//size
if (elementSize === '13px') {
console.log('Passed: Standard Code 1, description text font-size matched as expected');
} else {
errors.push(`Expected: Standard Code 1, description text font-size "13px"; Actual: "${elementSize}"`);
}
//color
if (elementColor === 'rgba(40, 39, 90, 1)') {
console.log('Passed: Standard Code 1, description text color matched as expected');
} else {
errors.push(`Expected: Standard Code 1, description text color "rgba(40, 39, 90, 1)"; Actual: "${elementColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Standard Code 1 Tools button
{
description: 'Validate Standard Code 1, Tools button text, size, and color',
action: async () => {
const multipleChecks = 'Standard Code 1, Tools button';
const elementIcon = await driver.findElement(By.xpath(`//div[@id='stdbox']/div/div/button/i`));
const element = await driver.findElement(By.css('#stdbox > div.pull-right > div > button'));
const elementExpandIcon = await driver.findElement(By.xpath(`(//button[@type='button'])[4]`));
//Get text, font, size, and color
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
const elementButtonColor = await element.getCssValue('background-color');
//Track all errors
const errors = [];
//icon
if (elementIcon) {
console.log('Passed: Standard Code 1, tools button icon found')
} else {
errors.push('FAILED: Standard Code 1 tools button icon not found')
}
//text
if (elementText === 'Tools') {
console.log('Passed: Standard Code 1, Tools button text matched as expected');
} else {
errors.push(`Expected: Standard Code 1, "Tools"; Actual: "${elementText}"`);
}
//font
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Standard Code 1, Tools button text font-family matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Tools button text font-family "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//size
if (elementTextSize === '16px') {
console.log('Passed: Standard Code 1, Tools button text font-size matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Tools button text font-size "16px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(255, 255, 255, 1)') {
console.log('Passed: Standard Code 1, Tools button text color matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Tools button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`);
}
//button color
if (elementButtonColor === 'rgba(48, 200, 172, 1)') {
console.log('Passed: Standard Code 1, Tools button background color matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Tools button background color: "rgba(48, 200, 172, 1)"; Actual: "${elementButtonColor}"`);
}
//expand icon
if (elementExpandIcon) {
console.log('Passed: Standard Code 1, Tools expand button icon found')
} else {
errors.push('FAILED: Standard Code 1, Tools expand button icon not found')
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Standard Code 1 Aligned Content button
{
description: 'Validate Standard Code 1, Aligned Content 8 button text, size, and color',
action: async () => {
const multipleChecks = 'Standard Code 1, Aligned Content 8 button';
const element = await driver.findElement(By.id('corr-1439152630-tab'));
const elementExpandIcon = await driver.findElement(By.id('colstate1439152630'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
const elementButtonColor = await element.getCssValue('background-color');
//Track all errors
const errors = [];
//text
if (elementText === 'Aligned Content 8') {
console.log('Passed: Standard Code 1, Aligned Content 8 button text matched as expected');
} else {
errors.push(`Expected: "Aligned Content 8"; Actual: "${elementText}"`);
}
//font
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Standard Code 1, Aligned Content 8 button text font-family matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Aligned Content 8 button text font-family "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//size
if (elementTextSize === '15px') {
console.log('Passed: Standard Code 1, Aligned Content 8 button text font-size matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Aligned Content 8 button text font-size "15px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(255, 255, 255, 1)') {
console.log('Passed: Standard Code 1, Aligned Content 8 button text color matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Aligned Content 8 button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`);
}
//button color
if (elementButtonColor === 'rgba(40, 39, 90, 1)') {
console.log('Passed: Standard Code 1, Aligned Content 8 button background color matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Aligned Content 8 button background color: "rgba(40, 39, 90, 1)"; Actual: "${elementButtonColor}"`);
}
//expand icon
if (elementExpandIcon) {
console.log('Passed: Standard Code 1, Aligned Content 8 expand button icon found')
} else {
errors.push('FAILED: Standard Code 1, Aligned Content 8 expand button icon not found')
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Standard Code 1 Related Standards button
{
description: 'Validate Standard Code 1, Related Standards 26 button text, size, and color',
action: async () => {
const multipleChecks = 'Standard Code 1, Related Standards 26 button';
const element = await driver.findElement(By.css('#rel-1439152630-tab'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
const elementButtonColor = await element.getCssValue('background-color');
//Track all errors
const errors = [];
//text
if (elementText === 'Related Standards 26') {
console.log('Passed: Standard Code 1, Related Standards 26 button text matched as expected');
} else {
errors.push(`Expected: "Related Standards 26"; Actual: "${elementText}"`);
}
//font
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Standard Code 1, Related Standards 26 button text font-family matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Related Standards 26 button text font-family "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//size
if (elementTextSize === '15px') {
console.log('Passed: Standard Code 1, Related Standards 26 button text font-size matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Related Standards 26 button text font-size "15px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(182, 186, 181, 1)') {
console.log('Passed: Standard Code 1, Related Standards 26 button text color matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Related Standards 26 button text color: "rgba(182, 186, 181, 1)"; Actual: "${elementTextColor}"`);
}
//button color
if (elementButtonColor === 'rgba(0, 0, 0, 0)') {
console.log('Passed: Standard Code 1, Related Standards 26 button background color matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Related Standards 26 button background color: "rgba(0, 0, 0, 0)"; Actual: "${elementButtonColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Standard Code 1 Add Direct Alignment button
{
description: 'Validate Standard Code 1, Add Direct Alignment button text, size, and color',
action: async () => {
const multipleChecks = 'Standard Code 1, Add Direct Alignment button';
const elementIcon = await driver.findElement(By.css('#add-1439152630-tab > .fa'));
const element = await driver.findElement(By.css('#add-1439152630-tab'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
const elementButtonColor = await element.getCssValue('background-color');
//Track all errors
const errors = [];
//icon
if (elementIcon) {
console.log('Passed: Standard Code 1, Add Direct Alignment button icon found')
} else {
errors.push('FAILED: Standard Code 1, Add Direct Alignment button icon not found')
}
//text
if (elementText === 'Add Direct Alignment') {
console.log('Passed: Standard Code 1, Add Direct Alignment button text matched as expected');
} else {
errors.push(`Expected: "Add Direct Alignment"; Actual: "${elementText}"`);
}
//font
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Standard Code 1, Add Direct Alignment button text font-family matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Add Direct Alignment button text font-family "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//size
if (elementTextSize === '15px') {
console.log('Passed: Standard Code 1, Add Direct Alignment button text font-size matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Add Direct Alignment button text font-size "15px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(182, 186, 181, 1)') {
console.log('Passed: Standard Code 1, Add Direct Alignment button text color matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Add Direct Alignment button text color: "rgba(182, 186, 181, 1)"; Actual: "${elementTextColor}"`);
}
//button color
if (elementButtonColor === 'rgba(0, 0, 0, 0)') {
console.log('Passed: Standard Code 1, Add Direct Alignment button background color matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Add Direct Alignment button background color: "rgba(0, 0, 0, 0)"; Actual: "${elementButtonColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//NEXT ACTION
{
description: 'Click to expand Aligned Content for Standard Code 1',
action: async () => {
//Standard Code 1 Aligned Content
await driver.findElement(By.id('corr-1439152630-tab')).click();
console.log('----->| NEXT ACTION: Clicked Standard Code 1 Aligned Content button');
//Wait until the element exists in the DOM
const openAlignmentNewWindow = await driver.wait(
until.elementLocated(By.css('#opennew1439152630')),
30000
);
//Wait until it becomes visible
await driver.wait(
until.elementIsVisible(openAlignmentNewWindow),
30000
);
}
},
//Standard Code 1 Open Alignments in New Window button
{
description: 'Validate Standard Code 1, Open Alignments in New Window button text, size, and color',
action: async () => {
const multipleChecks = 'Standard Code 1 Open Alignments in New Window button';
const elementIcon = await driver.findElement(By.css('.fa-external-link'));
const element = await driver.findElement(By.css('#opennew1439152630'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
const elementButtonColor = await element.getCssValue('background-color');
//Track all errors
const errors = [];
//icon
if (elementIcon) {
console.log('Passed: Standard Code 1, Open Alignments in New Window button icon found')
} else {
errors.push('FAILED: Standard Code 1, Open Alignments in New Window button icon not found')
}
//text
if (elementText === 'Open Alignments in New Window') {
console.log('Passed: Standard Code 1, Open Alignments in New Window button text matched as expected');
} else {
errors.push(`Expected: Standard Code 1, "Open Alignments in New Window"; Actual: "${elementText}"`);
}
//font
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Standard Code 1, Open Alignments in New Window button text font-family matched as expected');
} else {
errors.push(`Expected: Standard Code 1, "Open Alignments in New Window" button text font-family "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//size
if (elementTextSize === '14px') {
console.log('Passed: Standard Code 1, Open Alignments in New Window button text font-size matched as expected');
} else {
errors.push(`Expected: Standard Code 1, "Open Alignments in New Window" button text font-size "14px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(255, 255, 255, 1)') {
console.log('Passed: Standard Code 1, Open Alignments in New Window button text color matched as expected');
} else {
errors.push(`Expected: Standard Code 1, "Open Alignments in New Window" button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`);
}
//button color
if (elementButtonColor === 'rgba(48, 200, 172, 1)') {
console.log('Passed: Standard Code 1, Open Alignments in New Window button background color matched as expected');
} else {
errors.push(`Expected: Standard Code 1, "Open Alignments in New Window" button background color: "rgba(48, 200, 172, 1)"; Actual: "${elementButtonColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Standard Code 1 Subject column header
{
description: 'Validate Standard Code 1, Subject column header text, font, size, color, and background color',
action: async () => {
const multipleChecks = 'Standard Code 1 Subject column header';
const element = await driver.findElement(By.css('td > b'));
//Get text, font, size, color, and background color
const elementText = await element.getText();
const elementFont = await element.getCssValue('font-family');
const elementSize = await element.getCssValue('font-size');
const elementColor = await element.getCssValue('color');
const elementBgColor = await element.getCssValue('background-color');
//Track all errors
const errors = [];
//text
if (elementText === ('Algebra')) {
console.log("Passed: Standard Code 1, Subject column header text matched as expected");
} else {
errors.push(`Expected: Standard Code 1, Subject column header "Algebra" text; Actual: "${elementText}"`);
}
//font
if (elementFont === 'Poppins, sans-serif') {
console.log('Passed: Standard Code 1, Subject column header text font-family matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Subject column header text font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
}
//size
if (elementSize === '14.3px') {
console.log('Passed: Standard Code 1, Subject column header text font-size matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Subject column header text font-size "14.3px"; Actual: "${elementSize}"`);
}
//color
if (elementColor === 'rgba(33, 37, 41, 1)') {
console.log('Passed: Standard Code 1, Subject column header text color matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Subject column header text color "rgba(33, 37, 41, 1)"; Actual: "${elementColor}"`);
}
//background color
if (elementBgColor === 'rgba(0, 0, 0, 0)') {
console.log('Passed: Standard Code 1, Subject column header text background color matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Subject column header text background color "rgba(0, 0, 0, 0)"; Actual: "${elementBgColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Standard Code 1, K column header
{
description: 'Validate Standard Code 1, K column header text, font, size, color, and background color',
action: async () => {
const multipleChecks = 'Standard Code 1, K column header';
const element = await driver.findElement(By.css('.text-center:nth-child(2)'));
//Get text, font, size, color, and background color
const elementText = await element.getText();
const elementFont = await element.getCssValue('font-family');
const elementSize = await element.getCssValue('font-size');
const elementColor = await element.getCssValue('color');
const elementBgColor = await element.getCssValue('background-color');
//Track all errors
const errors = [];
//text
if (elementText === ('K')) {
console.log("Passed: Standard Code 1, K column header text matched as expected");
} else {
errors.push(`Expected: Standard Code 1, K column header "K" text; Actual: "${elementText}"`);
}
//font
if (elementFont === 'Poppins, sans-serif') {
console.log('Passed: Standard Code 1, K column header text font-family matched as expected');
} else {
errors.push(`Expected: Standard Code 1, K column header text font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
}
//size
if (elementSize === '14.3px') {
console.log('Passed: Standard Code 1, K column header text font-size matched as expected');
} else {
errors.push(`Expected: Standard Code 1, K column header text font-size "14.3px"; Actual: "${elementSize}"`);
}
//color
if (elementColor === 'rgba(33, 37, 41, 1)') {
console.log('Passed: Standard Code 1, K column header text color matched as expected');
} else {
errors.push(`Expected: Standard Code 1, K column header text color "rgba(33, 37, 41, 1)"; Actual: "${elementColor}"`);
}
//background color
if (elementBgColor === 'rgba(0, 0, 0, 0)') {
console.log('Passed: Standard Code 1, K column header text background color matched as expected');
} else {
errors.push(`Expected: Standard Code 1, K column header text background color "rgba(0, 0, 0, 0)"; Actual: "${elementBgColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Standard Code 1, 1 column header
{
description: 'Validate Standard Code 1, 1 column header text, font, size, color, and background color',
action: async () => {
const multipleChecks = 'Standard Code 1, 1 column header';
const element = await driver.findElement(By.css('.text-center:nth-child(3)'));
//Get text, font, size, color, and background color
const elementText = await element.getText();
const elementFont = await element.getCssValue('font-family');
const elementSize = await element.getCssValue('font-size');
const elementColor = await element.getCssValue('color');
const elementBgColor = await element.getCssValue('background-color');
//Track all errors
const errors = [];
//text
if (elementText === ('1')) {
console.log("Passed: Standard Code 1, 1 column header text matched as expected");
} else {
errors.push(`Expected: Standard Code 1, 1 column header "1" text; Actual: "${elementText}"`);
}
//font
if (elementFont === 'Poppins, sans-serif') {
console.log('Passed: Standard Code 1, 1 column header text font-family matched as expected');
} else {
errors.push(`Expected: Standard Code 1, 1 column header text font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
}
//size
if (elementSize === '14.3px') {
console.log('Passed: Standard Code 1, 1 column header text font-size matched as expected');
} else {
errors.push(`Expected: Standard Code 1, 1 column header text font-size "14.3px"; Actual: "${elementSize}"`);
}
//color
if (elementColor === 'rgba(33, 37, 41, 1)') {
console.log('Passed: Standard Code 1, 1 column header text color matched as expected');
} else {
errors.push(`Expected: Standard Code 1, 1 column header text color "rgba(33, 37, 41, 1)"; Actual: "${elementColor}"`);
}
//background color
if (elementBgColor === 'rgba(0, 0, 0, 0)') {
console.log('Passed: Standard Code 1, 1 column header text background color matched as expected');
} else {
errors.push(`Expected: Standard Code 1, 1 column header text background color "rgba(0, 0, 0, 0)"; Actual: "${elementBgColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Standard Code 1, 2 column header
{
description: 'Validate Standard Code 1, 2 column header text, font, size, color, and background color',
action: async () => {
const multipleChecks = 'Standard Code 1, 2 column header';
const element = await driver.findElement(By.css('.text-center:nth-child(4)'));
//Get text, font, size, color, and background color
const elementText = await element.getText();
const elementFont = await element.getCssValue('font-family');
const elementSize = await element.getCssValue('font-size');
const elementColor = await element.getCssValue('color');
const elementBgColor = await element.getCssValue('background-color');
//Track all errors
const errors = [];
//text
if (elementText === ('2')) {
console.log("Passed: Standard Code 1, 2 column header text matched as expected");
} else {
errors.push(`Expected: Standard Code 1, 2 column header "2" text; Actual: "${elementText}"`);
}
//font
if (elementFont === 'Poppins, sans-serif') {
console.log('Passed: Standard Code 1, 2 column header text font-family matched as expected');
} else {
errors.push(`Expected: Standard Code 1, 2 column header text font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
}
//size
if (elementSize === '14.3px') {
console.log('Passed: Standard Code 1, 2 column header text font-size matched as expected');
} else {
errors.push(`Expected: Standard Code 1, 2 column header text font-size "14.3px"; Actual: "${elementSize}"`);
}
//color
if (elementColor === 'rgba(33, 37, 41, 1)') {
console.log('Passed: Standard Code 1, 2 column header text color matched as expected');
} else {
errors.push(`Expected: Standard Code 1, 2 column header text color "rgba(33, 37, 41, 1)"; Actual: "${elementColor}"`);
}
//background color
if (elementBgColor === 'rgba(0, 0, 0, 0)') {
console.log('Passed: Standard Code 1, 2 column header text background color matched as expected');
} else {
errors.push(`Expected: Standard Code 1, 2 column header text background color "rgba(0, 0, 0, 0)"; Actual: "${elementBgColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Standard Code 1, 3 column header
{
description: 'Validate Standard Code 1, 3 column header text, font, size, color, and background color',
action: async () => {
const multipleChecks = 'Standard Code 1, 3 column header';
const element = await driver.findElement(By.css('tr:nth-child(1) > .text-center:nth-child(5)'));
//Get text, font, size, color, and background color
const elementText = await element.getText();
const elementFont = await element.getCssValue('font-family');
const elementSize = await element.getCssValue('font-size');
const elementColor = await element.getCssValue('color');
const elementBgColor = await element.getCssValue('background-color');
//Track all errors
const errors = [];
//text
if (elementText === ('3')) {
console.log("Passed: Standard Code 1, 3 column header text matched as expected");
} else {
errors.push(`Expected: Standard Code 1, 3 column header "3" text; Actual: "${elementText}"`);
}
//font
if (elementFont === 'Poppins, sans-serif') {
console.log('Passed: Standard Code 1, 3 column header text font-family matched as expected');
} else {
errors.push(`Expected: Standard Code 1, 3 column header text font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
}
//size
if (elementSize === '14.3px') {
console.log('Passed: Standard Code 1, 3 column header text font-size matched as expected');
} else {
errors.push(`Expected: Standard Code 1, 3 column header text font-size "14.3px"; Actual: "${elementSize}"`);
}
//color
if (elementColor === 'rgba(33, 37, 41, 1)') {
console.log('Passed: Standard Code 1, 3 column header text color matched as expected');
} else {
errors.push(`Expected: Standard Code 1, 3 column header text color "rgba(33, 37, 41, 1)"; Actual: "${elementColor}"`);
}
//background color
if (elementBgColor === 'rgba(0, 0, 0, 0)') {
console.log('Passed: Standard Code 1, 3 column header text background color matched as expected');
} else {
errors.push(`Expected: Standard Code 1, 3 column header text background color "rgba(0, 0, 0, 0)"; Actual: "${elementBgColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Standard Code 1, 4 column header
{
description: 'Validate Standard Code 1, 4 column header text, font, size, color, and background color',
action: async () => {
const multipleChecks = 'Standard Code 1, 4 column header';
const element = await driver.findElement(By.css('tr:nth-child(1) > .text-center:nth-child(6)'));
//Get text, font, size, color, and background color
const elementText = await element.getText();
const elementFont = await element.getCssValue('font-family');
const elementSize = await element.getCssValue('font-size');
const elementColor = await element.getCssValue('color');
const elementBgColor = await element.getCssValue('background-color');
//Track all errors
const errors = [];
//text
if (elementText === ('4')) {
console.log("Passed: Standard Code 1, 4 column header text matched as expected");
} else {
errors.push(`Expected: Standard Code 1, 4 column header "4" text; Actual: "${elementText}"`);
}
//font
if (elementFont === 'Poppins, sans-serif') {
console.log('Passed: Standard Code 1, 4 column header text font-family matched as expected');
} else {
errors.push(`Expected: Standard Code 1, 4 column header text font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
}
//size
if (elementSize === '14.3px') {
console.log('Passed: Standard Code 1, 4 column header text font-size matched as expected');
} else {
errors.push(`Expected: Standard Code 1, 4 column header text font-size "14.3px"; Actual: "${elementSize}"`);
}
//color
if (elementColor === 'rgba(33, 37, 41, 1)') {
console.log('Passed: Standard Code 1, 4 column header text color matched as expected');
} else {
errors.push(`Expected: Standard Code 1, 4 column header text color "rgba(33, 37, 41, 1)"; Actual: "${elementColor}"`);
}
//background color
if (elementBgColor === 'rgba(0, 0, 0, 0)') {
console.log('Passed: Standard Code 1, 4 column header text background color matched as expected');
} else {
errors.push(`Expected: Standard Code 1, 4 column header text background color "rgba(0, 0, 0, 0)"; Actual: "${elementBgColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Standard Code 1, 5 column header
{
description: 'Validate Standard Code 1, 5 column header text, font, size, color, and background color',
action: async () => {
const multipleChecks = 'Standard Code 1, 5 column header';
const element = await driver.findElement(By.css('tr:nth-child(1) > .text-center:nth-child(7)'));
//Get text, font, size, color, and background color
const elementText = await element.getText();
const elementFont = await element.getCssValue('font-family');
const elementSize = await element.getCssValue('font-size');
const elementColor = await element.getCssValue('color');
const elementBgColor = await element.getCssValue('background-color');
//Track all errors
const errors = [];
//text
if (elementText === ('5')) {
console.log("Passed: Standard Code 1, 5 column header text matched as expected");
} else {
errors.push(`Expected: Standard Code 1, 5 column header "5" text; Actual: "${elementText}"`);
}
//font
if (elementFont === 'Poppins, sans-serif') {
console.log('Passed: Standard Code 1, 5 column header text font-family matched as expected');
} else {
errors.push(`Expected: Standard Code 1, 5 column header text font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
}
//size
if (elementSize === '14.3px') {
console.log('Passed: Standard Code 1, 5 column header text font-size matched as expected');
} else {
errors.push(`Expected: Standard Code 1, 5 column header text font-size "14.3px"; Actual: "${elementSize}"`);
}
//color
if (elementColor === 'rgba(33, 37, 41, 1)') {
console.log('Passed: Standard Code 1, 5 column header text color matched as expected');
} else {
errors.push(`Expected: Standard Code 1, 5 column header text color "rgba(33, 37, 41, 1)"; Actual: "${elementColor}"`);
}
//background color
if (elementBgColor === 'rgba(0, 0, 0, 0)') {
console.log('Passed: Standard Code 1, 5 column header text background color matched as expected');
} else {
errors.push(`Expected: Standard Code 1, 5 column header text background color "rgba(0, 0, 0, 0)"; Actual: "${elementBgColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Standard Code 1, 6 column header
{
description: 'Validate Standard Code 1, 6 column header text, font, size, color, and background color',
action: async () => {
const multipleChecks = 'Standard Code 1, 6 column header';
const element = await driver.findElement(By.css('tr:nth-child(1) > .text-center:nth-child(8)'));
//Get text, font, size, color, and background color
const elementText = await element.getText();
const elementFont = await element.getCssValue('font-family');
const elementSize = await element.getCssValue('font-size');
const elementColor = await element.getCssValue('color');
const elementBgColor = await element.getCssValue('background-color');
//Track all errors
const errors = [];
//text
if (elementText === ('6')) {
console.log("Passed: Standard Code 1, 6 column header text matched as expected");
} else {
errors.push(`Expected: Standard Code 1, 6 column header "6" text; Actual: "${elementText}"`);
}
//font
if (elementFont === 'Poppins, sans-serif') {
console.log('Passed: Standard Code 1, 6 column header text font-family matched as expected');
} else {
errors.push(`Expected: Standard Code 1, 6 column header text font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
}
//size
if (elementSize === '14.3px') {
console.log('Passed: Standard Code 1, 6 column header text font-size matched as expected');
} else {
errors.push(`Expected: Standard Code 1, 6 column header text font-size "14.3px"; Actual: "${elementSize}"`);
}
//color
if (elementColor === 'rgba(33, 37, 41, 1)') {
console.log('Passed: Standard Code 1, 6 column header text color matched as expected');
} else {
errors.push(`Expected: Standard Code 1, 6 column header text color "rgba(33, 37, 41, 1)"; Actual: "${elementColor}"`);
}
//background color
if (elementBgColor === 'rgba(0, 0, 0, 0)') {
console.log('Passed: Standard Code 1, 6 column header text background color matched as expected');
} else {
errors.push(`Expected: Standard Code 1, 6 column header text background color "rgba(0, 0, 0, 0)"; Actual: "${elementBgColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Standard Code 1, 7 column header
{
description: 'Validate Standard Code 1, 7 column header text, font, size, color, and background color',
action: async () => {
const multipleChecks = 'Standard Code 1, 7 column header';
const element = await driver.findElement(By.css('tr:nth-child(1) > .text-center:nth-child(9)'));
//Get text, font, size, color, and background color
const elementText = await element.getText();
const elementFont = await element.getCssValue('font-family');
const elementSize = await element.getCssValue('font-size');
const elementColor = await element.getCssValue('color');
const elementBgColor = await element.getCssValue('background-color');
//Track all errors
const errors = [];
//text
if (elementText === ('7')) {
console.log("Passed: Standard Code 1, 7 column header text matched as expected");
} else {
errors.push(`Expected: Standard Code 1, 7 column header "7" text; Actual: "${elementText}"`);
}
//font
if (elementFont === 'Poppins, sans-serif') {
console.log('Passed: Standard Code 1, 7 column header text font-family matched as expected');
} else {
errors.push(`Expected: Standard Code 1, 7 column header text font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
}
//size
if (elementSize === '14.3px') {
console.log('Passed: Standard Code 1, 7 column header text font-size matched as expected');
} else {
errors.push(`Expected: Standard Code 1, 7 column header text font-size "14.3px"; Actual: "${elementSize}"`);
}
//color
if (elementColor === 'rgba(33, 37, 41, 1)') {
console.log('Passed: Standard Code 1, 7 column header text color matched as expected');
} else {
errors.push(`Expected: Standard Code 1, 7 column header text color "rgba(33, 37, 41, 1)"; Actual: "${elementColor}"`);
}
//background color
if (elementBgColor === 'rgba(0, 0, 0, 0)') {
console.log('Passed: Standard Code 1, 7 column header text background color matched as expected');
} else {
errors.push(`Expected: Standard Code 1, 7 column header text background color "rgba(0, 0, 0, 0)"; Actual: "${elementBgColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Standard Code 1, 8 column header
{
description: 'Validate Standard Code 1, 8 column header text, font, size, color, and background color',
action: async () => {
const multipleChecks = 'Standard Code 1, 8 column header';
const element = await driver.findElement(By.css('tr:nth-child(1) > .text-center:nth-child(10)'));
//Get text, font, size, color, and background color
const elementText = await element.getText();
const elementFont = await element.getCssValue('font-family');
const elementSize = await element.getCssValue('font-size');
const elementColor = await element.getCssValue('color');
const elementBgColor = await element.getCssValue('background-color');
//Track all errors
const errors = [];
//text
if (elementText === ('8')) {
console.log("Passed: Standard Code 1, 8 column header text matched as expected");
} else {
errors.push(`Expected: Standard Code 1, 8 column header "8" text; Actual: "${elementText}"`);
}
//font
if (elementFont === 'Poppins, sans-serif') {
console.log('Passed: Standard Code 1, 8 column header text font-family matched as expected');
} else {
errors.push(`Expected: Standard Code 1, 8 column header text font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
}
//size
if (elementSize === '14.3px') {
console.log('Passed: Standard Code 1, 8 column header text font-size matched as expected');
} else {
errors.push(`Expected: Standard Code 1, 8 column header text font-size "14.3px"; Actual: "${elementSize}"`);
}
//color
if (elementColor === 'rgba(33, 37, 41, 1)') {
console.log('Passed: Standard Code 1, 8 column header text color matched as expected');
} else {
errors.push(`Expected: Standard Code 1, 8 column header text color "rgba(33, 37, 41, 1)"; Actual: "${elementColor}"`);
}
//background color
if (elementBgColor === 'rgba(0, 0, 0, 0)') {
console.log('Passed: Standard Code 1, 8 column header text background color matched as expected');
} else {
errors.push(`Expected: Standard Code 1, 8 column header text background color "rgba(0, 0, 0, 0)"; Actual: "${elementBgColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Standard Code 1, 9 column header
{
description: 'Validate Standard Code 1, 9 column header text, font, size, color, and background color',
action: async () => {
const multipleChecks = 'Standard Code 1, 9 column header';
const element = await driver.findElement(By.css('tr:nth-child(1) > .text-center:nth-child(11)'));
//Get text, font, size, color, and background color
const elementText = await element.getText();
const elementFont = await element.getCssValue('font-family');
const elementSize = await element.getCssValue('font-size');
const elementColor = await element.getCssValue('color');
const elementBgColor = await element.getCssValue('background-color');
//Track all errors
const errors = [];
//text
if (elementText === ('9')) {
console.log("Passed: Standard Code 1, 9 column header text matched as expected");
} else {
errors.push(`Expected: Standard Code 1, 9 column header "9" text; Actual: "${elementText}"`);
}
//font
if (elementFont === 'Poppins, sans-serif') {
console.log('Passed: Standard Code 1, 9 column header text font-family matched as expected');
} else {
errors.push(`Expected: Standard Code 1, 9 column header text font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
}
//size
if (elementSize === '14.3px') {
console.log('Passed: Standard Code 1, 9 column header text font-size matched as expected');
} else {
errors.push(`Expected: Standard Code 1, 9 column header text font-size "14.3px"; Actual: "${elementSize}"`);
}
//color
if (elementColor === 'rgba(33, 37, 41, 1)') {
console.log('Passed: Standard Code 1, 9 column header text color matched as expected');
} else {
errors.push(`Expected: Standard Code 1, 9 column header text color "rgba(33, 37, 41, 1)"; Actual: "${elementColor}"`);
}
//background color
if (elementBgColor === 'rgba(237, 250, 238, 1)') {
console.log('Passed: Standard Code 1, 9 column header text background color matched as expected');
} else {
errors.push(`Expected: Standard Code 1, 9 column header text background color "rgba(237, 250, 238, 1)"; Actual: "${elementBgColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Standard Code 1, 10 column header
{
description: 'Validate Standard Code 1, 10 column header text, font, size, color, and background color',
action: async () => {
const multipleChecks = 'Standard Code 1, 10 column header';
const element = await driver.findElement(By.css('tr:nth-child(1) > .text-center:nth-child(12)'));
//Get text, font, size, color, and background color
const elementText = await element.getText();
const elementFont = await element.getCssValue('font-family');
const elementSize = await element.getCssValue('font-size');
const elementColor = await element.getCssValue('color');
const elementBgColor = await element.getCssValue('background-color');
//Track all errors
const errors = [];
//text
if (elementText === ('10')) {
console.log("Passed: Standard Code 1, 10 column header text matched as expected");
} else {
errors.push(`Expected: Standard Code 1, 10 column header "10" text; Actual: "${elementText}"`);
}
//font
if (elementFont === 'Poppins, sans-serif') {
console.log('Passed: Standard Code 1, 10 column header text font-family matched as expected');
} else {
errors.push(`Expected: Standard Code 1, 10 column header text font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
}
//size
if (elementSize === '14.3px') {
console.log('Passed: Standard Code 1, 10 column header text font-size matched as expected');
} else {
errors.push(`Expected: Standard Code 1, 10 column header text font-size "14.3px"; Actual: "${elementSize}"`);
}
//color
if (elementColor === 'rgba(33, 37, 41, 1)') {
console.log('Passed: Standard Code 1, 10 column header text color matched as expected');
} else {
errors.push(`Expected: Standard Code 1, 10 column header text color "rgba(33, 37, 41, 1)"; Actual: "${elementColor}"`);
}
//background color
if (elementBgColor === 'rgba(0, 0, 0, 0)') {
console.log('Passed: Standard Code 1, 10 column header text background color matched as expected');
} else {
errors.push(`Expected: Standard Code 1, 10 column header text background color "rgba(0, 0, 0, 0)"; Actual: "${elementBgColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Standard Code 1, 11 column header
{
description: 'Validate Standard Code 1, 11 column header text, font, size, color, and background color',
action: async () => {
const multipleChecks = 'Standard Code 1, 11 column header';
const element = await driver.findElement(By.css('tr:nth-child(1) > .text-center:nth-child(13)'));
//Get text, font, size, color, and background color
const elementText = await element.getText();
const elementFont = await element.getCssValue('font-family');
const elementSize = await element.getCssValue('font-size');
const elementColor = await element.getCssValue('color');
const elementBgColor = await element.getCssValue('background-color');
//Track all errors
const errors = [];
//text
if (elementText === ('11')) {
console.log("Passed: Standard Code 1, 11 column header text matched as expected");
} else {
errors.push(`Expected: Standard Code 1, 11 column header "11" text; Actual: "${elementText}"`);
}
//font
if (elementFont === 'Poppins, sans-serif') {
console.log('Passed: Standard Code 1, 11 column header text font-family matched as expected');
} else {
errors.push(`Expected: Standard Code 1, 11 column header text font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
}
//size
if (elementSize === '14.3px') {
console.log('Passed: Standard Code 1, 11 column header text font-size matched as expected');
} else {
errors.push(`Expected: Standard Code 1, 11 column header text font-size "14.3px"; Actual: "${elementSize}"`);
}
//color
if (elementColor === 'rgba(33, 37, 41, 1)') {
console.log('Passed: Standard Code 1, 11 column header text color matched as expected');
} else {
errors.push(`Expected: Standard Code 1, 11 column header text color "rgba(33, 37, 41, 1)"; Actual: "${elementColor}"`);
}
//background color
if (elementBgColor === 'rgba(0, 0, 0, 0)') {
console.log('Passed: Standard Code 1, 11 column header text background color matched as expected');
} else {
errors.push(`Expected: Standard Code 1, 11 column header text background color "rgba(0, 0, 0, 0)"; Actual: "${elementBgColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Standard Code 1, 12 column header
{
description: 'Validate Standard Code 1, 12 column header text, font, size, color, and background color',
action: async () => {
const multipleChecks = 'Standard Code 1, 12 column header';
const element = await driver.findElement(By.css('tr:nth-child(1) > .text-center:nth-child(14)'));
//Get text, font, size, color, and background color
const elementText = await element.getText();
const elementFont = await element.getCssValue('font-family');
const elementSize = await element.getCssValue('font-size');
const elementColor = await element.getCssValue('color');
const elementBgColor = await element.getCssValue('background-color');
//Track all errors
const errors = [];
//text
if (elementText === ('12')) {
console.log("Passed: Standard Code 1, 12 column header text matched as expected");
} else {
errors.push(`Expected: Standard Code 1, 12 column header "12" text; Actual: "${elementText}"`);
}
//font
if (elementFont === 'Poppins, sans-serif') {
console.log('Passed: Standard Code 1, 12 column header text font-family matched as expected');
} else {
errors.push(`Expected: Standard Code 1, 12 column header text font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
}
//size
if (elementSize === '14.3px') {
console.log('Passed: Standard Code 1, 12 column header text font-size matched as expected');
} else {
errors.push(`Expected: Standard Code 1, 12 column header text font-size "14.3px"; Actual: "${elementSize}"`);
}
//color
if (elementColor === 'rgba(33, 37, 41, 1)') {
console.log('Passed: Standard Code 1, 12 column header text color matched as expected');
} else {
errors.push(`Expected: Standard Code 1, 12 column header text color "rgba(33, 37, 41, 1)"; Actual: "${elementColor}"`);
}
//background color
if (elementBgColor === 'rgba(0, 0, 0, 0)') {
console.log('Passed: Standard Code 1, 12 column header text background color matched as expected');
} else {
errors.push(`Expected: Standard Code 1, 12 column header text background color "rgba(0, 0, 0, 0)"; Actual: "${elementBgColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Standard Code 1, Select column header
{
description: 'Validate Standard Code 1, Select column header text, font, size, color, and background color',
action: async () => {
const multipleChecks = 'Standard Code 1, Select column header';
const element = await driver.findElement(By.css('tr:nth-child(1) > .text-center:nth-child(15)'));
//Get text, font, size, color, and background color
const elementText = await element.getText();
const elementFont = await element.getCssValue('font-family');
const elementSize = await element.getCssValue('font-size');
const elementColor = await element.getCssValue('color');
const elementBgColor = await element.getCssValue('background-color');
//Track all errors
const errors = [];
//text
if (elementText === ('Select')) {
console.log("Passed: Standard Code 1, Select column header text matched as expected");
} else {
errors.push(`Expected: Standard Code 1, Select column header "Select" text; Actual: "${elementText}"`);
}
//font
if (elementFont === 'Poppins, sans-serif') {
console.log('Passed: Standard Code 1, Select column header text font-family matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Select column header text font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
}
//size
if (elementSize === '14.3px') {
console.log('Passed: Standard Code 1, Select column header text font-size matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Select column header text font-size "14.3px"; Actual: "${elementSize}"`);
}
//color
if (elementColor === 'rgba(33, 37, 41, 1)') {
console.log('Passed: Standard Code 1, Select column header text color matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Select column header text color "rgba(33, 37, 41, 1)"; Actual: "${elementColor}"`);
}
//background color
if (elementBgColor === 'rgba(0, 0, 0, 0)') {
console.log('Passed: Standard Code 1, Select column header text background color matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Select column header text background color "rgba(0, 0, 0, 0)"; Actual: "${elementBgColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Standard Code 1, Clear column header
{
description: 'Validate Standard Code 1, Clear column header text, font, size, color, and background color',
action: async () => {
const multipleChecks = 'Standard Code 1, Clear column header';
const element = await driver.findElement(By.css('tr:nth-child(1) > .text-center:nth-child(16)'));
//Get text, font, size, color, and background color
const elementText = await element.getText();
const elementFont = await element.getCssValue('font-family');
const elementSize = await element.getCssValue('font-size');
const elementColor = await element.getCssValue('color');
const elementBgColor = await element.getCssValue('background-color');
//Track all errors
const errors = [];
//text
if (elementText === ('Clear')) {
console.log("Passed: Standard Code 1, Clear column header text matched as expected");
} else {
errors.push(`Expected: Standard Code 1, Clear column header "Clear" text; Actual: "${elementText}"`);
}
//font
if (elementFont === 'Poppins, sans-serif') {
console.log('Passed: Standard Code 1, Clear column header text font-family matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Clear column header text font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
}
//size
if (elementSize === '14.3px') {
console.log('Passed: Standard Code 1, Clear column header text font-size matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Clear column header text font-size "14.3px"; Actual: "${elementSize}"`);
}
//color
if (elementColor === 'rgba(33, 37, 41, 1)') {
console.log('Passed: Standard Code 1, Clear column header text color matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Clear column header text color "rgba(33, 37, 41, 1)"; Actual: "${elementColor}"`);
}
//background color
if (elementBgColor === 'rgba(0, 0, 0, 0)') {
console.log('Passed: Standard Code 1, Clear column header text background color matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Clear column header text background color "rgba(0, 0, 0, 0)"; Actual: "${elementBgColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Content Item 1, link title
{
description: 'Validate Content Item 1, link title text, font, size, color, and URL',
action: async () => {
const multipleChecks = 'Content Item 1 link title';
const element = await driver.findElement(By.linkText('ANOVA 1: Calculating SST (total sum of squares) (Video2)'));
//Get text, font, size, color, and background color
const elementText = await element.getText();
const elementFont = await element.getCssValue('font-family');
const elementSize = await element.getCssValue('font-size');
const elementColor = await element.getCssValue('color');
const elementURL = await element.getAttribute('href');
//Track all errors
const errors = [];
//text
if (elementText === ('ANOVA 1: Calculating SST (total sum of squares) (Video2)')) {
console.log("Passed: Content Item 1, link title text matched as expected");
} else {
errors.push(`Expected: "ANOVA 1: Calculating SST (total sum of squares) (Video2)" Content Item 1, link title text; Actual: "${elementText}"`);
}
//font
if (elementFont === 'Poppins, sans-serif') {
console.log('Passed: Content Item 1, link title text font-family matched as expected');
} else {
errors.push(`Expected: Content Item 1, link title text font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
}
//size
if (elementSize === '14.3px') {
console.log('Passed: Content Item 1, link title text font-size matched as expected');
} else {
errors.push(`Expected: Content Item 1, link title text font-size "14.3px"; Actual: "${elementSize}"`);
}
//color
if (elementColor === 'rgba(73, 80, 87, 1)') {
console.log('Passed: Content Item 1, link title text color matched as expected');
} else {
errors.push(`Expected: Content Item 1, link title text color "rgba(73, 80, 87, 1)"; Actual: "${elementColor}"`);
}
//url
if (elementURL === 'https://www.khanacademy.org/math/statistics-probability/analysis-of-variance-anova-library/analysis-of-variance-anova/v/anova-1-calculating-sst-total-sum-of-squares') {
console.log('Passed: Content Item 1, link title URL matched as expected');
} else {
errors.push(`Expected: Content Item 1, link title URL: "https://www.khanacademy.org/math/statistics-probability/analysis-of-variance-anova-library/analysis-of-variance-anova/v/anova-1-calculating-sst-total-sum-of-squares"; Actual: "${elementURL}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Content Item 1, Info icon tool-tip
{
description: 'Validate Content Item 1, Info icon tool tip',
action: async () => {
const multipleChecks = 'Content Item 1, Info icon tool-tip';
const element = await driver.findElement(By.css('#title14391526301162119834 > a:nth-child(2)'));
//Get text, font, size, and color
const elementText = await element.getAttribute('title');
const elementFont = await element.getCssValue('font-family');
const elementSize = await element.getCssValue('font-size');
const elementColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//font
if (elementText === 'Click to view item description') {
console.log('Passed: Content Item 1, Info icon tool-tip text matched as expected');
} else {
errors.push(`Expected: Content Item 1, Info icon tool-tip text "Click to view item description"; Actual: ${elementText}`);
}
//font
if (elementFont === 'Poppins, sans-serif') {
console.log('Passed: Content Item 1, Info icon tool-tip text font-family matched as expected');
} else {
errors.push(`Expected: Content Item 1, Info icon tool-tip text font-family "Click to view item description"; Actual: ${elementFont}`);
}
//size
if (elementSize === '14.3px') {
console.log('Passed: Content Item 1, Info icon tool-tip text font-size matched as expected');
} else {
errors.push(`Expected: Content Item 1, Info icon tool-tip text font-size "14.3px"; Actual: "${elementSize}"`);
}
//color
if (elementColor === 'rgba(73, 80, 87, 1)') {
console.log('Passed: Content Item 1, Info icon tool-tip text color matched as expected');
} else {
errors.push(`Expected: Content Item 1, Info icon tool-tip text color "rgba(73, 80, 87, 1)"; Actual: "${elementColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//NEXT ACTION
{
description: 'Click to info-icon for Standard Code 1',
action: async () => {
//Standard Code 1 Aligned Content
await driver.findElement(By.css('#title14391526301162119834 > a:nth-child(2)')).click();
console.log('----->| NEXT ACTION: Clicked Standard Code 1 Info icon');
//Wait until the element exists in the DOM
const infoDescription = await driver.wait(
until.elementLocated(By.css('#descr14391526301162119834')),
30000
);
//Wait until it becomes visible
await driver.wait(
until.elementIsVisible(infoDescription),
30000
);
}
},
//Standard Code 1, Info description
{
description: 'Validate Standard Code 1, Info description text, font, size, and color',
action: async () => {
const multipleChecks = 'Standard Code 1, Info description';
const element = await driver.findElement(By.css('#descr14391526301162119834'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementFont = await element.getCssValue('font-family');
const elementSize = await element.getCssValue('font-size');
const elementColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//text
if (elementText === (`You already know a good bit about hypothesis testing with one or two samples. Now we take things further by making inferences based on three or more samples. We'll use the very special F-distribution to do it (F stands for "fabulous").`)) {
console.log("Passed: Standard Code 1, Description text matched as expected");
} else {
errors.push(`Expected: Standard Code 1, Description "You already know a good bit about hypothesis testing with one or two samples. Now we take things further by making inferences based on three or more samples. We'll use the very special F-distribution to do it (F stands for "fabulous")." text; Actual: "${elementText}"`);
}
//font
if (elementFont === 'Poppins, sans-serif') {
console.log('Passed: Standard Code 1, Description text font-family matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Description text font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
}
//size
if (elementSize === '12.87px') {
console.log('Passed: Standard Code 1, Description text font-size matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Description text font-size "12.87px"; Actual: "${elementSize}"`);
}
//color
if (elementColor === 'rgba(33, 37, 41, 1)') {
console.log('Passed: Standard Code 1, Description text color matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Description text color "rgba(33, 37, 41, 1)"; Actual: "${elementColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Standard Code 1, Content Item 1, Primary badge
{
description: 'Validate Standard Code 1, Content Item 1, Primary badge text, font, size, and color',
action: async () => {
const multipleChecks = 'Standard Code 1, Content Item 1, Primary badge';
const element = await driver.findElement(By.css('#title14391526301162119834 > .badge'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementFont = await element.getCssValue('font-family');
const elementSize = await element.getCssValue('font-size');
const elementColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//font
if (elementText === 'Primary') {
console.log('Passed: Standard Code 1, Content Item 1, Primary badge text font-family matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 1, Primary badge text font-family "Primary"; Actual: ${elementText}`);
}
//font
if (elementFont === 'Poppins, sans-serif') {
console.log('Passed: Standard Code 1, Content Item 1, Primary badge text font-family matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 1, Primary badge text font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
}
//size
if (elementSize === '12.87px') {
console.log('Passed: Standard Code 1, Content Item 1, Primary badge text font-size matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 1, Primary badge text font-size "12.87px"; Actual: "${elementSize}"`);
}
//color
if (elementColor === 'rgba(255, 255, 255, 1)') {
console.log('Passed: Standard Code 1, Content Item 1, Primary badge text color matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 1, Primary badge text color "rgba(255, 255, 255, 1)"; Actual: "${elementColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Standard Code 1, Content Item 1, tags tool-tip
{
description: 'Validate Standard Code 1, Content Item 1, tags tool-tip text, font, size, and color',
action: async () => {
const multipleChecks = 'Standard Code 1, Content Item 1, tags tool-tip';
const element = await driver.findElement(By.css('#title14391526301162119834 > .fa'));
//Get text, font, size, and color
const elementText = await element.getAttribute('title');
const elementFont = await element.getCssValue('font-family');
const elementSize = await element.getCssValue('font-size');
const elementColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//text
if (elementText === ('View Matching Concepts')) {
console.log("Passed: Standard Code 1, Content Item 1, tags tool-tip text matched as expected");
} else {
errors.push(`Expected: Standard Code 1, Content Item 1, tags tool-tip text "View Matching Concepts"; Actual: "${elementText}"`);
}
//font
if (elementFont === 'FontAwesome') {
console.log('Passed: Standard Code 1, Content Item 1, tags tool-tip text font-family matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 1, tags tool-tip text font-family "FontAwesome"; Actual: ${elementFont}`);
}
//size
if (elementSize === '20px') {
console.log('Passed: Standard Code 1, Content Item 1, tags tool-tip text font-size matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 1, tags tool-tip text font-size "20px"; Actual: "${elementSize}"`);
}
//color
if (elementColor === 'rgba(73, 80, 87, 1)') {
console.log('Passed: Standard Code 1, Content Item 1, tags tool-tip text color matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 1, tags tool-tip text color "rgba(73, 80, 87, 1)"; Actual: "${elementColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//NEXT ACTION
{
description: 'Click to tags icon for Standard Code 1',
action: async () => {
//Standard Code 1 Aligned Content
await driver.findElement(By.css('#title14391526301162119834 > .fa')).click();
console.log('----->| NEXT ACTION: Clicked Standard Code 1 Tags icon');
//Wait until the element exists in the DOM
const tagsDescription = await driver.wait(
until.elementLocated(By.css('#concept_div14391526301162119834 > h6')),
30000
);
//Wait until it becomes visible
await driver.wait(
until.elementIsVisible(tagsDescription),
30000
);
}
},
//Standard Code 1, Tag Title
{
description: 'Validate Standard Code 1, Tag Title text, font, size, and color',
action: async () => {
const multipleChecks = 'Standard Code 1, Tag Title';
const element = await driver.findElement(By.css('#concept_div14391526301162119834 > h6'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementFont = await element.getCssValue('font-family');
const elementSize = await element.getCssValue('font-size');
const elementColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//text
if (elementText === ('Alignment created by these matching concepts')) {
console.log("Passed: Standard Code 1, Tag Title text matched as expected");
} else {
errors.push(`Expected: Standard Code 1, Tag Title "Alignment created by these matching concepts" text; Actual: "${elementText}"`);
}
//font
if (elementFont === 'Poppins, sans-serif') {
console.log('Passed: Standard Code 1, Tag Title text font-family matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Tag Title text font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
}
//size
if (elementSize === '14px') {
console.log('Passed: Standard Code 1, Tag Title text font-size matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Tag Title text font-size "14px"; Actual: "${elementSize}"`);
}
//color
if (elementColor === 'rgba(33, 37, 41, 1)') {
console.log('Passed: Standard Code 1, Tag Title text color matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Tag Title text color "rgba(33, 37, 41, 1)"; Actual: "${elementColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Standard Code 1, Concept 1 Primary toggle button
{
description: 'Verify Standard Code 1, Concept 1 Primary toggle button is present',
action: async () => {
const multipleChecks = 'Standard Code 1, Concept 1 Primary toggle button';
//Get the switch-toggle div class
const toggleClass = await driver.executeScript(`
const listItem = document.querySelector('#concept-1162119834-1439152630-168638762');
const toggle = listItem ? listItem.querySelector('div.switch-toggle') : null;
return toggle ? toggle.className : 'not found';
`);
//Get the checkbox input's checked state
const checkboxChecked = await driver.findElement(By.css('#switch1162119834-1439152630-168638762')).getAttribute('checked');
//Track all errors
const errors = [];
//Validate it's a toggle not a regular button
if (toggleClass.includes('switch-toggle')) {
console.log('Passed: Standard Code 1, Concept 1, Primary toggle button toggle switch listed as expected');
} else {
errors.push(`Expected: Standard Code 1, Concept 1, Primary toggle button: "switch-toggle"; Actual: "${toggleClass}"`);
}
//Validate toggle is disabled (not the primary concept)
if (!checkboxChecked) {
console.log('Passed: Standard Code 1, Concept 1, Primary toggle button is disabled as expected');
} else {
errors.push(`Expected: Standard Code 1, Concept 1, Primary toggle button to be disabled; Actual: checked="${checkboxChecked}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Standard Code 1, Concept 1 Tagged alignment 1 breadcrumb
{
description: 'Validate Standard Code 1, Concept 1, Tagged alignment 1 breadcrumb text, font, size, and color',
action: async () => {
const multipleChecks = 'Standard Code 1, Concept 1 Tagged alignment 1 breadcrumb';
const element = await driver.findElement(By.css('#concept-1162119834-1439152630-168638762 > td:nth-child(2)'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementFont = await element.getCssValue('font-family');
const elementSize = await element.getCssValue('font-size');
const elementColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//text
if (elementText === ('Mathematics | Process Standards | Problem Solving | Methods/Steps/Strategies')) {
console.log("Passed: Standard Code 1, Concept 1, Tagged alignment 1 breadcrumb text matched as expected");
} else {
errors.push(`Expected: Standard Code 1, Concept 1, Tagged alignment 1 breadcrumb "Mathematics | Process Standards | Problem Solving | Methods/Steps/Strategies" text; Actual: "${elementText}"`);
}
//font
if (elementFont === 'Poppins, sans-serif') {
console.log('Passed: Standard Code 1, Concept 1, Tagged alignment 1 breadcrumb text font-family matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Concept 1, Tagged alignment 1 breadcrumb text font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
}
//size
if (elementSize === '12px') {
console.log('Passed: Standard Code 1, Concept 1, Tagged alignment 1 breadcrumb text font-size matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Concept 1, Tagged alignment 1 breadcrumb text font-size "12px"; Actual: "${elementSize}"`);
}
//color
if (elementColor === 'rgba(33, 37, 41, 1)') {
console.log('Passed: Standard Code 1, Concept 1, Tagged alignment 1 breadcrumb text color matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Concept 1, Tagged alignment 1 breadcrumb text color "rgba(33, 37, 41, 1)"; Actual: "${elementColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//NEXT ACTION
{
description: 'Click to delete tagged concept 1',
action: async () => {
//Standard Code 1 Aligned Content
await driver.findElement(By.css('#concept-1162119834-1439152630-168638762 .fa')).click();
console.log('----->| NEXT ACTION: Clicked Standard Code 1, Tagged Concept 1 delete icon');
//Wait until the element exists in the DOM
const removeConceptDIV = await driver.wait(
until.elementLocated(By.css('#toast-1162119834-1439152630-168638762 .mr-auto')),
30000
);
//Wait until it becomes visible
await driver.wait(
until.elementIsVisible(removeConceptDIV),
30000
);
}
},
//Standard Code 1, Concept 1, tagged alert DIV
{
description: 'Validate Standard Code 1, Concept 1, tagged alert DIV text, font, size, color, background color, and delete icon',
action: async () => {
const multipleChecks = 'Standard Code 1, Concept 1, tagged alert DIV';
const element = await driver.findElement(By.css('#toast-1162119834-1439152630-168638762 .mr-auto'));
const elementIcon = await driver.findElement(By.css('#toast-1162119834-1439152630-168638762 span'));
//Get text, font, size, color, and background color
const elementText = await element.getText();
const elementFont = await element.getCssValue('font-family');
const elementSize = await element.getCssValue('font-size');
const elementColor = await element.getCssValue('color');
const elementBgColor = await element.getCssValue('background-color');
//Track all errors
const errors = [];
//text
if (elementText === ('Remove Concept')) {
console.log("Passed: Standard Code 1, Concept 1, tagged alert DIV title text matched as expected");
} else {
errors.push(`Expected: Standard Code 1, Concept 1, tagged alert DIV title "Remove Concept" text; Actual: "${elementText}"`);
}
//font
if (elementFont === 'Poppins, sans-serif') {
console.log('Passed: Standard Code 1, Concept 1, tagged alert DIV title text font-family matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Concept 1, tagged alert DIV title text font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
}
//size
if (elementSize === '10px') {
console.log('Passed: Standard Code 1, Concept 1, tagged alert DIV title text font-size matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Concept 1, tagged alert DIV title text font-size "10px"; Actual: "${elementSize}"`);
}
//color
if (elementColor === 'rgba(255, 255, 255, 1)') {
console.log('Passed: Standard Code 1, Concept 1, tagged alert DIV title text color matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Concept 1, tagged alert DIV title text color "rgba(255, 255, 255, 1)"; Actual: "${elementColor}"`);
}
//background color
if (elementBgColor === 'rgba(0, 0, 0, 0)') {
console.log('Passed: Standard Code 1, Concept 1, tagged alert DIV title background color matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Concept 1, tagged alert DIV title background color "rgba(0, 0, 0, 0)"; Actual: "${elementBgColor}"`);
}
//close icon
if (elementIcon) {
console.log('Passed: Standard Code 1, Concept 1, tagged alert DIV delete icon is present as expected');
} else {
errors.push('Expected: Standard Code 1, Concept 1, tagged alert DIV delete icon was not found');
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Standard Code 1, Concept 1, tagged alert DIV warning message
{
description: 'Validate Standard Code 1, Concept 1, tagged alert DIV warning message text, font, size, color, background color, and delete icon',
action: async () => {
const multipleChecks = 'Standard Code 1, Concept 1, tagged alert DIV warning message';
const element = await driver.findElement(By.css('#toast-1162119834-1439152630-168638762 > .toast-body > div'));
const elementYesButton = await driver.findElement(By.css('#toast-1162119834-1439152630-168638762 > .toast-body > button:nth-child(2)'));
const elementNoButton = await driver.findElement(By.css('#toast-1162119834-1439152630-168638762 .btn'));
//Get warning message text, font, size, color, and background color
const elementText = await element.getText();
const elementFont = await element.getCssValue('font-family');
const elementSize = await element.getCssValue('font-size');
const elementColor = await element.getCssValue('color');
const elementBgColor = await element.getCssValue('background-color');
//Get Yes button text, font, size, color, and background color
const elementYesText = await elementYesButton.getText();
const elementYesFont = await elementYesButton.getCssValue('font-family');
const elementYesSize = await elementYesButton.getCssValue('font-size');
const elementYesColor = await elementYesButton.getCssValue('color');
const elementYesBgColor = await elementYesButton.getCssValue('background-color');
//Get No button text, font, size, color, and background color
const elementNoText = await elementNoButton.getText();
const elementNoFont = await elementNoButton.getCssValue('font-family');
const elementNoSize = await elementNoButton.getCssValue('font-size');
const elementNoColor = await elementNoButton.getCssValue('color');
const elementNoBgColor = await elementNoButton.getCssValue('background-color');
//Track all errors
const errors = [];
//warning text
if (elementText === ('Are you sure you want to remove this concept from this item? This will affect alignments on other standards as well.')) {
console.log("Passed: Standard Code 1, Concept 1, tagged alert DIV warning message text matched as expected");
} else {
errors.push(`Expected: Standard Code 1, Concept 1, tagged alert DIV warning message "Are you sure you want to remove this concept from this item? This will affect alignments on other standards as well." text; Actual: "${elementText}"`);
}
//font
if (elementFont === 'Poppins, sans-serif') {
console.log('Passed: Standard Code 1, Concept 1, tagged alert DIV warning message text font-family matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Concept 1, tagged alert DIV warning message text font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
}
//size
if (elementSize === '12px') {
console.log('Passed: Standard Code 1, Concept 1, tagged alert DIV warning message text font-size matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Concept 1, tagged alert DIV warning message text font-size "12px"; Actual: "${elementSize}"`);
}
//color
if (elementColor === 'rgba(73, 80, 87, 1)') {
console.log('Passed: Standard Code 1, Concept 1, tagged alert DIV warning message text color matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Concept 1, tagged alert DIV warning message text color "rgba(73, 80, 87, 1)"; Actual: "${elementColor}"`);
}
//yes button text
if (elementYesText === ('Yes')) {
console.log("Passed: Standard Code 1, Concept 1, tagged alert DIV Yes warning button text matched as expected");
} else {
errors.push(`Expected: Standard Code 1, Concept 1, tagged alert DIV Yes warning button "Yes" text; Actual: "${elementYesText}"`);
}
//font
if (elementYesFont === 'Poppins, sans-serif') {
console.log('Passed: Standard Code 1, Concept 1, tagged alert DIV Yes warning button text font-family matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Concept 1, tagged alert DIV Yes warning button text font-family "Poppins, sans-serif"; Actual: ${elementYesFont}`);
}
//size
if (elementYesSize === '10px') {
console.log('Passed: Standard Code 1, Concept 1, tagged alert DIV Yes warning button text font-size matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Concept 1, tagged alert DIV Yes warning button text font-size "10px"; Actual: "${elementYesSize}"`);
}
//color
if (elementYesColor === 'rgba(255, 255, 255, 1)') {
console.log('Passed: Standard Code 1, Concept 1, tagged alert DIV Yes warning button text color matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Concept 1, tagged alert DIV Yes warning button text color "rgba(255, 255, 255, 1)"; Actual: "${elementYesColor}"`);
}
//background color
if (elementYesBgColor === 'rgba(255, 26, 26, 1)') {
console.log('Passed: Standard Code 1, Concept 1, tagged alert DIV Yes warning button background color matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Concept 1, tagged alert DIV Yes warning button background color "rgba(255, 26, 26, 1)"; Actual: "${elementYesBgColor}"`);
}
//no button text
if (elementNoText === ('No')) {
console.log("Passed: Standard Code 1, Concept 1, tagged alert DIV No warning button text matched as expected");
} else {
errors.push(`Expected: Standard Code 1, Concept 1, tagged alert DIV No warning button "No" text; Actual: "${elementNoText}"`);
}
//font
if (elementNoFont === 'Poppins, sans-serif') {
console.log('Passed: Standard Code 1, Concept 1, tagged alert DIV No warning button text font-family matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Concept 1, tagged alert DIV No warning button text font-family "Poppins, sans-serif"; Actual: ${elementNoFont}`);
}
//size
if (elementNoSize === '10px') {
console.log('Passed: Standard Code 1, Concept 1, tagged alert DIV No warning button text font-size matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Concept 1, tagged alert DIV No warning button text font-size "10px"; Actual: "${elementNoSize}"`);
}
//color
if (elementNoColor === 'rgba(255, 255, 255, 1)') {
console.log('Passed: Standard Code 1, Concept 1, tagged alert DIV No warning button text color matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Concept 1, tagged alert DIV No warning button text color "rgba(255, 255, 255, 1)"; Actual: "${elementNoColor}"`);
}
//background color
if (elementNoBgColor === 'rgba(255, 26, 26, 1)') {
console.log('Passed: Standard Code 1, Concept 1, tagged alert DIV No warning button background color matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Concept 1, tagged alert DIV No warning button background color "rgba(255, 26, 26, 1)"; Actual: "${elementNoBgColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//NEXT ACTION
{
description: 'Click X icon to close warning message for tagged concept 1',
action: async () => {
//Standard Code 1 Aligned Content
await driver.findElement(By.css('#toast-1162119834-1439152630-168638762 span')).click();
console.log('----->| NEXT ACTION: Clicked X icon');
await driver.sleep(2000);
}
},
//Standard Code 1, Concept 2, Primary toggle button
{
description: 'Verify Standard Code 1, Concept 2, Primary toggle button is present',
action: async () => {
const multipleChecks = 'Standard Code 1, Concept 2 Primary toggle button';
//Get the switch-toggle div class
const toggleClass = await driver.executeScript(`
const listItem = document.querySelector('#concept-1162119834-1439152630-168638753');
const toggle = listItem ? listItem.querySelector('div.switch-toggle') : null;
return toggle ? toggle.className : 'not found';
`);
//Get the checkbox input's checked state
const checkboxChecked = await driver.findElement(By.css('#switch1162119834-1439152630-168638753')).getAttribute('checked');
//Track all errors
const errors = [];
//Validate it's a toggle not a regular button
if (toggleClass.includes('switch-toggle')) {
console.log('Passed: Standard Code 1, Concept 2, Primary toggle button toggle switch listed as expected');
} else {
errors.push(`Expected: Standard Code 1, Concept 2, Primary toggle button: "switch-toggle"; Actual: "${toggleClass}"`);
}
//Validate toggle is enabled (primary concept)
if (checkboxChecked) {
console.log('Passed: Standard Code 1, Concept 2, Primary toggle button is enabled as expected');
} else {
errors.push(`Expected: Standard Code 1, Concept 2, Primary toggle button to be enabled; Actual: checked="${checkboxChecked}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Standard Code 1, Concept 2, Tagged alignment 1 breadcrumb
{
description: 'Validate Standard Code 1, Concept 2, Tagged alignment 1 breadcrumb text, font, size, and color',
action: async () => {
const multipleChecks = 'Standard Code 1, Concept 2, Tagged alignment 1 breadcrumb';
const element = await driver.findElement(By.css('#concept-1162119834-1439152630-168638753 > td:nth-child(2)'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementFont = await element.getCssValue('font-family');
const elementSize = await element.getCssValue('font-size');
const elementColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//text
if (elementText === ('Mathematics | Process Standards | Computation | Methods/Steps/Strategies')) {
console.log("Passed: Standard Code 1, Concept 2, Tagged alignment 1 breadcrumb text matched as expected");
} else {
errors.push(`Expected: Standard Code 1, Concept 2, Tagged alignment 1 breadcrumb "Mathematics | Process Standards | Computation | Methods/Steps/Strategies" text; Actual: "${elementText}"`);
}
//font
if (elementFont === 'Poppins, sans-serif') {
console.log('Passed: Standard Code 1, Concept 2, Tagged alignment 1 breadcrumb text font-family matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Concept 2, Tagged alignment 1 breadcrumb text font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
}
//size
if (elementSize === '12px') {
console.log('Passed: Standard Code 1, Concept 2, Tagged alignment 1 breadcrumb text font-size matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Concept 2, Tagged alignment 1 breadcrumb text font-size "12px"; Actual: "${elementSize}"`);
}
//color
if (elementColor === 'rgba(33, 37, 41, 1)') {
console.log('Passed: Standard Code 1, Concept 2, Tagged alignment 1 breadcrumb text color matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Concept 2, Tagged alignment 1 breadcrumb text color "rgba(33, 37, 41, 1)"; Actual: "${elementColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Standard Code 1, Content Item 1, Grade 3 checkmark
{
description: 'Validate Standard Code 1, Content Item 1, Grade 3 checkmark icon',
action: async () => {
const element = await driver.findElement(By.css('#\\34 1_1439151975_1162119834 .fa'));
//Track all errors
const errors = [];
//icon
if (element) {
console.log('Passed: Standard Code 1, Content Item 1, Grade 3 checkmark icon was found');
} else {
errors.push('Standard Code 1, Content Item 1, Grade 3 checkmark icon was not found');
}
}
},
//Standard Code 1, Content Item 1, Grade 4 checkmark
{
description: 'Validate Standard Code 1, Content Item 1, Grade 4 checkmark icon',
action: async () => {
const element = await driver.findElement(By.css('#\\34 3_1439152039_1162119834 .fa'));
//Track all errors
const errors = [];
//icon
if (element) {
console.log('Passed: Standard Code 1, Content Item 1, Grade 4 checkmark icon was found');
} else {
errors.push('Standard Code 1, Content Item 1, Grade 4 checkmark icon was not found');
}
}
},
//Standard Code 1, Content Item 1, Grade 5 checkmark
{
description: 'Validate Standard Code 1, Content Item 1, Grade 5 checkmark icon',
action: async () => {
const element = await driver.findElement(By.css('#\\34 4_1439152120_1162119834 .fa'));
//Track all errors
const errors = [];
//icon
if (element) {
console.log('Passed: Standard Code 1, Content Item 1, Grade 5 checkmark icon was found');
} else {
errors.push('Standard Code 1, Content Item 1, Grade 5 checkmark icon was not found');
}
}
},
//Standard Code 1, Content Item 1, Grade 6 checkmark
{
description: 'Validate Standard Code 1, Content Item 1, Grade 6 checkmark icon',
action: async () => {
const element = await driver.findElement(By.css('#\\34 5_1439152196_1162119834 .fa'));
//Track all errors
const errors = [];
//icon
if (element) {
console.log('Passed: Standard Code 1, Content Item 1, Grade 6 checkmark icon was found');
} else {
errors.push('Standard Code 1, Content Item 1, Grade 6 checkmark icon was not found');
}
}
},
//Standard Code 1, Content Item 1, Grade 7 checkmark
{
description: 'Validate Standard Code 1, Content Item 1, Grade 7 checkmark icon',
action: async () => {
const element = await driver.findElement(By.css('#\\34 7_1439152274_1162119834 .fa'));
//Track all errors
const errors = [];
//icon
if (element) {
console.log('Passed: Standard Code 1, Content Item 1, Grade 7 checkmark icon was found');
} else {
errors.push('Standard Code 1, Content Item 1, Grade 7 checkmark icon was not found');
}
}
},
//Standard Code 1, Content Item 1, Grade 8 checkmark
{
description: 'Validate Standard Code 1, Content Item 1, Grade 8 checkmark icon',
action: async () => {
const element = await driver.findElement(By.css('#\\34 8_1439152451_1162119834 .fa'));
//Track all errors
const errors = [];
//icon
if (element) {
console.log('Passed: Standard Code 1, Content Item 1, Grade 8 checkmark icon was found');
} else {
errors.push('Standard Code 1, Content Item 1, Grade 8 checkmark icon was not found');
}
}
},
//Standard Code 1, Content Item 1, Grade 9 checkmark
{
description: 'Validate Standard Code 1, Content Item 1, Grade 9 checkmark icon',
action: async () => {
const element = await driver.findElement(By.css('#\\34 9_1439152630_1162119834 .fa'));
//Track all errors
const errors = [];
//icon
if (element) {
console.log('Passed: Standard Code 1, Content Item 1, Grade 9 checkmark icon was found');
} else {
errors.push('Standard Code 1, Content Item 1, Grade 9 checkmark icon was not found');
}
}
},
//Standard Code 1, Content Item 1, Grade 10 checkmark
{
description: 'Validate Standard Code 1, Content Item 1, Grade 10 checkmark icon',
action: async () => {
const element = await driver.findElement(By.css('#\\35 1_1439153143_1162119834 .fa'));
//Track all errors
const errors = [];
//icon
if (element) {
console.log('Passed: Standard Code 1, Content Item 1, Grade 10 checkmark icon was found');
} else {
errors.push('Standard Code 1, Content Item 1, Grade 10 checkmark icon was not found');
}
}
},
//Standard Code 1, Content Item 1, Grade 11 checkmark
{
description: 'Validate Standard Code 1, Content Item 1, Grade 11 checkmark icon',
action: async () => {
const element = await driver.findElement(By.css('#\\35 2_1439153656_1162119834 .fa'));
//Track all errors
const errors = [];
//icon
if (element) {
console.log('Passed: Standard Code 1, Content Item 1, Grade 11 checkmark icon was found');
} else {
errors.push('Standard Code 1, Content Item 1, Grade 11 checkmark icon was not found');
}
}
},
//Standard Code 1, Content Item 1, Grade 12 checkmark
{
description: 'Validate Standard Code 1, Content Item 1, Grade 12 checkmark icon',
action: async () => {
const element = await driver.findElement(By.css('#\\35 3_1439154169_1162119834 .fa'));
//Track all errors
const errors = [];
//icon
if (element) {
console.log('Passed: Standard Code 1, Content Item 1, Grade 12 checkmark icon was found');
} else {
errors.push('Standard Code 1, Content Item 1, Grade 12 checkmark icon was not found');
}
}
},
//Standard Code 1, Content Item 1, All button
{
description: 'Validate Standard Code 1, Content Item 1, All button text, size, and color',
action: async () => {
const multipleChecks = 'Standard Code 1, Content Item 1, All button';
const element = await driver.findElement(By.css('#tr14391526301162119834 > .align-middle:nth-child(15) > .btn'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
const elementButtonColor = await element.getCssValue('background-color');
//Track all errors
const errors = [];
//text
if (elementText === 'All') {
console.log('Passed: Standard Code 1, Content Item 1, All button text matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 1, All button text "All"; Actual: "${elementText}"`);
}
//font
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Standard Code 1, Content Item 1, All button text font-family matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 1, All button text font-family "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//size
if (elementTextSize === '14px') {
console.log('Passed: Standard Code 1, Content Item 1, All button text font-size matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 1, All button text font-size "14px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(255, 255, 255, 1)') {
console.log('Passed: Standard Code 1, Content Item 1, All button text color matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 1, All button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`);
}
//button color
if (elementButtonColor === 'rgba(108, 117, 125, 1)') {
console.log('Passed: Standard Code 1, Content Item 1, All button background color matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 1, All button background color: "rgba(108, 117, 125, 1)"; Actual: "${elementButtonColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Standard Code 1, Content Item 1, Clear button
{
description: 'Validate Standard Code 1, Content Item 1, Clear button text, size, and color',
action: async () => {
const multipleChecks = 'Standard Code 1, Content Item 1, Clear button';
const element = await driver.findElement(By.css('#tr14391526301162119834 > .align-middle:nth-child(16) > .btn'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
const elementButtonColor = await element.getCssValue('background-color');
//Track all errors
const errors = [];
//text
if (elementText === 'Clear') {
console.log('Passed: Standard Code 1, Content Item 1, Clear button text matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 1, Clear button text "Clear"; Actual: "${elementText}"`);
}
//font
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Standard Code 1, Content Item 1, Clear button text font-family matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 1, Clear button text font-family "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//size
if (elementTextSize === '14px') {
console.log('Passed: Standard Code 1, Content Item 1, Clear button text font-size matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 1, Clear button text font-size "14px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(255, 255, 255, 1)') {
console.log('Passed: Standard Code 1, Content Item 1, Clear button text color matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 1, Clear button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`);
}
//button color
if (elementButtonColor === 'rgba(108, 117, 125, 1)') {
console.log('Passed: Standard Code 1, Content Item 1, Clear button background color matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 1, Clear button background color: "rgba(108, 117, 125, 1)"; Actual: "${elementButtonColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Standard Code 1, Content Item 2, link title
{
description: 'Validate Standard Code 1, Content Item 2, link title text, font, size color, and URL',
action: async () => {
const multipleChecks = 'Standard Code 1, Content Item 2, link title';
const element = await driver.findElement(By.linkText('Adding complex numbers (Video)'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementFont = await element.getCssValue('font-family');
const elementSize = await element.getCssValue('font-size');
const elementColor = await element.getCssValue('color');
const elementURL = await element.getAttribute('href');
//Track all errors
const errors = [];
//text
if (elementText === ('Adding complex numbers (Video)')) {
console.log("Passed: Standard Code 1, Content Item 2, link title text matched as expected");
} else {
errors.push(`Expected: "Adding complex numbers (Video)" Standard Code 1, Content Item 2, link title text; Actual: "${elementText}"`);
}
//font
if (elementFont === 'Poppins, sans-serif') {
console.log('Passed: Standard Code 1, Content Item 2, link title text font-family matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 2, link title text font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
}
//size
if (elementSize === '14.3px') {
console.log('Passed: Standard Code 1, Content Item 2, link title text font-size matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 2, link title text font-size "14.3px"; Actual: "${elementSize}"`);
}
//color
if (elementColor === 'rgba(212, 20, 90, 1)') {
console.log('Passed: Standard Code 1, Content Item 2, link title text color matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 2, link title text color "rgba(212, 20, 90, 1)"; Actual: "${elementColor}"`);
}
//url
if (elementURL === 'https://www.khanacademy.org/math/algebra2-2018/introduction-to-complex-numbers-algebra-2/adding-and-subtracting-complex-numbers-algebra-2/v/adding-complex-numbers') {
console.log('Passed: Standard Code 1, Content Item 2, link title URL matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 2, link title URL: "https://www.khanacademy.org/math/algebra2-2018/introduction-to-complex-numbers-algebra-2/adding-and-subtracting-complex-numbers-algebra-2/v/adding-complex-numbers"; Actual: "${elementURL}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Standard Code 1, Content Item 2, Info icon tool-tip
{
description: 'Validate Standard Code 1, Content Item 2, Info icon tool tip',
action: async () => {
const multipleChecks = 'Standard Code 1, Content Item 2, Info icon tool-tip';
const element = await driver.findElement(By.css('#title14391526301162119834 > a:nth-child(2)'));
//Get text, font, size, and color
const elementText = await element.getAttribute('title');
const elementFont = await element.getCssValue('font-family');
const elementSize = await element.getCssValue('font-size');
const elementColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//font
if (elementText === 'Click to view item description') {
console.log('Passed: Standard Code 1, Content Item 2, Info icon tool-tip text matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 2, Info icon tool-tip text "Click to view item description"; Actual: ${elementText}`);
}
//font
if (elementFont === 'Poppins, sans-serif') {
console.log('Passed: Standard Code 1, Content Item 2, Info icon tool-tip text font-family matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 2, Info icon tool-tip text font-family "Click to view item description"; Actual: ${elementFont}`);
}
//size
if (elementSize === '14.3px') {
console.log('Passed: Standard Code 1, Content Item 2, Info icon tool-tip text font-size matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 2, Info icon tool-tip text font-size "14.3px"; Actual: "${elementSize}"`);
}
//color
if (elementColor === 'rgba(73, 80, 87, 1)') {
console.log('Passed: Standard Code 1, Content Item 2, Info icon tool-tip text color matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 2, Info icon tool-tip text color "rgba(73, 80, 87, 1)"; Actual: "${elementColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Standard Code 1, Content Item 2, Primary badge
{
description: 'Validate Standard Code 1, Content Item 2, Primary badge text, font, size, and color',
action: async () => {
const multipleChecks = 'Standard Code 1, Content Item 2, Primary badge';
const element = await driver.findElement(By.css('#title14391526301162119829 > .badge'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementFont = await element.getCssValue('font-family');
const elementSize = await element.getCssValue('font-size');
const elementColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//font
if (elementText === 'Primary') {
console.log('Passed: Standard Code 1, Content Item 2, Primary badge text font-family matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 2, Primary badge text font-family "Primary"; Actual: ${elementText}`);
}
//font
if (elementFont === 'Poppins, sans-serif') {
console.log('Passed: Standard Code 1, Content Item 2, Primary badge text font-family matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 2, Primary badge text font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
}
//size
if (elementSize === '12.87px') {
console.log('Passed: Standard Code 1, Content Item 2, Primary badge text font-size matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 2, Primary badge text font-size "12.87px"; Actual: "${elementSize}"`);
}
//color
if (elementColor === 'rgba(255, 255, 255, 1)') {
console.log('Passed: Standard Code 1, Content Item 2, Primary badge text color matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 2, Primary badge text color "rgba(255, 255, 255, 1)"; Actual: "${elementColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Standard Code 1, Content Item 2, hidden badge
{
description: 'Validate Standard Code 1, Content Item 2, hidden badge text, font, size, color, and background color',
action: async () => {
const multipleChecks = 'Standard Code 1, Content Item 2, hidden badge';
const element = await driver.findElement(By.css('.badge-danger'));
//Get text, font, size, color, and background color
const elementText = await element.getText();
const elementFont = await element.getCssValue('font-family');
const elementSize = await element.getCssValue('font-size');
const elementColor = await element.getCssValue('color');
const elementBgColor = await element.getCssValue('background-color');
//Track all errors
const errors = [];
//font
if (elementText === 'hidden') {
console.log('Passed: Standard Code 1, Content Item 2, hidden badge text font-family matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 2, hidden badge text font-family "hidden"; Actual: ${elementText}`);
}
//font
if (elementFont === 'Poppins, sans-serif') {
console.log('Passed: Standard Code 1, Content Item 2, hidden badge text font-family matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 2, hidden badge text font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
}
//size
if (elementSize === '12.87px') {
console.log('Passed: Standard Code 1, Content Item 2, hidden badge text font-size matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 2, hidden badge text font-size "12.87px"; Actual: "${elementSize}"`);
}
//color
if (elementColor === 'rgba(255, 255, 255, 1)') {
console.log('Passed: Standard Code 1, Content Item 2, hidden badge text color matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 2, hidden badge text color "rgba(255, 255, 255, 1)"; Actual: "${elementColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Standard Code 1, Content Item 2, tags tool-tip
{
description: 'Validate Standard Code 1, Content Item 2, tags tool-tip text, font, size, and color',
action: async () => {
const multipleChecks = 'Standard Code 1, Content Item 2, tags tool-tip';
const element = await driver.findElement(By.css('#title14391526301162119829 > .fa'));
//Get text, font, size, and color
const elementText = await element.getAttribute('title');
const elementFont = await element.getCssValue('font-family');
const elementSize = await element.getCssValue('font-size');
const elementColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//text
if (elementText === ('View Matching Concepts')) {
console.log("Passed: Standard Code 1, Content Item 2, tags tool-tip text matched as expected");
} else {
errors.push(`Expected: Standard Code 1, Content Item 2, tags tool-tip text "View Matching Concepts"; Actual: "${elementText}"`);
}
//font
if (elementFont === 'FontAwesome') {
console.log('Passed: Standard Code 1, Content Item 2, tags tool-tip text font-family matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 2, tags tool-tip text font-family "FontAwesome"; Actual: ${elementFont}`);
}
//size
if (elementSize === '20px') {
console.log('Passed: Standard Code 1, Content Item 2, tags tool-tip text font-size matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 2, tags tool-tip text font-size "20px"; Actual: "${elementSize}"`);
}
//color
if (elementColor === 'rgba(73, 80, 87, 1)') {
console.log('Passed: Standard Code 1, Content Item 2, tags tool-tip text color matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 2, tags tool-tip text color "rgba(73, 80, 87, 1)"; Actual: "${elementColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Standard Code 1, Content Item 2, Grade 9 pause
{
description: 'Validate Standard Code 1, Content Item 2, Grade 9 pause icon',
action: async () => {
const element = await driver.findElement(By.css('.fa-pause-circle'));
//Track all errors
const errors = [];
//icon
if (element) {
console.log('Passed: Standard Code 1, Content Item 2, Grade 9 pause icon was found');
} else {
errors.push('Standard Code 1, Content Item 2, Grade 9 pause icon was not found');
}
}
},
//Standard Code 1, Content Item 2, Grade 10 checkmark
{
description: 'Validate Standard Code 1, Content Item 2, Grade 10 checkmark icon',
action: async () => {
const element = await driver.findElement(By.css('#\\35 1_1439153143_1162119829 .fa'));
//Track all errors
const errors = [];
//icon
if (element) {
console.log('Passed: Standard Code 1, Content Item 2, Grade 10 checkmark icon was found');
} else {
errors.push('Standard Code 1, Content Item 2, Grade 10 checkmark icon was not found');
}
}
},
//Standard Code 1, Content Item 2, Grade 11 checkmark
{
description: 'Validate Standard Code 1, Content Item 2, Grade 11 checkmark icon',
action: async () => {
const element = await driver.findElement(By.css('#\\35 2_1439153656_1162119829 .fa'));
//Track all errors
const errors = [];
//icon
if (element) {
console.log('Passed: Standard Code 1, Content Item 2, Grade 11 checkmark icon was found');
} else {
errors.push('Standard Code 1, Content Item 2, Grade 11 checkmark icon was not found');
}
}
},
//Standard Code 1, Content Item 2, Grade 12 checkmark
{
description: 'Validate Standard Code 1, Content Item 2, Grade 12 checkmark icon',
action: async () => {
const element = await driver.findElement(By.css('#\\35 3_1439154169_1162119829 .fa'));
//Track all errors
const errors = [];
//icon
if (element) {
console.log('Passed: Standard Code 1, Content Item 2, Grade 12 checkmark icon was found');
} else {
errors.push('Standard Code 1, Content Item 2, Grade 12 checkmark icon was not found');
}
}
},
//Standard Code 1, Content Item 2, All button
{
description: 'Validate Standard Code 1, Content Item 2, All button text, size, and color',
action: async () => {
const multipleChecks = 'Standard Code 1, Content Item 2, All button';
const element = await driver.findElement(By.css('#tr14391526301162119829 > .align-middle:nth-child(15) > .btn'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
const elementButtonColor = await element.getCssValue('background-color');
//Track all errors
const errors = [];
//text
if (elementText === 'All') {
console.log('Passed: Standard Code 1, Content Item 2, All button text matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 2, All button text "All"; Actual: "${elementText}"`);
}
//font
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Standard Code 1, Content Item 2, All button text font-family matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 2, All button text font-family "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//size
if (elementTextSize === '14px') {
console.log('Passed: Standard Code 1, Content Item 2, All button text font-size matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 2, All button text font-size "14px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(255, 255, 255, 1)') {
console.log('Passed: Standard Code 1, Content Item 2, All button text color matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 2, All button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`);
}
//button color
if (elementButtonColor === 'rgba(108, 117, 125, 1)') {
console.log('Passed: Standard Code 1, Content Item 2, All button background color matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 2, All button background color: "rgba(108, 117, 125, 1)"; Actual: "${elementButtonColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Standard Code 1, Content Item 2, Clear button
{
description: 'Validate Standard Code 1, Content Item 2, Clear button text, size, and color',
action: async () => {
const multipleChecks = 'Standard Code 1, Content Item 2, Clear button';
const element = await driver.findElement(By.css('#tr14391526301162119829 > .align-middle:nth-child(16) > .btn'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
const elementButtonColor = await element.getCssValue('background-color');
//Track all errors
const errors = [];
//text
if (elementText === 'Clear') {
console.log('Passed: Standard Code 1, Content Item 2, Clear button text matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 2, Clear button text "Clear"; Actual: "${elementText}"`);
}
//font
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Standard Code 1, Content Item 2, Clear button text font-family matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 2, Clear button text font-family "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//size
if (elementTextSize === '14px') {
console.log('Passed: Standard Code 1, Content Item 2, Clear button text font-size matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 2, Clear button text font-size "14px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(255, 255, 255, 1)') {
console.log('Passed: Standard Code 1, Content Item 2, Clear button text color matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 2, Clear button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`);
}
//button color
if (elementButtonColor === 'rgba(108, 117, 125, 1)') {
console.log('Passed: Standard Code 1, Content Item 2, Clear button background color matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 2, Clear button background color: "rgba(108, 117, 125, 1)"; Actual: "${elementButtonColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//NEXT ACTION
{
description: 'Click Standard Code 1, Content Item 2, Grade 9 pause icon',
action: async () => {
const element = await driver.findElement(By.css('.badge-danger')).catch(() => false);
await driver.findElement(By.css('.fa-pause-circle')).click();
console.log('----->| NEXT ACTION: Click Standard Code 1, Content Item 2, Grade 9 pause icon');
//Wait for page to load completely
await driver.wait(async () => {
const readyState = await driver.executeScript('return document.readyState');
return readyState === 'complete';
}, 30000, 'Search/Standards page did not fully load within 30 seconds');
//Wait for any loading spinners to disappear
await driver.wait(async () => {
try {
const spinners = await driver.findElements(By.css('.spinner-border'));
for (const spinner of spinners) {
if (await spinner.isDisplayed()) return false;
}
return true;
} catch (e) {
return true;
}
}, 30000, 'Loading spinner did not disappear within 30 seconds');
//Element may be removed from the DOM entirely or just hidden via CSS - handle both
if (element) {
await driver.wait(async () => {
try {
return !(await element.isDisplayed());
} catch (e) {
return true; //Stale reference means it was removed from the DOM
}
}, 5000, 'Standard Code 1, Content Item 2, hidden icon did not disappear as expected');
}
console.log('Passed: Standard Code 1, Content Item 2, hidden icon disappeared as expected');
}
},
//Standard Code 1, Content Item 2, link title
{
description: 'Validate Standard Code 1, Content Item 2, link title text, font, size color, and URL',
action: async () => {
const multipleChecks = 'Standard Code 1, Content Item 2, link title';
const element = await driver.findElement(By.linkText('Adding complex numbers (Video)'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementFont = await element.getCssValue('font-family');
const elementSize = await element.getCssValue('font-size');
const elementColor = await element.getCssValue('color');
const elementURL = await element.getAttribute('href');
//Track all errors
const errors = [];
//text
if (elementText === ('Adding complex numbers (Video)')) {
console.log("Passed: Standard Code 1, Content Item 2, link title text matched as expected");
} else {
errors.push(`Expected: "Adding complex numbers (Video)" Standard Code 1, Content Item 2, link title text; Actual: "${elementText}"`);
}
//font
if (elementFont === 'Poppins, sans-serif') {
console.log('Passed: Standard Code 1, Content Item 2, link title text font-family matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 2, link title text font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
}
//size
if (elementSize === '14.3px') {
console.log('Passed: Standard Code 1, Content Item 2, link title text font-size matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 2, link title text font-size "14.3px"; Actual: "${elementSize}"`);
}
//color
if (elementColor === 'rgba(73, 80, 87, 1)') {
console.log('Passed: Standard Code 1, Content Item 2, link title text color matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 2, link title text color "rgba(73, 80, 87, 1)"; Actual: "${elementColor}"`);
}
//url
if (elementURL === 'https://www.khanacademy.org/math/algebra2-2018/introduction-to-complex-numbers-algebra-2/adding-and-subtracting-complex-numbers-algebra-2/v/adding-complex-numbers') {
console.log('Passed: Standard Code 1, Content Item 2, link title URL matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 2, link title URL: "https://www.khanacademy.org/math/algebra2-2018/introduction-to-complex-numbers-algebra-2/adding-and-subtracting-complex-numbers-algebra-2/v/adding-complex-numbers"; Actual: "${elementURL}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Standard Code 1, Content Item 2, Info icon tool-tip
{
description: 'Validate Standard Code 1, Content Item 2, Info icon tool tip',
action: async () => {
const multipleChecks = 'Standard Code 1, Content Item 2, Info icon tool-tip';
const element = await driver.findElement(By.css('#title14391526301162119834 > a:nth-child(2)'));
//Get text, font, size, and color
const elementText = await element.getAttribute('title');
const elementFont = await element.getCssValue('font-family');
const elementSize = await element.getCssValue('font-size');
const elementColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//font
if (elementText === 'Click to view item description') {
console.log('Passed: Standard Code 1, Content Item 2, Info icon tool-tip text matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 2, Info icon tool-tip text "Click to view item description"; Actual: ${elementText}`);
}
//font
if (elementFont === 'Poppins, sans-serif') {
console.log('Passed: Standard Code 1, Content Item 2, Info icon tool-tip text font-family matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 2, Info icon tool-tip text font-family "Click to view item description"; Actual: ${elementFont}`);
}
//size
if (elementSize === '14.3px') {
console.log('Passed: Standard Code 1, Content Item 2, Info icon tool-tip text font-size matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 2, Info icon tool-tip text font-size "14.3px"; Actual: "${elementSize}"`);
}
//color
if (elementColor === 'rgba(73, 80, 87, 1)') {
console.log('Passed: Standard Code 1, Content Item 2, Info icon tool-tip text color matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 2, Info icon tool-tip text color "rgba(73, 80, 87, 1)"; Actual: "${elementColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Standard Code 1, Content Item 2, Primary badge
{
description: 'Validate Standard Code 1, Content Item 2, Primary badge text, font, size, and color',
action: async () => {
const multipleChecks = 'Standard Code 1, Content Item 2, Primary badge';
const element = await driver.findElement(By.css('#title14391526301162119829 > .badge'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementFont = await element.getCssValue('font-family');
const elementSize = await element.getCssValue('font-size');
const elementColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//font
if (elementText === 'Primary') {
console.log('Passed: Standard Code 1, Content Item 2, Primary badge text font-family matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 2, Primary badge text font-family "Primary"; Actual: ${elementText}`);
}
//font
if (elementFont === 'Poppins, sans-serif') {
console.log('Passed: Standard Code 1, Content Item 2, Primary badge text font-family matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 2, Primary badge text font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
}
//size
if (elementSize === '12.87px') {
console.log('Passed: Standard Code 1, Content Item 2, Primary badge text font-size matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 2, Primary badge text font-size "12.87px"; Actual: "${elementSize}"`);
}
//color
if (elementColor === 'rgba(255, 255, 255, 1)') {
console.log('Passed: Standard Code 1, Content Item 2, Primary badge text color matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 2, Primary badge text color "rgba(255, 255, 255, 1)"; Actual: "${elementColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Standard Code 1, Content Item 2, tags tool-tip
{
description: 'Validate Standard Code 1, Content Item 2, tags tool-tip text, font, size, and color',
action: async () => {
const multipleChecks = 'Standard Code 1, Content Item 2, tags tool-tip';
const element = await driver.findElement(By.css('#title14391526301162119829 > .fa'));
//Get text, font, size, and color
const elementText = await element.getAttribute('title');
const elementFont = await element.getCssValue('font-family');
const elementSize = await element.getCssValue('font-size');
const elementColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//text
if (elementText === ('View Matching Concepts')) {
console.log("Passed: Standard Code 1, Content Item 2, tags tool-tip text matched as expected");
} else {
errors.push(`Expected: Standard Code 1, Content Item 2, tags tool-tip text "View Matching Concepts"; Actual: "${elementText}"`);
}
//font
if (elementFont === 'FontAwesome') {
console.log('Passed: Standard Code 1, Content Item 2, tags tool-tip text font-family matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 2, tags tool-tip text font-family "FontAwesome"; Actual: ${elementFont}`);
}
//size
if (elementSize === '20px') {
console.log('Passed: Standard Code 1, Content Item 2, tags tool-tip text font-size matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 2, tags tool-tip text font-size "20px"; Actual: "${elementSize}"`);
}
//color
if (elementColor === 'rgba(73, 80, 87, 1)') {
console.log('Passed: Standard Code 1, Content Item 2, tags tool-tip text color matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 2, tags tool-tip text color "rgba(73, 80, 87, 1)"; Actual: "${elementColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Standard Code 1, Content Item 2, Grade 9 checkmark
{
description: 'Validate Standard Code 1, Content Item 2, Grade 9 checkmark icon',
action: async () => {
const element = await driver.findElement(By.css('#\\34 9_1439152630_1162119829 .fa'));
//Track all errors
const errors = [];
//icon
if (element) {
console.log('Passed: Standard Code 1, Content Item 2, Grade 9 checkmark icon was found');
} else {
errors.push('Standard Code 1, Content Item 2, Grade 9 checkmark icon was not found');
}
}
},
//Standard Code 1, Content Item 2, Grade 10 checkmark
{
description: 'Validate Standard Code 1, Content Item 2, Grade 10 checkmark icon',
action: async () => {
const element = await driver.findElement(By.css('#\\35 1_1439153143_1162119829 .fa'));
//Track all errors
const errors = [];
//icon
if (element) {
console.log('Passed: Standard Code 1, Content Item 2, Grade 10 checkmark icon was found');
} else {
errors.push('Standard Code 1, Content Item 2, Grade 10 checkmark icon was not found');
}
}
},
//Standard Code 1, Content Item 2, Grade 11 checkmark
{
description: 'Validate Standard Code 1, Content Item 2, Grade 11 checkmark icon',
action: async () => {
const element = await driver.findElement(By.css('#\\35 2_1439153656_1162119829 .fa'));
//Track all errors
const errors = [];
//icon
if (element) {
console.log('Passed: Standard Code 1, Content Item 2, Grade 11 checkmark icon was found');
} else {
errors.push('Standard Code 1, Content Item 2, Grade 11 checkmark icon was not found');
}
}
},
//Standard Code 1, Content Item 2, Grade 12 checkmark
{
description: 'Validate Standard Code 1, Content Item 2, Grade 12 checkmark icon',
action: async () => {
const element = await driver.findElement(By.css('#\\35 3_1439154169_1162119829 .fa'));
//Track all errors
const errors = [];
//icon
if (element) {
console.log('Passed: Standard Code 1, Content Item 2, Grade 12 checkmark icon was found');
} else {
errors.push('Standard Code 1, Content Item 2, Grade 12 checkmark icon was not found');
}
}
},
//Standard Code 1, Content Item 2, All button
{
description: 'Validate Standard Code 1, Content Item 2, All button text, size, and color',
action: async () => {
const multipleChecks = 'Standard Code 1, Content Item 2, All button';
const element = await driver.findElement(By.css('#tr14391526301162119829 > .align-middle:nth-child(15) > .btn'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
const elementButtonColor = await element.getCssValue('background-color');
//Track all errors
const errors = [];
//text
if (elementText === 'All') {
console.log('Passed: Standard Code 1, Content Item 2, All button text matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 2, All button text "All"; Actual: "${elementText}"`);
}
//font
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Standard Code 1, Content Item 2, All button text font-family matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 2, All button text font-family "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//size
if (elementTextSize === '14px') {
console.log('Passed: Standard Code 1, Content Item 2, All button text font-size matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 2, All button text font-size "14px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(255, 255, 255, 1)') {
console.log('Passed: Standard Code 1, Content Item 2, All button text color matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 2, All button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`);
}
//button color
if (elementButtonColor === 'rgba(108, 117, 125, 1)') {
console.log('Passed: Standard Code 1, Content Item 2, All button background color matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 2, All button background color: "rgba(108, 117, 125, 1)"; Actual: "${elementButtonColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Standard Code 1, Content Item 2, Clear button
{
description: 'Validate Standard Code 1, Content Item 2, Clear button text, size, and color',
action: async () => {
const multipleChecks = 'Standard Code 1, Content Item 2, Clear button';
const element = await driver.findElement(By.css('#tr14391526301162119829 > .align-middle:nth-child(16) > .btn'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
const elementButtonColor = await element.getCssValue('background-color');
//Track all errors
const errors = [];
//text
if (elementText === 'Clear') {
console.log('Passed: Standard Code 1, Content Item 2, Clear button text matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 2, Clear button text "Clear"; Actual: "${elementText}"`);
}
//font
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Standard Code 1, Content Item 2, Clear button text font-family matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 2, Clear button text font-family "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//size
if (elementTextSize === '14px') {
console.log('Passed: Standard Code 1, Content Item 2, Clear button text font-size matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 2, Clear button text font-size "14px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(255, 255, 255, 1)') {
console.log('Passed: Standard Code 1, Content Item 2, Clear button text color matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 2, Clear button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`);
}
//button color
if (elementButtonColor === 'rgba(108, 117, 125, 1)') {
console.log('Passed: Standard Code 1, Content Item 2, Clear button background color matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 2, Clear button background color: "rgba(108, 117, 125, 1)"; Actual: "${elementButtonColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Standard Code 1, Content Item 3, link title
{
description: 'Validate Standard Code 1, Content Item 3, link title text, font, size color, and URL',
action: async () => {
const multipleChecks = 'Standard Code 1, Content Item 3, link title';
const element = await driver.findElement(By.linkText('Analyzing event probability for independence (Video)'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementFont = await element.getCssValue('font-family');
const elementSize = await element.getCssValue('font-size');
const elementColor = await element.getCssValue('color');
const elementURL = await element.getAttribute('href');
//Track all errors
const errors = [];
//text
if (elementText === ('Analyzing event probability for independence (Video)')) {
console.log("Passed: Standard Code 1, Content Item 3, link title text matched as expected");
} else {
errors.push(`Expected: "Analyzing event probability for independence (Video)" Standard Code 1, Content Item 3, link title text; Actual: "${elementText}"`);
}
//font
if (elementFont === 'Poppins, sans-serif') {
console.log('Passed: Standard Code 1, Content Item 3, link title text font-family matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 3, link title text font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
}
//size
if (elementSize === '14.3px') {
console.log('Passed: Standard Code 1, Content Item 3, link title text font-size matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 3, link title text font-size "14.3px"; Actual: "${elementSize}"`);
}
//color
if (elementColor === 'rgba(73, 80, 87, 1)') {
console.log('Passed: Standard Code 1, Content Item 3, link title text color matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 3, link title text color "rgba(73, 80, 87, 1)"; Actual: "${elementColor}"`);
}
//url
if (elementURL === 'https://www.khanacademy.org/math/statistics-probability/probability-library/conditional-probability-independence/v/independent-dependent-probability') {
console.log('Passed: Standard Code 1, Content Item 3, link title URL matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 3, link title URL: "https://www.khanacademy.org/math/statistics-probability/probability-library/conditional-probability-independence/v/independent-dependent-probability"; Actual: "${elementURL}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Standard Code 1, Content Item 3, Info icon tool-tip
{
description: 'Validate Standard Code 1, Content Item 3, Info icon tool tip',
action: async () => {
const multipleChecks = 'Standard Code 1, Content Item 3, Info icon tool-tip';
const element = await driver.findElement(By.css('#title14391526301162119831 > a:nth-child(2)'));
//Get text, font, size, and color
const elementText = await element.getAttribute('title');
const elementFont = await element.getCssValue('font-family');
const elementSize = await element.getCssValue('font-size');
const elementColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//font
if (elementText === 'Click to view item description') {
console.log('Passed: Standard Code 1, Content Item 3, Info icon tool-tip text matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 3, Info icon tool-tip text "Click to view item description"; Actual: ${elementText}`);
}
//font
if (elementFont === 'Poppins, sans-serif') {
console.log('Passed: Standard Code 1, Content Item 3, Info icon tool-tip text font-family matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 3, Info icon tool-tip text font-family "Click to view item description"; Actual: ${elementFont}`);
}
//size
if (elementSize === '14.3px') {
console.log('Passed: Standard Code 1, Content Item 3, Info icon tool-tip text font-size matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 3, Info icon tool-tip text font-size "14.3px"; Actual: "${elementSize}"`);
}
//color
if (elementColor === 'rgba(73, 80, 87, 1)') {
console.log('Passed: Standard Code 1, Content Item 3, Info icon tool-tip text color matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 3, Info icon tool-tip text color "rgba(73, 80, 87, 1)"; Actual: "${elementColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Standard Code 1, Content Item 3, tags tool-tip
{
description: 'Validate Standard Code 1, Content Item 3, tags tool-tip text, font, size, and color',
action: async () => {
const multipleChecks = 'Standard Code 1, Content Item 3, tags tool-tip';
const element = await driver.findElement(By.css('#title14391526301162119831 > .fa'));
//Get text, font, size, and color
const elementText = await element.getAttribute('title');
const elementFont = await element.getCssValue('font-family');
const elementSize = await element.getCssValue('font-size');
const elementColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//text
if (elementText === ('View Matching Concepts')) {
console.log("Passed: Standard Code 1, Content Item 3, tags tool-tip text matched as expected");
} else {
errors.push(`Expected: Standard Code 1, Content Item 3, tags tool-tip text "View Matching Concepts"; Actual: "${elementText}"`);
}
//font
if (elementFont === 'FontAwesome') {
console.log('Passed: Standard Code 1, Content Item 3, tags tool-tip text font-family matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 3, tags tool-tip text font-family "FontAwesome"; Actual: ${elementFont}`);
}
//size
if (elementSize === '20px') {
console.log('Passed: Standard Code 1, Content Item 3, tags tool-tip text font-size matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 3, tags tool-tip text font-size "20px"; Actual: "${elementSize}"`);
}
//color
if (elementColor === 'rgba(73, 80, 87, 1)') {
console.log('Passed: Standard Code 1, Content Item 3, tags tool-tip text color matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 3, tags tool-tip text color "rgba(73, 80, 87, 1)"; Actual: "${elementColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Standard Code 1, Content Item 3, Grade 9 checkmark
{
description: 'Validate Standard Code 1, Content Item 3, Grade 9 checkmark icon',
action: async () => {
const element = await driver.findElement(By.css('#\\34 9_1439152630_1162119831 .fa'));
//Track all errors
const errors = [];
//icon
if (element) {
console.log('Passed: Standard Code 1, Content Item 3, Grade 9 checkmark icon was found');
} else {
errors.push('Standard Code 1, Content Item 3, Grade 9 checkmark icon was not found');
}
}
},
//Standard Code 1, Content Item 3, Grade 10 checkmark
{
description: 'Validate Standard Code 1, Content Item 3, Grade 10 checkmark icon',
action: async () => {
const element = await driver.findElement(By.css('#\\35 1_1439153143_1162119831 .fa'));
//Track all errors
const errors = [];
//icon
if (element) {
console.log('Passed: Standard Code 1, Content Item 3, Grade 10 checkmark icon was found');
} else {
errors.push('Standard Code 1, Content Item 3, Grade 10 checkmark icon was not found');
}
}
},
//Standard Code 1, Content Item 3, Grade 11 checkmark
{
description: 'Validate Standard Code 1, Content Item 3, Grade 11 checkmark icon',
action: async () => {
const element = await driver.findElement(By.css('#\\35 2_1439153656_1162119831 .fa'));
//Track all errors
const errors = [];
//icon
if (element) {
console.log('Passed: Standard Code 1, Content Item 3, Grade 11 checkmark icon was found');
} else {
errors.push('Standard Code 1, Content Item 3, Grade 11 checkmark icon was not found');
}
}
},
//Standard Code 1, Content Item 3, Grade 12 checkmark
{
description: 'Validate Standard Code 1, Content Item 3, Grade 12 checkmark icon',
action: async () => {
const element = await driver.findElement(By.css('#\\35 3_1439154169_1162119831 .fa'));
//Track all errors
const errors = [];
//icon
if (element) {
console.log('Passed: Standard Code 1, Content Item 3, Grade 12 checkmark icon was found');
} else {
errors.push('Standard Code 1, Content Item 3, Grade 12 checkmark icon was not found');
}
}
},
//Standard Code 1, Content Item 3, All button
{
description: 'Validate Standard Code 1, Content Item 3, All button text, size, and color',
action: async () => {
const multipleChecks = 'Standard Code 1, Content Item 3, All button';
const element = await driver.findElement(By.css('#tr14391526301162119831 > .align-middle:nth-child(15) > .btn'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
const elementButtonColor = await element.getCssValue('background-color');
//Track all errors
const errors = [];
//text
if (elementText === 'All') {
console.log('Passed: Standard Code 1, Content Item 3, All button text matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 3, All button text "All"; Actual: "${elementText}"`);
}
//font
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Standard Code 1, Content Item 3, All button text font-family matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 3, All button text font-family "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//size
if (elementTextSize === '14px') {
console.log('Passed: Standard Code 1, Content Item 3, All button text font-size matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 3, All button text font-size "14px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(255, 255, 255, 1)') {
console.log('Passed: Standard Code 1, Content Item 3, All button text color matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 3, All button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`);
}
//button color
if (elementButtonColor === 'rgba(108, 117, 125, 1)') {
console.log('Passed: Standard Code 1, Content Item 3, All button background color matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 3, All button background color: "rgba(108, 117, 125, 1)"; Actual: "${elementButtonColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Standard Code 1, Content Item 3, Clear button
{
description: 'Validate Standard Code 1, Content Item 3, Clear button text, size, and color',
action: async () => {
const multipleChecks = 'Standard Code 1, Content Item 3, Clear button';
const element = await driver.findElement(By.css('#tr14391526301162119831 > .align-middle:nth-child(16) > .btn'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
const elementButtonColor = await element.getCssValue('background-color');
//Track all errors
const errors = [];
//text
if (elementText === 'Clear') {
console.log('Passed: Standard Code 1, Content Item 3, Clear button text matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 3, Clear button text "Clear"; Actual: "${elementText}"`);
}
//font
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Standard Code 1, Content Item 3, Clear button text font-family matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 3, Clear button text font-family "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//size
if (elementTextSize === '14px') {
console.log('Passed: Standard Code 1, Content Item 3, Clear button text font-size matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 3, Clear button text font-size "14px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(255, 255, 255, 1)') {
console.log('Passed: Standard Code 1, Content Item 3, Clear button text color matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 3, Clear button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`);
}
//button color
if (elementButtonColor === 'rgba(108, 117, 125, 1)') {
console.log('Passed: Standard Code 1, Content Item 3, Clear button background color matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 3, Clear button background color: "rgba(108, 117, 125, 1)"; Actual: "${elementButtonColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Standard Code 1, Content Item 4, link title
{
description: 'Validate Standard Code 1, Content Item 4, link title text, font, size color, and URL',
action: async () => {
const multipleChecks = 'Standard Code 1, Content Item 4, link title';
const element = await driver.findElement(By.linkText('Angle relationships example (Video)'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementFont = await element.getCssValue('font-family');
const elementSize = await element.getCssValue('font-size');
const elementColor = await element.getCssValue('color');
const elementURL = await element.getAttribute('href');
//Track all errors
const errors = [];
//text
if (elementText === ('Angle relationships example (Video)')) {
console.log("Passed: Standard Code 1, Content Item 4, link title text matched as expected");
} else {
errors.push(`Expected: "Angle relationships example (Video)" Standard Code 1, Content Item 4, link title text; Actual: "${elementText}"`);
}
//font
if (elementFont === 'Poppins, sans-serif') {
console.log('Passed: Standard Code 1, Content Item 4, link title text font-family matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 4, link title text font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
}
//size
if (elementSize === '14.3px') {
console.log('Passed: Standard Code 1, Content Item 4, link title text font-size matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 4, link title text font-size "14.3px"; Actual: "${elementSize}"`);
}
//color
if (elementColor === 'rgba(73, 80, 87, 1)') {
console.log('Passed: Standard Code 1, Content Item 4, link title text color matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 4, link title text color "rgba(73, 80, 87, 1)"; Actual: "${elementColor}"`);
}
//url
if (elementURL === 'https://www.khanacademy.org/math/geometry-home/geometry-angles/geometry-vert-comp-supp/v/vertical-adjacent-and-linearly-paired-angles') {
console.log('Passed: Standard Code 1, Content Item 4, link title URL matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 4, link title URL: "https://www.khanacademy.org/math/geometry-home/geometry-angles/geometry-vert-comp-supp/v/vertical-adjacent-and-linearly-paired-angles"; Actual: "${elementURL}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Standard Code 1, Content Item 4, Info icon tool-tip
{
description: 'Validate Standard Code 1, Content Item 4, Info icon tool tip',
action: async () => {
const multipleChecks = 'Standard Code 1, Content Item 4, Info icon tool-tip';
const element = await driver.findElement(By.css ('#title14391526301162119832 > a:nth-child(2)'));
//Get text, font, size, and color
const elementText = await element.getAttribute('title');
const elementFont = await element.getCssValue('font-family');
const elementSize = await element.getCssValue('font-size');
const elementColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//font
if (elementText === 'Click to view item description') {
console.log('Passed: Standard Code 1, Content Item 4, Info icon tool-tip text matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 4, Info icon tool-tip text "Click to view item description"; Actual: ${elementText}`);
}
//font
if (elementFont === 'Poppins, sans-serif') {
console.log('Passed: Standard Code 1, Content Item 4, Info icon tool-tip text font-family matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 4, Info icon tool-tip text font-family "Click to view item description"; Actual: ${elementFont}`);
}
//size
if (elementSize === '14.3px') {
console.log('Passed: Standard Code 1, Content Item 4, Info icon tool-tip text font-size matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 4, Info icon tool-tip text font-size "14.3px"; Actual: "${elementSize}"`);
}
//color
if (elementColor === 'rgba(73, 80, 87, 1)') {
console.log('Passed: Standard Code 1, Content Item 4, Info icon tool-tip text color matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 4, Info icon tool-tip text color "rgba(73, 80, 87, 1)"; Actual: "${elementColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Standard Code 1, Content Item 4, tags tool-tip
{
description: 'Validate Standard Code 1, Content Item 4, tags tool-tip text, font, size, and color',
action: async () => {
const multipleChecks = 'Standard Code 1, Content Item 4, tags tool-tip';
const element = await driver.findElement(By.css('#title14391526301162119832 > .fa'));
//Get text, font, size, and color
const elementText = await element.getAttribute('title');
const elementFont = await element.getCssValue('font-family');
const elementSize = await element.getCssValue('font-size');
const elementColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//text
if (elementText === ('View Matching Concepts')) {
console.log("Passed: Standard Code 1, Content Item 4, tags tool-tip text matched as expected");
} else {
errors.push(`Expected: Standard Code 1, Content Item 4, tags tool-tip text "View Matching Concepts"; Actual: "${elementText}"`);
}
//font
if (elementFont === 'FontAwesome') {
console.log('Passed: Standard Code 1, Content Item 4, tags tool-tip text font-family matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 4, tags tool-tip text font-family "FontAwesome"; Actual: ${elementFont}`);
}
//size
if (elementSize === '20px') {
console.log('Passed: Standard Code 1, Content Item 4, tags tool-tip text font-size matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 4, tags tool-tip text font-size "20px"; Actual: "${elementSize}"`);
}
//color
if (elementColor === 'rgba(73, 80, 87, 1)') {
console.log('Passed: Standard Code 1, Content Item 4, tags tool-tip text color matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 4, tags tool-tip text color "rgba(73, 80, 87, 1)"; Actual: "${elementColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Standard Code 1, Content Item 4, Grade 9 checkmark
{
description: 'Validate Standard Code 1, Content Item 4, Grade 9 checkmark icon',
action: async () => {
const element = await driver.findElement(By.css('#\\34 9_1439152630_1162119832 .fa'));
//Track all errors
const errors = [];
//icon
if (element) {
console.log('Passed: Standard Code 1, Content Item 4, Grade 9 checkmark icon was found');
} else {
errors.push('Standard Code 1, Content Item 4, Grade 9 checkmark icon was not found');
}
}
},
//Standard Code 1, Content Item 4, Grade 10 checkmark
{
description: 'Validate Standard Code 1, Content Item 4, Grade 10 checkmark icon',
action: async () => {
const element = await driver.findElement(By.css('#\\35 1_1439153143_1162119832 .fa'));
//Track all errors
const errors = [];
//icon
if (element) {
console.log('Passed: Standard Code 1, Content Item 4, Grade 10 checkmark icon was found');
} else {
errors.push('Standard Code 1, Content Item 4, Grade 10 checkmark icon was not found');
}
}
},
//Standard Code 1, Content Item 4, Grade 11 checkmark
{
description: 'Validate Standard Code 1, Content Item 4, Grade 11 checkmark icon',
action: async () => {
const element = await driver.findElement(By.css('#\\35 2_1439153656_1162119832 .fa'));
//Track all errors
const errors = [];
//icon
if (element) {
console.log('Passed: Standard Code 1, Content Item 4, Grade 11 checkmark icon was found');
} else {
errors.push('Standard Code 1, Content Item 4, Grade 11 checkmark icon was not found');
}
}
},
//Standard Code 1, Content Item 4, Grade 12 checkmark
{
description: 'Validate Standard Code 1, Content Item 4, Grade 12 checkmark icon',
action: async () => {
const element = await driver.findElement(By.css('#\\35 3_1439154169_1162119832 .fa'));
//Track all errors
const errors = [];
//icon
if (element) {
console.log('Passed: Standard Code 1, Content Item 4, Grade 12 checkmark icon was found');
} else {
errors.push('Standard Code 1, Content Item 4, Grade 12 checkmark icon was not found');
}
}
},
//Standard Code 1, Content Item 4, All button
{
description: 'Validate Standard Code 1, Content Item 4, All button text, size, and color',
action: async () => {
const multipleChecks = 'Standard Code 1, Content Item 4, All button';
const element = await driver.findElement(By.css('#tr14391526301162119832 > .align-middle:nth-child(15) > .btn'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
const elementButtonColor = await element.getCssValue('background-color');
//Track all errors
const errors = [];
//text
if (elementText === 'All') {
console.log('Passed: Standard Code 1, Content Item 4, All button text matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 4, All button text "All"; Actual: "${elementText}"`);
}
//font
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Standard Code 1, Content Item 4, All button text font-family matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 4, All button text font-family "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//size
if (elementTextSize === '14px') {
console.log('Passed: Standard Code 1, Content Item 4, All button text font-size matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 4, All button text font-size "14px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(255, 255, 255, 1)') {
console.log('Passed: Standard Code 1, Content Item 4, All button text color matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 4, All button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`);
}
//button color
if (elementButtonColor === 'rgba(108, 117, 125, 1)') {
console.log('Passed: Standard Code 1, Content Item 4, All button background color matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 4, All button background color: "rgba(108, 117, 125, 1)"; Actual: "${elementButtonColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Standard Code 1, Content Item 4, Clear button
{
description: 'Validate Standard Code 1, Content Item 4, Clear button text, size, and color',
action: async () => {
const multipleChecks = 'Standard Code 1, Content Item 4, Clear button';
const element = await driver.findElement(By.css('#tr14391526301162119832 > .align-middle:nth-child(16) > .btn'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
const elementButtonColor = await element.getCssValue('background-color');
//Track all errors
const errors = [];
//text
if (elementText === 'Clear') {
console.log('Passed: Standard Code 1, Content Item 4, Clear button text matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 4, Clear button text "Clear"; Actual: "${elementText}"`);
}
//font
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Standard Code 1, Content Item 4, Clear button text font-family matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 4, Clear button text font-family "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//size
if (elementTextSize === '14px') {
console.log('Passed: Standard Code 1, Content Item 4, Clear button text font-size matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 4, Clear button text font-size "14px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(255, 255, 255, 1)') {
console.log('Passed: Standard Code 1, Content Item 4, Clear button text color matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 4, Clear button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`);
}
//button color
if (elementButtonColor === 'rgba(108, 117, 125, 1)') {
console.log('Passed: Standard Code 1, Content Item 4, Clear button background color matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 4, Clear button background color: "rgba(108, 117, 125, 1)"; Actual: "${elementButtonColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Standard Code 1, Content Item 5, link title
{
description: 'Validate Standard Code 1, Content Item 5, link title text, font, size color, and URL',
action: async () => {
const multipleChecks = 'Standard Code 1, Content Item 5, link title';
const element = await driver.findElement(By.linkText('Arctic Tern'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementFont = await element.getCssValue('font-family');
const elementSize = await element.getCssValue('font-size');
const elementColor = await element.getCssValue('color');
const elementURL = await element.getAttribute('href');
//Track all errors
const errors = [];
//text
if (elementText === ('Arctic Tern')) {
console.log("Passed: Standard Code 1, Content Item 5, link title text matched as expected");
} else {
errors.push(`Expected: "Arctic Tern" Standard Code 1, Content Item 5, link title text; Actual: "${elementText}"`);
}
//font
if (elementFont === 'Poppins, sans-serif') {
console.log('Passed: Standard Code 1, Content Item 5, link title text font-family matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 5, link title text font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
}
//size
if (elementSize === '14.3px') {
console.log('Passed: Standard Code 1, Content Item 5, link title text font-size matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 5, link title text font-size "14.3px"; Actual: "${elementSize}"`);
}
//color
if (elementColor === 'rgba(73, 80, 87, 1)') {
console.log('Passed: Standard Code 1, Content Item 5, link title text color matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 5, link title text color "rgba(73, 80, 87, 1)"; Actual: "${elementColor}"`);
}
//url
if (elementURL === 'https://www.nationalgeographic.org/media/tern-wings/') {
console.log('Passed: Standard Code 1, Content Item 5, link title URL matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 5, link title URL: "https://www.nationalgeographic.org/media/tern-wings/"; Actual: "${elementURL}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Standard Code 1, Content Item 5, Info icon tool-tip
{
description: 'Validate Standard Code 1, Content Item 5, Info icon tool tip',
action: async () => {
const multipleChecks = 'Standard Code 1, Content Item 5, Info icon tool-tip';
const element = await driver.findElement(By.css ('#title14391526301162119835 > a:nth-child(2)'));
//Get text, font, size, and color
const elementText = await element.getAttribute('title');
const elementFont = await element.getCssValue('font-family');
const elementSize = await element.getCssValue('font-size');
const elementColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//font
if (elementText === 'Click to view item description') {
console.log('Passed: Standard Code 1, Content Item 5, Info icon tool-tip text matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 5, Info icon tool-tip text "Click to view item description"; Actual: ${elementText}`);
}
//font
if (elementFont === 'Poppins, sans-serif') {
console.log('Passed: Standard Code 1, Content Item 5, Info icon tool-tip text font-family matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 5, Info icon tool-tip text font-family "Click to view item description"; Actual: ${elementFont}`);
}
//size
if (elementSize === '14.3px') {
console.log('Passed: Standard Code 1, Content Item 5, Info icon tool-tip text font-size matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 5, Info icon tool-tip text font-size "14.3px"; Actual: "${elementSize}"`);
}
//color
if (elementColor === 'rgba(73, 80, 87, 1)') {
console.log('Passed: Standard Code 1, Content Item 5, Info icon tool-tip text color matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 5, Info icon tool-tip text color "rgba(73, 80, 87, 1)"; Actual: "${elementColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Standard Code 1, Content Item 5, tags tool-tip
{
description: 'Validate Standard Code 1, Content Item 5, tags tool-tip text, font, size, and color',
action: async () => {
const multipleChecks = 'Standard Code 1, Content Item 5, tags tool-tip';
const element = await driver.findElement(By.css('#title14391526301162119835 > .fa'));
//Get text, font, size, and color
const elementText = await element.getAttribute('title');
const elementFont = await element.getCssValue('font-family');
const elementSize = await element.getCssValue('font-size');
const elementColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//text
if (elementText === ('View Matching Concepts')) {
console.log("Passed: Standard Code 1, Content Item 5, tags tool-tip text matched as expected");
} else {
errors.push(`Expected: Standard Code 1, Content Item 5, tags tool-tip text "View Matching Concepts"; Actual: "${elementText}"`);
}
//font
if (elementFont === 'FontAwesome') {
console.log('Passed: Standard Code 1, Content Item 5, tags tool-tip text font-family matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 5, tags tool-tip text font-family "FontAwesome"; Actual: ${elementFont}`);
}
//size
if (elementSize === '20px') {
console.log('Passed: Standard Code 1, Content Item 5, tags tool-tip text font-size matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 5, tags tool-tip text font-size "20px"; Actual: "${elementSize}"`);
}
//color
if (elementColor === 'rgba(73, 80, 87, 1)') {
console.log('Passed: Standard Code 1, Content Item 5, tags tool-tip text color matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 5, tags tool-tip text color "rgba(73, 80, 87, 1)"; Actual: "${elementColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Standard Code 1, Content Item 5, Grade 6 checkmark
{
description: 'Validate Standard Code 1, Content Item 5, Grade 6 checkmark icon',
action: async () => {
const element = await driver.findElement(By.css('#\\34 5_1439152196_1162119835 .fa'));
//Track all errors
const errors = [];
//icon
if (element) {
console.log('Passed: Standard Code 1, Content Item 5, Grade 6 checkmark icon was found');
} else {
errors.push('Standard Code 1, Content Item 5, Grade 6 checkmark icon was not found');
}
}
},
//Standard Code 1, Content Item 5, Grade 7 checkmark
{
description: 'Validate Standard Code 1, Content Item 5, Grade 7 checkmark icon',
action: async () => {
const element = await driver.findElement(By.css('#\\34 7_1439152274_1162119835 .fa'));
//Track all errors
const errors = [];
//icon
if (element) {
console.log('Passed: Standard Code 1, Content Item 5, Grade 7 checkmark icon was found');
} else {
errors.push('Standard Code 1, Content Item 5, Grade 7 checkmark icon was not found');
}
}
},
//Standard Code 1, Content Item 5, Grade 8 checkmark
{
description: 'Validate Standard Code 1, Content Item 5, Grade 8 checkmark icon',
action: async () => {
const element = await driver.findElement(By.css('#\\34 8_1439152451_1162119835 .fa'));
//Track all errors
const errors = [];
//icon
if (element) {
console.log('Passed: Standard Code 1, Content Item 5, Grade 8 checkmark icon was found');
} else {
errors.push('Standard Code 1, Content Item 5, Grade 8 checkmark icon was not found');
}
}
},
//Standard Code 1, Content Item 5, Grade 9 checkmark
{
description: 'Validate Standard Code 1, Content Item 5, Grade 9 checkmark icon',
action: async () => {
const element = await driver.findElement(By.css('#\\34 9_1439152630_1162119835 .fa'));
//Track all errors
const errors = [];
//icon
if (element) {
console.log('Passed: Standard Code 1, Content Item 5, Grade 9 checkmark icon was found');
} else {
errors.push('Standard Code 1, Content Item 5, Grade 9 checkmark icon was not found');
}
}
},
//Standard Code 1, Content Item 5, Grade 10 checkmark
{
description: 'Validate Standard Code 1, Content Item 5, Grade 10 checkmark icon',
action: async () => {
const element = await driver.findElement(By.css('#\\35 1_1439153143_1162119835 .fa'));
//Track all errors
const errors = [];
//icon
if (element) {
console.log('Passed: Standard Code 1, Content Item 5, Grade 10 checkmark icon was found');
} else {
errors.push('Standard Code 1, Content Item 5, Grade 10 checkmark icon was not found');
}
}
},
//Standard Code 1, Content Item 5, Grade 11 checkmark
{
description: 'Validate Standard Code 1, Content Item 5, Grade 11 checkmark icon',
action: async () => {
const element = await driver.findElement(By.css('#\\35 2_1439153656_1162119835 .fa'));
//Track all errors
const errors = [];
//icon
if (element) {
console.log('Passed: Standard Code 1, Content Item 5, Grade 11 checkmark icon was found');
} else {
errors.push('Standard Code 1, Content Item 5, Grade 11 checkmark icon was not found');
}
}
},
//Standard Code 1, Content Item 5, Grade 12 checkmark
{
description: 'Validate Standard Code 1, Content Item 5, Grade 12 checkmark icon',
action: async () => {
const element = await driver.findElement(By.css('#\\35 3_1439154169_1162119835 .fa'));
//Track all errors
const errors = [];
//icon
if (element) {
console.log('Passed: Standard Code 1, Content Item 5, Grade 12 checkmark icon was found');
} else {
errors.push('Standard Code 1, Content Item 5, Grade 12 checkmark icon was not found');
}
}
},
//Standard Code 1, Content Item 5, All button
{
description: 'Validate Standard Code 1, Content Item 5, All button text, size, and color',
action: async () => {
const multipleChecks = 'Standard Code 1, Content Item 5, All button';
const element = await driver.findElement(By.css('#tr14391526301162119835 > .align-middle:nth-child(15) > .btn'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
const elementButtonColor = await element.getCssValue('background-color');
//Track all errors
const errors = [];
//text
if (elementText === 'All') {
console.log('Passed: Standard Code 1, Content Item 5, All button text matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 5, All button text "All"; Actual: "${elementText}"`);
}
//font
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Standard Code 1, Content Item 5, All button text font-family matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 5, All button text font-family "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//size
if (elementTextSize === '14px') {
console.log('Passed: Standard Code 1, Content Item 5, All button text font-size matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 5, All button text font-size "14px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(255, 255, 255, 1)') {
console.log('Passed: Standard Code 1, Content Item 5, All button text color matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 5, All button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`);
}
//button color
if (elementButtonColor === 'rgba(108, 117, 125, 1)') {
console.log('Passed: Standard Code 1, Content Item 5, All button background color matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 5, All button background color: "rgba(108, 117, 125, 1)"; Actual: "${elementButtonColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Standard Code 1, Content Item 5, Clear button
{
description: 'Validate Standard Code 1, Content Item 5, Clear button text, size, and color',
action: async () => {
const multipleChecks = 'Standard Code 1, Content Item 5, Clear button';
const element = await driver.findElement(By.css('#tr14391526301162119835 > .align-middle:nth-child(16) > .btn'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
const elementButtonColor = await element.getCssValue('background-color');
//Track all errors
const errors = [];
//text
if (elementText === 'Clear') {
console.log('Passed: Standard Code 1, Content Item 5, Clear button text matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 5, Clear button text "Clear"; Actual: "${elementText}"`);
}
//font
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Standard Code 1, Content Item 5, Clear button text font-family matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 5, Clear button text font-family "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//size
if (elementTextSize === '14px') {
console.log('Passed: Standard Code 1, Content Item 5, Clear button text font-size matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 5, Clear button text font-size "14px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(255, 255, 255, 1)') {
console.log('Passed: Standard Code 1, Content Item 5, Clear button text color matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 5, Clear button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`);
}
//button color
if (elementButtonColor === 'rgba(108, 117, 125, 1)') {
console.log('Passed: Standard Code 1, Content Item 5, Clear button background color matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 5, Clear button background color: "rgba(108, 117, 125, 1)"; Actual: "${elementButtonColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Content Item 6, link title
{
description: 'Validate Content Item 6, link title text, font, size, color, and URL',
action: async () => {
const multipleChecks = 'Content Item 6 link title';
const element = await driver.findElement(By.linkText('Area of a triangle on a grid (Video)'));
//Get text, font, size, color, and background color
const elementText = await element.getText();
const elementFont = await element.getCssValue('font-family');
const elementSize = await element.getCssValue('font-size');
const elementColor = await element.getCssValue('color');
const elementURL = await element.getAttribute('href');
//Track all errors
const errors = [];
//text
if (elementText === ('Area of a triangle on a grid (Video)')) {
console.log("Passed: Content Item 6, link title text matched as expected");
} else {
errors.push(`Expected: "Area of a triangle on a grid (Video)" Content Item 6, link title text; Actual: "${elementText}"`);
}
//font
if (elementFont === 'Poppins, sans-serif') {
console.log('Passed: Content Item 6, link title text font-family matched as expected');
} else {
errors.push(`Expected: Content Item 6, link title text font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
}
//size
if (elementSize === '14.3px') {
console.log('Passed: Content Item 6, link title text font-size matched as expected');
} else {
errors.push(`Expected: Content Item 6, link title text font-size "14.3px"; Actual: "${elementSize}"`);
}
//color
if (elementColor === 'rgba(73, 80, 87, 1)') {
console.log('Passed: Content Item 6, link title text color matched as expected');
} else {
errors.push(`Expected: Content Item 6, link title text color "rgba(73, 80, 87, 1)"; Actual: "${elementColor}"`);
}
//url
if (elementURL === 'https://www.khanacademy.org/math/geometry-home/geometry-area-perimeter/geometry-area-shapes-grids/v/area-of-triangle-in-grid') {
console.log('Passed: Content Item 6, link title URL matched as expected');
} else {
errors.push(`Expected: Content Item 6, link title URL: "https://www.khanacademy.org/math/geometry-home/geometry-area-perimeter/geometry-area-shapes-grids/v/area-of-triangle-in-grid"; Actual: "${elementURL}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Content Item 6, Info icon tool-tip
{
description: 'Validate Content Item 6, Info icon tool tip',
action: async () => {
const multipleChecks = 'Content Item 6, Info icon tool-tip';
const element = await driver.findElement(By.css('#title14391526301162119836 > a:nth-child(2)'));
//Get text, font, size, and color
const elementText = await element.getAttribute('title');
const elementFont = await element.getCssValue('font-family');
const elementSize = await element.getCssValue('font-size');
const elementColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//font
if (elementText === 'Click to view item description') {
console.log('Passed: Content Item 6, Info icon tool-tip text matched as expected');
} else {
errors.push(`Expected: Content Item 6, Info icon tool-tip text "Click to view item description"; Actual: ${elementText}`);
}
//font
if (elementFont === 'Poppins, sans-serif') {
console.log('Passed: Content Item 6, Info icon tool-tip text font-family matched as expected');
} else {
errors.push(`Expected: Content Item 6, Info icon tool-tip text font-family "Click to view item description"; Actual: ${elementFont}`);
}
//size
if (elementSize === '14.3px') {
console.log('Passed: Content Item 6, Info icon tool-tip text font-size matched as expected');
} else {
errors.push(`Expected: Content Item 6, Info icon tool-tip text font-size "14.3px"; Actual: "${elementSize}"`);
}
//color
if (elementColor === 'rgba(73, 80, 87, 1)') {
console.log('Passed: Content Item 6, Info icon tool-tip text color matched as expected');
} else {
errors.push(`Expected: Content Item 6, Info icon tool-tip text color "rgba(73, 80, 87, 1)"; Actual: "${elementColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Standard Code 1, Content Item 6, Primary badge
{
description: 'Validate Standard Code 1, Content Item 6, Primary badge text, font, size, and color',
action: async () => {
const multipleChecks = 'Standard Code 1, Content Item 6, Primary badge';
const element = await driver.findElement(By.css('#title14391526301162119836 > .badge'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementFont = await element.getCssValue('font-family');
const elementSize = await element.getCssValue('font-size');
const elementColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//font
if (elementText === 'Primary') {
console.log('Passed: Standard Code 1, Content Item 6, Primary badge text font-family matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 6, Primary badge text font-family "Primary"; Actual: ${elementText}`);
}
//font
if (elementFont === 'Poppins, sans-serif') {
console.log('Passed: Standard Code 1, Content Item 6, Primary badge text font-family matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 6, Primary badge text font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
}
//size
if (elementSize === '12.87px') {
console.log('Passed: Standard Code 1, Content Item 6, Primary badge text font-size matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 6, Primary badge text font-size "12.87px"; Actual: "${elementSize}"`);
}
//color
if (elementColor === 'rgba(255, 255, 255, 1)') {
console.log('Passed: Standard Code 1, Content Item 6, Primary badge text color matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 6, Primary badge text color "rgba(255, 255, 255, 1)"; Actual: "${elementColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Standard Code 1, Content Item 6, tags tool-tip
{
description: 'Validate Standard Code 1, Content Item 6, tags tool-tip text, font, size, and color',
action: async () => {
const multipleChecks = 'Standard Code 1, Content Item 6, tags tool-tip';
const element = await driver.findElement(By.css('#title14391526301162119836 > .fa'));
//Get text, font, size, and color
const elementText = await element.getAttribute('title');
const elementFont = await element.getCssValue('font-family');
const elementSize = await element.getCssValue('font-size');
const elementColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//text
if (elementText === ('View Matching Concepts')) {
console.log("Passed: Standard Code 1, Content Item 6, tags tool-tip text matched as expected");
} else {
errors.push(`Expected: Standard Code 1, Content Item 6, tags tool-tip text "View Matching Concepts"; Actual: "${elementText}"`);
}
//font
if (elementFont === 'FontAwesome') {
console.log('Passed: Standard Code 1, Content Item 6, tags tool-tip text font-family matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 6, tags tool-tip text font-family "FontAwesome"; Actual: ${elementFont}`);
}
//size
if (elementSize === '20px') {
console.log('Passed: Standard Code 1, Content Item 6, tags tool-tip text font-size matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 6, tags tool-tip text font-size "20px"; Actual: "${elementSize}"`);
}
//color
if (elementColor === 'rgba(73, 80, 87, 1)') {
console.log('Passed: Standard Code 1, Content Item 6, tags tool-tip text color matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 6, tags tool-tip text color "rgba(73, 80, 87, 1)"; Actual: "${elementColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Standard Code 1, Content Item 6, Grade 9 checkmark
{
description: 'Validate Standard Code 1, Content Item 6, Grade 9 checkmark icon',
action: async () => {
const element = await driver.findElement(By.css('#\\34 9_1439152630_1162119836 .fa'));
//Track all errors
const errors = [];
//icon
if (element) {
console.log('Passed: Standard Code 1, Content Item 6, Grade 9 checkmark icon was found');
} else {
errors.push('Standard Code 1, Content Item 6, Grade 9 checkmark icon was not found');
}
}
},
//Standard Code 1, Content Item 6, Grade 10 checkmark
{
description: 'Validate Standard Code 1, Content Item 6, Grade 10 checkmark icon',
action: async () => {
const element = await driver.findElement(By.css('#\\35 1_1439153143_1162119836 .fa'));
//Track all errors
const errors = [];
//icon
if (element) {
console.log('Passed: Standard Code 1, Content Item 6, Grade 10 checkmark icon was found');
} else {
errors.push('Standard Code 1, Content Item 6, Grade 10 checkmark icon was not found');
}
}
},
//Standard Code 1, Content Item 6, Grade 11 checkmark
{
description: 'Validate Standard Code 1, Content Item 6, Grade 11 checkmark icon',
action: async () => {
const element = await driver.findElement(By.css('#\\35 2_1439153656_1162119836 .fa'));
//Track all errors
const errors = [];
//icon
if (element) {
console.log('Passed: Standard Code 1, Content Item 6, Grade 11 checkmark icon was found');
} else {
errors.push('Standard Code 1, Content Item 6, Grade 11 checkmark icon was not found');
}
}
},
//Standard Code 1, Content Item 6, Grade 12 checkmark
{
description: 'Validate Standard Code 1, Content Item 6, Grade 12 checkmark icon',
action: async () => {
const element = await driver.findElement(By.css('#\\35 3_1439154169_1162119836 .fa'));
//Track all errors
const errors = [];
//icon
if (element) {
console.log('Passed: Standard Code 1, Content Item 6, Grade 12 checkmark icon was found');
} else {
errors.push('Standard Code 1, Content Item 6, Grade 12 checkmark icon was not found');
}
}
},
//Standard Code 1, Content Item 6, All button
{
description: 'Validate Standard Code 1, Content Item 6, All button text, size, and color',
action: async () => {
const multipleChecks = 'Standard Code 1, Content Item 6, All button';
const element = await driver.findElement(By.css('#tr14391526301162119836 > .align-middle:nth-child(15) > .btn'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
const elementButtonColor = await element.getCssValue('background-color');
//Track all errors
const errors = [];
//text
if (elementText === 'All') {
console.log('Passed: Standard Code 1, Content Item 6, All button text matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 6, All button text "All"; Actual: "${elementText}"`);
}
//font
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Standard Code 1, Content Item 6, All button text font-family matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 6, All button text font-family "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//size
if (elementTextSize === '14px') {
console.log('Passed: Standard Code 1, Content Item 6, All button text font-size matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 6, All button text font-size "14px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(255, 255, 255, 1)') {
console.log('Passed: Standard Code 1, Content Item 6, All button text color matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 6, All button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`);
}
//button color
if (elementButtonColor === 'rgba(108, 117, 125, 1)') {
console.log('Passed: Standard Code 1, Content Item 6, All button background color matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 6, All button background color: "rgba(108, 117, 125, 1)"; Actual: "${elementButtonColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Standard Code 1, Content Item 6, Clear button
{
description: 'Validate Standard Code 1, Content Item 6, Clear button text, size, and color',
action: async () => {
const multipleChecks = 'Standard Code 1, Content Item 6, Clear button';
const element = await driver.findElement(By.css('#tr14391526301162119836 > .align-middle:nth-child(16) > .btn'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
const elementButtonColor = await element.getCssValue('background-color');
//Track all errors
const errors = [];
//text
if (elementText === 'Clear') {
console.log('Passed: Standard Code 1, Content Item 6, Clear button text matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 6, Clear button text "Clear"; Actual: "${elementText}"`);
}
//font
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Standard Code 1, Content Item 6, Clear button text font-family matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 6, Clear button text font-family "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//size
if (elementTextSize === '14px') {
console.log('Passed: Standard Code 1, Content Item 6, Clear button text font-size matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 6, Clear button text font-size "14px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(255, 255, 255, 1)') {
console.log('Passed: Standard Code 1, Content Item 6, Clear button text color matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 6, Clear button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`);
}
//button color
if (elementButtonColor === 'rgba(108, 117, 125, 1)') {
console.log('Passed: Standard Code 1, Content Item 6, Clear button background color matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 6, Clear button background color: "rgba(108, 117, 125, 1)"; Actual: "${elementButtonColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Standard Code 1, Content Item 7, link title
{
description: 'Validate Standard Code 1, Content Item 7, link title text, font, size color, and URL',
action: async () => {
const multipleChecks = 'Standard Code 1, Content Item 7, link title';
const element = await driver.findElement(By.linkText('Bear Bones'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementFont = await element.getCssValue('font-family');
const elementSize = await element.getCssValue('font-size');
const elementColor = await element.getCssValue('color');
const elementURL = await element.getAttribute('href');
//Track all errors
const errors = [];
//text
if (elementText === ('Bear Bones')) {
console.log("Passed: Standard Code 1, Content Item 7, link title text matched as expected");
} else {
errors.push(`Expected: "Bear Bones" Standard Code 1, Content Item 7, link title text; Actual: "${elementText}"`);
}
//font
if (elementFont === 'Poppins, sans-serif') {
console.log('Passed: Standard Code 1, Content Item 7, link title text font-family matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 7, link title text font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
}
//size
if (elementSize === '14.3px') {
console.log('Passed: Standard Code 1, Content Item 7, link title text font-size matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 7, link title text font-size "14.3px"; Actual: "${elementSize}"`);
}
//color
if (elementColor === 'rgba(73, 80, 87, 1)') {
console.log('Passed: Standard Code 1, Content Item 7, link title text color matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 7, link title text color "rgba(73, 80, 87, 1)"; Actual: "${elementColor}"`);
}
//url
if (elementURL === 'http://sciencenetlinks.com/science-news/science-updates/bear-bones/') {
console.log('Passed: Standard Code 1, Content Item 7, link title URL matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 7, link title URL: "http://sciencenetlinks.com/science-news/science-updates/bear-bones/"; Actual: "${elementURL}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Standard Code 1, Content Item 7, Info icon tool-tip
{
description: 'Validate Standard Code 1, Content Item 7, Info icon tool tip',
action: async () => {
const multipleChecks = 'Standard Code 1, Content Item 7, Info icon tool-tip';
const element = await driver.findElement(By.css ('#title14391526301162119840 > a:nth-child(2)'));
//Get text, font, size, and color
const elementText = await element.getAttribute('title');
const elementFont = await element.getCssValue('font-family');
const elementSize = await element.getCssValue('font-size');
const elementColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//font
if (elementText === 'Click to view item description') {
console.log('Passed: Standard Code 1, Content Item 7, Info icon tool-tip text matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 7, Info icon tool-tip text "Click to view item description"; Actual: ${elementText}`);
}
//font
if (elementFont === 'Poppins, sans-serif') {
console.log('Passed: Standard Code 1, Content Item 7, Info icon tool-tip text font-family matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 7, Info icon tool-tip text font-family "Click to view item description"; Actual: ${elementFont}`);
}
//size
if (elementSize === '14.3px') {
console.log('Passed: Standard Code 1, Content Item 7, Info icon tool-tip text font-size matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 7, Info icon tool-tip text font-size "14.3px"; Actual: "${elementSize}"`);
}
//color
if (elementColor === 'rgba(73, 80, 87, 1)') {
console.log('Passed: Standard Code 1, Content Item 7, Info icon tool-tip text color matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 7, Info icon tool-tip text color "rgba(73, 80, 87, 1)"; Actual: "${elementColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Standard Code 1, Content Item 7, tags tool-tip
{
description: 'Validate Standard Code 1, Content Item 7, tags tool-tip text, font, size, and color',
action: async () => {
const multipleChecks = 'Standard Code 1, Content Item 7, tags tool-tip';
const element = await driver.findElement(By.css('#title14391526301162119840 > .fa'));
//Get text, font, size, and color
const elementText = await element.getAttribute('title');
const elementFont = await element.getCssValue('font-family');
const elementSize = await element.getCssValue('font-size');
const elementColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//text
if (elementText === ('View Matching Concepts')) {
console.log("Passed: Standard Code 1, Content Item 7, tags tool-tip text matched as expected");
} else {
errors.push(`Expected: Standard Code 1, Content Item 7, tags tool-tip text "View Matching Concepts"; Actual: "${elementText}"`);
}
//font
if (elementFont === 'FontAwesome') {
console.log('Passed: Standard Code 1, Content Item 7, tags tool-tip text font-family matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 7, tags tool-tip text font-family "FontAwesome"; Actual: ${elementFont}`);
}
//size
if (elementSize === '20px') {
console.log('Passed: Standard Code 1, Content Item 7, tags tool-tip text font-size matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 7, tags tool-tip text font-size "20px"; Actual: "${elementSize}"`);
}
//color
if (elementColor === 'rgba(73, 80, 87, 1)') {
console.log('Passed: Standard Code 1, Content Item 7, tags tool-tip text color matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 7, tags tool-tip text color "rgba(73, 80, 87, 1)"; Actual: "${elementColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Standard Code 1, Content Item 7, Grade 6 checkmark
{
description: 'Validate Standard Code 1, Content Item 7, Grade 6 checkmark icon',
action: async () => {
const element = await driver.findElement(By.css('#\\34 5_1439152196_1162119840 .fa'));
//Track all errors
const errors = [];
//icon
if (element) {
console.log('Passed: Standard Code 1, Content Item 7, Grade 6 checkmark icon was found');
} else {
errors.push('Standard Code 1, Content Item 7, Grade 6 checkmark icon was not found');
}
}
},
//Standard Code 1, Content Item 7, Grade 7 checkmark
{
description: 'Validate Standard Code 1, Content Item 7, Grade 7 checkmark icon',
action: async () => {
const element = await driver.findElement(By.css('#\\34 7_1439152274_1162119840 .fa'));
//Track all errors
const errors = [];
//icon
if (element) {
console.log('Passed: Standard Code 1, Content Item 7 , Grade 7 checkmark icon was found');
} else {
errors.push('Standard Code 1, Content Item 7, Grade 7 checkmark icon was not found');
}
}
},
//Standard Code 1, Content Item 7, Grade 8 checkmark
{
description: 'Validate Standard Code 1, Content Item 7, Grade 8 checkmark icon',
action: async () => {
const element = await driver.findElement(By.css('#\\34 8_1439152451_1162119840 .fa'));
//Track all errors
const errors = [];
//icon
if (element) {
console.log('Passed: Standard Code 1, Content Item 7, Grade 8 checkmark icon was found');
} else {
errors.push('Standard Code 1, Content Item 7, Grade 8 checkmark icon was not found');
}
}
},
//Standard Code 1, Content Item 7, Grade 9 checkmark
{
description: 'Validate Standard Code 1, Content Item 7, Grade 9 checkmark icon',
action: async () => {
const element = await driver.findElement(By.css('#\\34 9_1439152630_1162119840 .fa'));
//Track all errors
const errors = [];
//icon
if (element) {
console.log('Passed: Standard Code 1, Content Item 7, Grade 9 checkmark icon was found');
} else {
errors.push('Standard Code 1, Content Item 7, Grade 9 checkmark icon was not found');
}
}
},
//Standard Code 1, Content Item 7, Grade 10 checkmark
{
description: 'Validate Standard Code 1, Content Item 7, Grade 10 checkmark icon',
action: async () => {
const element = await driver.findElement(By.css('#\\35 1_1439153143_1162119840 .fa'));
//Track all errors
const errors = [];
//icon
if (element) {
console.log('Passed: Standard Code 1, Content Item 7, Grade 10 checkmark icon was found');
} else {
errors.push('Standard Code 1, Content Item 7, Grade 10 checkmark icon was not found');
}
}
},
//Standard Code 1, Content Item 7, Grade 11 checkmark
{
description: 'Validate Standard Code 1, Content Item 7, Grade 11 checkmark icon',
action: async () => {
const element = await driver.findElement(By.css('#\\35 2_1439153656_1162119840 .fa'));
//Track all errors
const errors = [];
//icon
if (element) {
console.log('Passed: Standard Code 1, Content Item 7, Grade 11 checkmark icon was found');
} else {
errors.push('Standard Code 1, Content Item 7, Grade 11 checkmark icon was not found');
}
}
},
//Standard Code 1, Content Item 7, Grade 12 checkmark
{
description: 'Validate Standard Code 1, Content Item 7, Grade 12 checkmark icon',
action: async () => {
const element = await driver.findElement(By.css('#\\35 3_1439154169_1162119840 .fa'));
//Track all errors
const errors = [];
//icon
if (element) {
console.log('Passed: Standard Code 1, Content Item 7, Grade 12 checkmark icon was found');
} else {
errors.push('Standard Code 1, Content Item 7, Grade 12 checkmark icon was not found');
}
}
},
//Standard Code 1, Content Item 7, All button
{
description: 'Validate Standard Code 1, Content Item 7, All button text, size, and color',
action: async () => {
const multipleChecks = 'Standard Code 1, Content Item 7, All button';
const element = await driver.findElement(By.css('#tr14391526301162119840 > .align-middle:nth-child(15) > .btn'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
const elementButtonColor = await element.getCssValue('background-color');
//Track all errors
const errors = [];
//text
if (elementText === 'All') {
console.log('Passed: Standard Code 1, Content Item 7, All button text matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 7, All button text "All"; Actual: "${elementText}"`);
}
//font
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Standard Code 1, Content Item 7, All button text font-family matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 7, All button text font-family "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//size
if (elementTextSize === '14px') {
console.log('Passed: Standard Code 1, Content Item 7, All button text font-size matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 7, All button text font-size "14px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(255, 255, 255, 1)') {
console.log('Passed: Standard Code 1, Content Item 7, All button text color matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 7, All button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`);
}
//button color
if (elementButtonColor === 'rgba(108, 117, 125, 1)') {
console.log('Passed: Standard Code 1, Content Item 7, All button background color matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 7, All button background color: "rgba(108, 117, 125, 1)"; Actual: "${elementButtonColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Standard Code 1, Content Item 7, Clear button
{
description: 'Validate Standard Code 1, Content Item 7, Clear button text, size, and color',
action: async () => {
const multipleChecks = 'Standard Code 1, Content Item 7, Clear button';
const element = await driver.findElement(By.css('#tr14391526301162119840 > .align-middle:nth-child(16) > .btn'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
const elementButtonColor = await element.getCssValue('background-color');
//Track all errors
const errors = [];
//text
if (elementText === 'Clear') {
console.log('Passed: Standard Code 1, Content Item 7, Clear button text matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 7, Clear button text "Clear"; Actual: "${elementText}"`);
}
//font
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Standard Code 1, Content Item 7, Clear button text font-family matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 7, Clear button text font-family "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//size
if (elementTextSize === '14px') {
console.log('Passed: Standard Code 1, Content Item 7, Clear button text font-size matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 7, Clear button text font-size "14px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(255, 255, 255, 1)') {
console.log('Passed: Standard Code 1, Content Item 7, Clear button text color matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 7, Clear button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`);
}
//button color
if (elementButtonColor === 'rgba(108, 117, 125, 1)') {
console.log('Passed: Standard Code 1, Content Item 7, Clear button background color matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 7, Clear button background color: "rgba(108, 117, 125, 1)"; Actual: "${elementButtonColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Standard Code 1, Content Item 8, link title
{
description: 'Validate Standard Code 1, Content Item 8, link title text, font, size color, and URL',
action: async () => {
const multipleChecks = 'Standard Code 1, Content Item 8, link title';
const element = await driver.findElement(By.linkText('Touchdown Decisions'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementFont = await element.getCssValue('font-family');
const elementSize = await element.getCssValue('font-size');
const elementColor = await element.getCssValue('color');
const elementURL = await element.getAttribute('href');
//Track all errors
const errors = [];
//text
if (elementText === ('Touchdown Decisions')) {
console.log("Passed: Standard Code 1, Content Item 8, link title text matched as expected");
} else {
errors.push(`Expected: "Touchdown Decisions" Standard Code 1, Content Item 8, link title text; Actual: "${elementText}"`);
}
//font
if (elementFont === 'Poppins, sans-serif') {
console.log('Passed: Standard Code 1, Content Item 8, link title text font-family matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 8, link title text font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
}
//size
if (elementSize === '14.3px') {
console.log('Passed: Standard Code 1, Content Item 8, link title text font-size matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 8, link title text font-size "14.3px"; Actual: "${elementSize}"`);
}
//color
if (elementColor === 'rgba(73, 80, 87, 1)') {
console.log('Passed: Standard Code 1, Content Item 8, link title text color matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 8, link title text color "rgba(73, 80, 87, 1)"; Actual: "${elementColor}"`);
}
//url
if (elementURL === 'http://sciencenetlinks.com/science-news/science-updates/touchdown-decisions/') {
console.log('Passed: Standard Code 1, Content Item 8, link title URL matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 8, link title URL: "http://sciencenetlinks.com/science-news/science-updates/touchdown-decisions/"; Actual: "${elementURL}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Standard Code 1, Content Item 8, Info icon tool-tip
{
description: 'Validate Standard Code 1, Content Item 8, Info icon tool tip',
action: async () => {
const multipleChecks = 'Standard Code 1, Content Item 8, Info icon tool-tip';
const element = await driver.findElement(By.css ('#title14391526301162119993 > a:nth-child(2)'));
//Get text, font, size, and color
const elementText = await element.getAttribute('title');
const elementFont = await element.getCssValue('font-family');
const elementSize = await element.getCssValue('font-size');
const elementColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//font
if (elementText === 'Click to view item description') {
console.log('Passed: Standard Code 1, Content Item 8, Info icon tool-tip text matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 8, Info icon tool-tip text "Click to view item description"; Actual: ${elementText}`);
}
//font
if (elementFont === 'Poppins, sans-serif') {
console.log('Passed: Standard Code 1, Content Item 8, Info icon tool-tip text font-family matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 8, Info icon tool-tip text font-family "Click to view item description"; Actual: ${elementFont}`);
}
//size
if (elementSize === '14.3px') {
console.log('Passed: Standard Code 1, Content Item 8, Info icon tool-tip text font-size matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 8, Info icon tool-tip text font-size "14.3px"; Actual: "${elementSize}"`);
}
//color
if (elementColor === 'rgba(73, 80, 87, 1)') {
console.log('Passed: Standard Code 1, Content Item 8, Info icon tool-tip text color matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 8, Info icon tool-tip text color "rgba(73, 80, 87, 1)"; Actual: "${elementColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Standard Code 1, Content Item 8, tags tool-tip
{
description: 'Validate Standard Code 1, Content Item 8, tags tool-tip text, font, size, and color',
action: async () => {
const multipleChecks = 'Standard Code 1, Content Item 8, tags tool-tip';
const element = await driver.findElement(By.css('#title14391526301162119993 > .fa'));
//Get text, font, size, and color
const elementText = await element.getAttribute('title');
const elementFont = await element.getCssValue('font-family');
const elementSize = await element.getCssValue('font-size');
const elementColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//text
if (elementText === ('View Matching Concepts')) {
console.log("Passed: Standard Code 1, Content Item 8, tags tool-tip text matched as expected");
} else {
errors.push(`Expected: Standard Code 1, Content Item 8, tags tool-tip text "View Matching Concepts"; Actual: "${elementText}"`);
}
//font
if (elementFont === 'FontAwesome') {
console.log('Passed: Standard Code 1, Content Item 8, tags tool-tip text font-family matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 8, tags tool-tip text font-family "FontAwesome"; Actual: ${elementFont}`);
}
//size
if (elementSize === '20px') {
console.log('Passed: Standard Code 1, Content Item 8, tags tool-tip text font-size matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 8, tags tool-tip text font-size "20px"; Actual: "${elementSize}"`);
}
//color
if (elementColor === 'rgba(73, 80, 87, 1)') {
console.log('Passed: Standard Code 1, Content Item 8, tags tool-tip text color matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 8, tags tool-tip text color "rgba(73, 80, 87, 1)"; Actual: "${elementColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Standard Code 1, Content Item 8, Grade 6 checkmark
{
description: 'Validate Standard Code 1, Content Item 8, Grade 6 checkmark icon',
action: async () => {
const element = await driver.findElement(By.css('#\\34 5_1439152196_1162119993 .fa'));
//Track all errors
const errors = [];
//icon
if (element) {
console.log('Passed: Standard Code 1, Content Item 8, Grade 6 checkmark icon was found');
} else {
errors.push('Standard Code 1, Content Item 8, Grade 6 checkmark icon was not found');
}
}
},
//Standard Code 1, Content Item 8, Grade 7 checkmark
{
description: 'Validate Standard Code 1, Content Item 8, Grade 7 checkmark icon',
action: async () => {
const element = await driver.findElement(By.css('#\\34 7_1439152274_1162119993 .fa'));
//Track all errors
const errors = [];
//icon
if (element) {
console.log('Passed: Standard Code 1, Content Item 8, Grade 7 checkmark icon was found');
} else {
errors.push('Standard Code 1, Content Item 8, Grade 7 checkmark icon was not found');
}
}
},
//Standard Code 1, Content Item 8, Grade 8 checkmark
{
description: 'Validate Standard Code 1, Content Item 8, Grade 8 checkmark icon',
action: async () => {
const element = await driver.findElement(By.css('#\\34 8_1439152451_1162119993 .fa'));
//Track all errors
const errors = [];
//icon
if (element) {
console.log('Passed: Standard Code 1, Content Item 8, Grade 8 checkmark icon was found');
} else {
errors.push('Standard Code 1, Content Item 8, Grade 8 checkmark icon was not found');
}
}
},
//Standard Code 1, Content Item 8, Grade 9 checkmark
{
description: 'Validate Standard Code 1, Content Item 8, Grade 9 checkmark icon',
action: async () => {
const element = await driver.findElement(By.css('#\\34 9_1439152630_1162119993 .fa'));
//Track all errors
const errors = [];
//icon
if (element) {
console.log('Passed: Standard Code 1, Content Item 8, Grade 9 checkmark icon was found');
} else {
errors.push('Standard Code 1, Content Item 8, Grade 9 checkmark icon was not found');
}
}
},
//Standard Code 1, Content Item 8, Grade 10 checkmark
{
description: 'Validate Standard Code 1, Content Item 8, Grade 10 checkmark icon',
action: async () => {
const element = await driver.findElement(By.css('#\\35 1_1439153143_1162119993 .fa'));
//Track all errors
const errors = [];
//icon
if (element) {
console.log('Passed: Standard Code 1, Content Item 8, Grade 10 checkmark icon was found');
} else {
errors.push('Standard Code 1, Content Item 8, Grade 10 checkmark icon was not found');
}
}
},
//Standard Code 1, Content Item 8, Grade 11 checkmark
{
description: 'Validate Standard Code 1, Content Item 8, Grade 11 checkmark icon',
action: async () => {
const element = await driver.findElement(By.css('#\\35 2_1439153656_1162119993 .fa'));
//Track all errors
const errors = [];
//icon
if (element) {
console.log('Passed: Standard Code 1, Content Item 8, Grade 11 checkmark icon was found');
} else {
errors.push('Standard Code 1, Content Item 8, Grade 11 checkmark icon was not found');
}
}
},
//Standard Code 1, Content Item 8, Grade 12 checkmark
{
description: 'Validate Standard Code 1, Content Item 8, Grade 12 checkmark icon',
action: async () => {
const element = await driver.findElement(By.css('#\\35 3_1439154169_1162119993 .fa'));
//Track all errors
const errors = [];
//icon
if (element) {
console.log('Passed: Standard Code 1, Content Item 8, Grade 12 checkmark icon was found');
} else {
errors.push('Standard Code 1, Content Item 8, Grade 12 checkmark icon was not found');
}
}
},
//Standard Code 1, Content Item 8, All button
{
description: 'Validate Standard Code 1, Content Item 8, All button text, size, and color',
action: async () => {
const multipleChecks = 'Standard Code 1, Content Item 8, All button';
const element = await driver.findElement(By.css('#tr14391526301162119993 > .align-middle:nth-child(15) > .btn'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
const elementButtonColor = await element.getCssValue('background-color');
//Track all errors
const errors = [];
//text
if (elementText === 'All') {
console.log('Passed: Standard Code 1, Content Item 8, All button text matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 8, All button text "All"; Actual: "${elementText}"`);
}
//font
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Standard Code 1, Content Item 8, All button text font-family matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 8, All button text font-family "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//size
if (elementTextSize === '14px') {
console.log('Passed: Standard Code 1, Content Item 8, All button text font-size matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 8, All button text font-size "14px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(255, 255, 255, 1)') {
console.log('Passed: Standard Code 1, Content Item 8, All button text color matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 8, All button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`);
}
//button color
if (elementButtonColor === 'rgba(108, 117, 125, 1)') {
console.log('Passed: Standard Code 1, Content Item 8, All button background color matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 8, All button background color: "rgba(108, 117, 125, 1)"; Actual: "${elementButtonColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Standard Code 1, Content Item 8, Clear button
{
description: 'Validate Standard Code 1, Content Item 8, Clear button text, size, and color',
action: async () => {
const multipleChecks = 'Standard Code 1, Content Item 8, Clear button';
const element = await driver.findElement(By.css('#tr14391526301162119993 > .align-middle:nth-child(16) > .btn'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
const elementButtonColor = await element.getCssValue('background-color');
//Track all errors
const errors = [];
//text
if (elementText === 'Clear') {
console.log('Passed: Standard Code 1, Content Item 8, Clear button text matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 8, Clear button text "Clear"; Actual: "${elementText}"`);
}
//font
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Standard Code 1, Content Item 8, Clear button text font-family matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 8, Clear button text font-family "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//size
if (elementTextSize === '14px') {
console.log('Passed: Standard Code 1, Content Item 8, Clear button text font-size matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 8, Clear button text font-size "14px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(255, 255, 255, 1)') {
console.log('Passed: Standard Code 1, Content Item 8, Clear button text color matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 8, Clear button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`);
}
//button color
if (elementButtonColor === 'rgba(108, 117, 125, 1)') {
console.log('Passed: Standard Code 1, Content Item 8, Clear button background color matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 8, Clear button background color: "rgba(108, 117, 125, 1)"; Actual: "${elementButtonColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Content Item 9, link title
{
description: 'Validate Content Item 9, link title text, font, size, color, and URL',
action: async () => {
const multipleChecks = 'Content Item 9 link title';
const element = await driver.findElement(By.linkText('Adding probabilities (Exercise)'));
//Get text, font, size, color, and background color
const elementText = await element.getText();
const elementFont = await element.getCssValue('font-family');
const elementSize = await element.getCssValue('font-size');
const elementColor = await element.getCssValue('color');
const elementURL = await element.getAttribute('href');
//Track all errors
const errors = [];
//text
if (elementText === ('Adding probabilities (Exercise)')) {
console.log("Passed: Content Item 9, link title text matched as expected");
} else {
errors.push(`Expected: "Adding probabilities (Exercise)" Content Item 9, link title text; Actual: "${elementText}"`);
}
//font
if (elementFont === 'Poppins, sans-serif') {
console.log('Passed: Content Item 9, link title text font-family matched as expected');
} else {
errors.push(`Expected: Content Item 9, link title text font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
}
//size
if (elementSize === '14.3px') {
console.log('Passed: Content Item 9, link title text font-size matched as expected');
} else {
errors.push(`Expected: Content Item 9, link title text font-size "14.3px"; Actual: "${elementSize}"`);
}
//color
if (elementColor === 'rgba(48, 200, 172, 1)') {
console.log('Passed: Content Item 9, link title text color matched as expected');
} else {
errors.push(`Expected: Content Item 9, link title text color "rgba(48, 200, 172, 1)"; Actual: "${elementColor}"`);
}
//url
if (elementURL === 'https://www.khanacademy.org/math/probability/probability-geometry/addition-rule-for-probability/e/adding-probability') {
console.log('Passed: Content Item 9, link title URL matched as expected');
} else {
errors.push(`Expected: Content Item 9, link title URL: "https://www.khanacademy.org/math/probability/probability-geometry/addition-rule-for-probability/e/adding-probability"; Actual: "${elementURL}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Content Item 9, Info icon tool-tip
{
description: 'Validate Content Item 9, Info icon tool tip',
action: async () => {
const multipleChecks = 'Content Item 9, Info icon tool-tip';
const element = await driver.findElement(By.css('#title14391526301162119830 > a:nth-child(2)'));
//Get text, font, size, and color
const elementText = await element.getAttribute('title');
const elementFont = await element.getCssValue('font-family');
const elementSize = await element.getCssValue('font-size');
const elementColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//font
if (elementText === 'Click to view item description') {
console.log('Passed: Content Item 9, Info icon tool-tip text matched as expected');
} else {
errors.push(`Expected: Content Item 9, Info icon tool-tip text "Click to view item description"; Actual: ${elementText}`);
}
//font
if (elementFont === 'Poppins, sans-serif') {
console.log('Passed: Content Item 9, Info icon tool-tip text font-family matched as expected');
} else {
errors.push(`Expected: Content Item 9, Info icon tool-tip text font-family "Click to view item description"; Actual: ${elementFont}`);
}
//size
if (elementSize === '14.3px') {
console.log('Passed: Content Item 9, Info icon tool-tip text font-size matched as expected');
} else {
errors.push(`Expected: Content Item 9, Info icon tool-tip text font-size "14.3px"; Actual: "${elementSize}"`);
}
//color
if (elementColor === 'rgba(73, 80, 87, 1)') {
console.log('Passed: Content Item 9, Info icon tool-tip text color matched as expected');
} else {
errors.push(`Expected: Content Item 9, Info icon tool-tip text color "rgba(73, 80, 87, 1)"; Actual: "${elementColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Standard Code 1, Content Item 9, added badge
{
description: 'Validate Standard Code 1, Content Item 9, added badge text, font, size, and color',
action: async () => {
const multipleChecks = 'Standard Code 1, Content Item 9, added badge';
const element = await driver.findElement(By.css('.badge-success'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementFont = await element.getCssValue('font-family');
const elementSize = await element.getCssValue('font-size');
const elementColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//font
if (elementText === 'added') {
console.log('Passed: Standard Code 1, Content Item 9, added badge text font-family matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 9, added badge text font-family "added"; Actual: ${elementText}`);
}
//font
if (elementFont === 'Poppins, sans-serif') {
console.log('Passed: Standard Code 1, Content Item 9, added badge text font-family matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 9, added badge text font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
}
//size
if (elementSize === '12.87px') {
console.log('Passed: Standard Code 1, Content Item 9, added badge text font-size matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 9, added badge text font-size "12.87px"; Actual: "${elementSize}"`);
}
//color
if (elementColor === 'rgba(255, 255, 255, 1)') {
console.log('Passed: Standard Code 1, Content Item 9, added badge text color matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 9, added badge text color "rgba(255, 255, 255, 1)"; Actual: "${elementColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Standard Code 1, Content Item 9, Primary badge
{
description: 'Validate Standard Code 1, Content Item 9, Primary badge text, font, size, and color',
action: async () => {
const multipleChecks = 'Standard Code 1, Content Item 9, Primary badge';
const element = await driver.findElement(By.css('.badge:nth-child(2)'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementFont = await element.getCssValue('font-family');
const elementSize = await element.getCssValue('font-size');
const elementColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//font
if (elementText === 'Primary') {
console.log('Passed: Standard Code 1, Content Item 9, Primary badge text font-family matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 9, Primary badge text font-family "Primary"; Actual: ${elementText}`);
}
//font
if (elementFont === 'Poppins, sans-serif') {
console.log('Passed: Standard Code 1, Content Item 9, Primary badge text font-family matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 9, Primary badge text font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
}
//size
if (elementSize === '12.87px') {
console.log('Passed: Standard Code 1, Content Item 9, Primary badge text font-size matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 9, Primary badge text font-size "12.87px"; Actual: "${elementSize}"`);
}
//color
if (elementColor === 'rgba(255, 255, 255, 1)') {
console.log('Passed: Standard Code 1, Content Item 9, Primary badge text color matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 9, Primary badge text color "rgba(255, 255, 255, 1)"; Actual: "${elementColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Standard Code 1, Content Item 9, Grade 9 added
{
description: 'Validate Standard Code 1, Content Item 9, Grade 9 added icon',
action: async () => {
const element = await driver.findElement(By.css('.fa-dot-circle-o'));
//Track all errors
const errors = [];
//icon
if (element) {
console.log('Passed: Standard Code 1, Content Item 9, Grade 9 added icon was found');
} else {
errors.push('Standard Code 1, Content Item 9, Grade 9 added icon was not found');
}
}
},
//Standard Code 1, Content Item 9, Grade 10 checkmark
{
description: 'Validate Standard Code 1, Content Item 9, Grade 10 checkmark icon',
action: async () => {
const element = await driver.findElement(By.css('#\\35 1_1439153143_1162119830'));
//Track all errors
const errors = [];
//icon
if (element) {
console.log('Passed: Standard Code 1, Content Item 9, Grade 10 checkmark icon was found');
} else {
errors.push('Standard Code 1, Content Item 9, Grade 10 checkmark icon was not found');
}
}
},
//Standard Code 1, Content Item 9, Grade 11 checkmark
{
description: 'Validate Standard Code 1, Content Item 9, Grade 11 checkmark icon',
action: async () => {
const element = await driver.findElement(By.css('#\\35 2_1439153656_1162119830 .fa'));
//Track all errors
const errors = [];
//icon
if (element) {
console.log('Passed: Standard Code 1, Content Item 9, Grade 11 checkmark icon was found');
} else {
errors.push('Standard Code 1, Content Item 9, Grade 11 checkmark icon was not found');
}
}
},
//Standard Code 1, Content Item 9, Grade 12 checkmark
{
description: 'Validate Standard Code 1, Content Item 9, Grade 12 checkmark icon',
action: async () => {
const element = await driver.findElement(By.css('#\\35 3_1439154169_1162119830 .fa'));
//Track all errors
const errors = [];
//icon
if (element) {
console.log('Passed: Standard Code 1, Content Item 9, Grade 12 checkmark icon was found');
} else {
errors.push('Standard Code 1, Content Item 9, Grade 12 checkmark icon was not found');
}
}
},
//Standard Code 1, Content Item 9, All button
{
description: 'Validate Standard Code 1, Content Item 9, All button text, size, and color',
action: async () => {
const multipleChecks = 'Standard Code 1, Content Item 9, All button';
const element = await driver.findElement(By.css('#tr14391526301162119830 > .align-middle:nth-child(15) > .btn'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
const elementButtonColor = await element.getCssValue('background-color');
//Track all errors
const errors = [];
//text
if (elementText === 'All') {
console.log('Passed: Standard Code 1, Content Item 9, All button text matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 9, All button text "All"; Actual: "${elementText}"`);
}
//font
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Standard Code 1, Content Item 9, All button text font-family matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 9, All button text font-family "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//size
if (elementTextSize === '14px') {
console.log('Passed: Standard Code 1, Content Item 9, All button text font-size matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 9, All button text font-size "14px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(255, 255, 255, 1)') {
console.log('Passed: Standard Code 1, Content Item 9, All button text color matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 9, All button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`);
}
//button color
if (elementButtonColor === 'rgba(108, 117, 125, 1)') {
console.log('Passed: Standard Code 1, Content Item 9, All button background color matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 9, All button background color: "rgba(108, 117, 125, 1)"; Actual: "${elementButtonColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Standard Code 1, Content Item 9, Clear button
{
description: 'Validate Standard Code 1, Content Item 9, Clear button text, size, and color',
action: async () => {
const multipleChecks = 'Standard Code 1, Content Item 9, Clear button';
const element = await driver.findElement(By.css('#tr14391526301162119830 > .align-middle:nth-child(16) > .btn'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
const elementButtonColor = await element.getCssValue('background-color');
//Track all errors
const errors = [];
//text
if (elementText === 'Clear') {
console.log('Passed: Standard Code 1, Content Item 9, Clear button text matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 9, Clear button text "Clear"; Actual: "${elementText}"`);
}
//font
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Standard Code 1, Content Item 9, Clear button text font-family matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 9, Clear button text font-family "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//size
if (elementTextSize === '14px') {
console.log('Passed: Standard Code 1, Content Item 9, Clear button text font-size matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 9, Clear button text font-size "14px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(255, 255, 255, 1)') {
console.log('Passed: Standard Code 1, Content Item 9, Clear button text color matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 9, Clear button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`);
}
//button color
if (elementButtonColor === 'rgba(108, 117, 125, 1)') {
console.log('Passed: Standard Code 1, Content Item 9, Clear button background color matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 9, Clear button background color: "rgba(108, 117, 125, 1)"; Actual: "${elementButtonColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//NEXT ACTION
{
description: 'Click Standard Code 1, Content Item 9, Grade 9 added icon',
action: async () => {
const element = await driver.findElement(By.css('.badge-success')).catch(() => false);
await driver.findElement(By.css('.fa-dot-circle-o')).click();
console.log('----->| NEXT ACTION: Click Standard Code 1, Content Item 9, Grade 9 added icon');
//Wait for page to load completely
await driver.wait(async () => {
const readyState = await driver.executeScript('return document.readyState');
return readyState === 'complete';
}, 30000, 'Search/Standards page did not fully load within 30 seconds');
//Wait for any loading spinners to disappear
await driver.wait(async () => {
try {
const spinners = await driver.findElements(By.css('.spinner-border'));
for (const spinner of spinners) {
if (await spinner.isDisplayed()) return false;
}
return true;
} catch (e) {
return true;
}
}, 30000, 'Loading spinner did not disappear within 30 seconds');
//Element may be removed from the DOM entirely or just hidden via CSS - handle both
if (element) {
await driver.wait(async () => {
try {
return !(await element.isDisplayed());
} catch (e) {
return true; //Stale reference means it was removed from the DOM
}
}, 5000, 'Standard Code 1, Content Item 9, added icon did not disappear as expected');
}
console.log('Passed: Standard Code 1, Content Item 9, added icon disappeared as expected');
}
},
//Content Item 9, link title
{
description: 'Validate Content Item 9, link title text, font, size, color, and URL',
action: async () => {
const multipleChecks = 'Content Item 9 link title';
const element = await driver.findElement(By.linkText('Adding probabilities (Exercise)'));
//Get text, font, size, color, and background color
const elementText = await element.getText();
const elementFont = await element.getCssValue('font-family');
const elementSize = await element.getCssValue('font-size');
const elementColor = await element.getCssValue('color');
const elementURL = await element.getAttribute('href');
//Track all errors
const errors = [];
//text
if (elementText === ('Adding probabilities (Exercise)')) {
console.log("Passed: Content Item 9, link title text matched as expected");
} else {
errors.push(`Expected: "Adding probabilities (Exercise)" Content Item 9, link title text; Actual: "${elementText}"`);
}
//font
if (elementFont === 'Poppins, sans-serif') {
console.log('Passed: Content Item 9, link title text font-family matched as expected');
} else {
errors.push(`Expected: Content Item 9, link title text font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
}
//size
if (elementSize === '14.3px') {
console.log('Passed: Content Item 9, link title text font-size matched as expected');
} else {
errors.push(`Expected: Content Item 9, link title text font-size "14.3px"; Actual: "${elementSize}"`);
}
//color
if (elementColor === 'rgba(170, 170, 170, 1)') {
console.log('Passed: Content Item 9, link title text color matched as expected');
} else {
errors.push(`Expected: Content Item 9, link title text color "rgba(170, 170, 170, 1)"; Actual: "${elementColor}"`);
}
//url
if (elementURL === 'https://www.khanacademy.org/math/probability/probability-geometry/addition-rule-for-probability/e/adding-probability') {
console.log('Passed: Content Item 9, link title URL matched as expected');
} else {
errors.push(`Expected: Content Item 9, link title URL: "https://www.khanacademy.org/math/probability/probability-geometry/addition-rule-for-probability/e/adding-probability"; Actual: "${elementURL}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Content Item 9, Info icon tool-tip
{
description: 'Validate Content Item 9, Info icon tool tip',
action: async () => {
const multipleChecks = 'Content Item 9, Info icon tool-tip';
const element = await driver.findElement(By.css('#title14391526301162119830 > a:nth-child(2)'));
//Get text, font, size, and color
const elementText = await element.getAttribute('title');
const elementFont = await element.getCssValue('font-family');
const elementSize = await element.getCssValue('font-size');
const elementColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//font
if (elementText === 'Click to view item description') {
console.log('Passed: Content Item 9, Info icon tool-tip text matched as expected');
} else {
errors.push(`Expected: Content Item 9, Info icon tool-tip text "Click to view item description"; Actual: ${elementText}`);
}
//font
if (elementFont === 'Poppins, sans-serif') {
console.log('Passed: Content Item 9, Info icon tool-tip text font-family matched as expected');
} else {
errors.push(`Expected: Content Item 9, Info icon tool-tip text font-family "Click to view item description"; Actual: ${elementFont}`);
}
//size
if (elementSize === '14.3px') {
console.log('Passed: Content Item 9, Info icon tool-tip text font-size matched as expected');
} else {
errors.push(`Expected: Content Item 9, Info icon tool-tip text font-size "14.3px"; Actual: "${elementSize}"`);
}
//color
if (elementColor === 'rgba(73, 80, 87, 1)') {
console.log('Passed: Content Item 9, Info icon tool-tip text color matched as expected');
} else {
errors.push(`Expected: Content Item 9, Info icon tool-tip text color "rgba(73, 80, 87, 1)"; Actual: "${elementColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Standard Code 1, Content Item 9, not aligned button
{
description: 'Validate Standard Code 1, Content Item 9, not aligned button text, font, size, and color',
action: async () => {
const multipleChecks = 'Standard Code 1, Content Item 9, not aligned button';
const element = await driver.findElement(By.css('.badge-secondary'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementFont = await element.getCssValue('font-family');
const elementSize = await element.getCssValue('font-size');
const elementColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//font
if (elementText === 'not aligned') {
console.log('Passed: Standard Code 1, Content Item 9, not aligned button text font-family matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 9, not aligned button text font-family "not aligned"; Actual: ${elementText}`);
}
//font
if (elementFont === 'Poppins, sans-serif') {
console.log('Passed: Standard Code 1, Content Item 9, not aligned button text font-family matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 9, not aligned button text font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
}
//size
if (elementSize === '12.87px') {
console.log('Passed: Standard Code 1, Content Item 9, not aligned button text font-size matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 9, not aligned button text font-size "12.87px"; Actual: "${elementSize}"`);
}
//color
if (elementColor === 'rgba(255, 255, 255, 1)') {
console.log('Passed: Standard Code 1, Content Item 9, not aligned button text color matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 9, not aligned button text color "rgba(255, 255, 255, 1)"; Actual: "${elementColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Standard Code 1, Content Item 9, Grade 9 added
{
description: 'Validate Standard Code 1, Content Item 9, Grade 9 added icon',
action: async () => {
const element = await driver.findElement(By.css('#\\34 9_1439152630_1162119830 .fa'));
//Track all errors
const errors = [];
//icon
if (element) {
console.log('Passed: Standard Code 1, Content Item 9, Grade 9 added icon was found');
} else {
errors.push('Standard Code 1, Content Item 9, Grade 9 added icon was not found');
}
}
},
//Standard Code 1, Content Item 9, Grade 10 checkmark
{
description: 'Validate Standard Code 1, Content Item 9, Grade 10 checkmark icon',
action: async () => {
const element = await driver.findElement(By.css('#\\35 1_1439153143_1162119830'));
//Track all errors
const errors = [];
//icon
if (element) {
console.log('Passed: Standard Code 1, Content Item 9, Grade 10 checkmark icon was found');
} else {
errors.push('Standard Code 1, Content Item 9, Grade 10 checkmark icon was not found');
}
}
},
//Standard Code 1, Content Item 9, Grade 11 checkmark
{
description: 'Validate Standard Code 1, Content Item 9, Grade 11 checkmark icon',
action: async () => {
const element = await driver.findElement(By.css('#\\35 2_1439153656_1162119830 .fa'));
//Track all errors
const errors = [];
//icon
if (element) {
console.log('Passed: Standard Code 1, Content Item 9, Grade 11 checkmark icon was found');
} else {
errors.push('Standard Code 1, Content Item 9, Grade 11 checkmark icon was not found');
}
}
},
//Standard Code 1, Content Item 9, Grade 12 checkmark
{
description: 'Validate Standard Code 1, Content Item 9, Grade 12 checkmark icon',
action: async () => {
const element = await driver.findElement(By.css('#\\35 3_1439154169_1162119830 .fa'));
//Track all errors
const errors = [];
//icon
if (element) {
console.log('Passed: Standard Code 1, Content Item 9, Grade 12 checkmark icon was found');
} else {
errors.push('Standard Code 1, Content Item 9, Grade 12 checkmark icon was not found');
}
}
},
//Standard Code 1, Content Item 9, All button
{
description: 'Validate Standard Code 1, Content Item 9, All button text, size, and color',
action: async () => {
const multipleChecks = 'Standard Code 1, Content Item 9, All button';
const element = await driver.findElement(By.css('#tr14391526301162119830 > .align-middle:nth-child(15) > .btn'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
const elementButtonColor = await element.getCssValue('background-color');
//Track all errors
const errors = [];
//text
if (elementText === 'All') {
console.log('Passed: Standard Code 1, Content Item 9, All button text matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 9, All button text "All"; Actual: "${elementText}"`);
}
//font
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Standard Code 1, Content Item 9, All button text font-family matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 9, All button text font-family "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//size
if (elementTextSize === '14px') {
console.log('Passed: Standard Code 1, Content Item 9, All button text font-size matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 9, All button text font-size "14px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(255, 255, 255, 1)') {
console.log('Passed: Standard Code 1, Content Item 9, All button text color matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 9, All button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`);
}
//button color
if (elementButtonColor === 'rgba(108, 117, 125, 1)') {
console.log('Passed: Standard Code 1, Content Item 9, All button background color matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 9, All button background color: "rgba(108, 117, 125, 1)"; Actual: "${elementButtonColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Standard Code 1, Content Item 9, Clear button
{
description: 'Validate Standard Code 1, Content Item 9, Clear button text, size, and color',
action: async () => {
const multipleChecks = 'Standard Code 1, Content Item 9, Clear button';
const element = await driver.findElement(By.css('#tr14391526301162119830 > .align-middle:nth-child(16) > .btn'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
const elementButtonColor = await element.getCssValue('background-color');
//Track all errors
const errors = [];
//text
if (elementText === 'Clear') {
console.log('Passed: Standard Code 1, Content Item 9, Clear button text matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 9, Clear button text "Clear"; Actual: "${elementText}"`);
}
//font
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Standard Code 1, Content Item 9, Clear button text font-family matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 9, Clear button text font-family "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//size
if (elementTextSize === '14px') {
console.log('Passed: Standard Code 1, Content Item 9, Clear button text font-size matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 9, Clear button text font-size "14px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(255, 255, 255, 1)') {
console.log('Passed: Standard Code 1, Content Item 9, Clear button text color matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 9, Clear button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`);
}
//button color
if (elementButtonColor === 'rgba(108, 117, 125, 1)') {
console.log('Passed: Standard Code 1, Content Item 9, Clear button background color matched as expected');
} else {
errors.push(`Expected: Standard Code 1, Content Item 9, Clear button background color: "rgba(108, 117, 125, 1)"; Actual: "${elementButtonColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Standard Code 2 title
{
description: 'Validate Standard Code 2, title text, font, size, and color',
action: async () => {
const multipleChecks = 'Standard Code 2, title';
const element = await driver.findElement(By.xpath(`(//div[@id='stdbox']/b)[2]`));
//Get text, font, size, and color
const elementText = await element.getText();
const elementFont = await element.getCssValue('font-family');
const elementSize = await element.getCssValue('font-size');
const elementColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//text
if (elementText === 'MP2') {
console.log("Passed: Standard Code 2, title text matched as expected");
} else {
errors.push(`Expected: "MP2" Standard Code 2, title text; Actual: "${elementText}"`);
}
//font
if (elementFont === 'Poppins, sans-serif') {
console.log('Passed: Standard Code 2, title text font-family matched as expected');
} else {
errors.push(`Expected: Standard Code 2, title text font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
}
//size
if (elementSize === '13px') {
console.log('Passed: Standard Code 2, title text font-size matched as expected');
} else {
errors.push(`Expected: Standard Code 2, title text font-size "13px"; Actual: "${elementSize}"`);
}
//color
if (elementColor === 'rgba(40, 39, 90, 1)') {
console.log('Passed: Standard Code 2, title text color matched as expected');
} else {
errors.push(`Expected: Standard Code 2, title text color "rgba(40, 39, 90, 1)"; Actual: "${elementColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Standard Code 2 Description
{
description: 'Validate Standard Code 2, description text, font, size, and color',
action: async () => {
const multipleChecks = 'Standard Code 2, description';
const element = await driver.findElement(By.xpath('//div[3]/div[2]/div[2]'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementFont = await element.getCssValue('font-family');
const elementSize = await element.getCssValue('font-size');
const elementColor = await element.getCssValue('color');
//Track all errors
const errors = [];
//text
if (elementText.includes ('Reason abstractly and quantitatively. (Grade 9)')) {
console.log("Passed: Standard Code 2, description text matched as expected");
} else {
errors.push(`Expected: "Reason abstractly and quantitatively. (Grade 9)" Standard Code 2, description text; Actual: "${elementText}"`);
}
//font
if (elementFont === 'Poppins, sans-serif') {
console.log('Passed: Standard Code 2, description text font-family matched as expected');
} else {
errors.push(`Expected: Standard Code 2, description text font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
}
//size
if (elementSize === '13px') {
console.log('Passed: Standard Code 2, description text font-size matched as expected');
} else {
errors.push(`Expected: Standard Code 2, description text font-size "13px"; Actual: "${elementSize}"`);
}
//color
if (elementColor === 'rgba(40, 39, 90, 1)') {
console.log('Passed: Standard Code 2, description text color matched as expected');
} else {
errors.push(`Expected: Standard Code 2, description text color "rgba(40, 39, 90, 1)"; Actual: "${elementColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Standard Code 2 Tools button
{
description: 'Validate Standard Code 2, Tools button text, size, and color',
action: async () => {
const multipleChecks = 'Standard Code 2, Tools button';
const elementIcon = await driver.findElement(By.xpath(`//div[@id='stdbox']/div/div/button/i`));
const element = await driver.findElement(By.css('#stdbox > div.pull-right > div > button'));
const elementExpandIcon = await driver.findElement(By.xpath(`(//button[@type='button'])[20]`));
//Get text, font, size, and color
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
const elementButtonColor = await element.getCssValue('background-color');
//Track all errors
const errors = [];
//icon
if (elementIcon) {
console.log('Passed: Standard Code 2, tools button icon found')
} else {
errors.push('FAILED: Standard Code 2 tools button icon not found')
}
//text
if (elementText === 'Tools') {
console.log('Passed: Standard Code 2, Tools button text matched as expected');
} else {
errors.push(`Expected: Standard Code 2, "Tools"; Actual: "${elementText}"`);
}
//font
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Standard Code 2, Tools button text font-family matched as expected');
} else {
errors.push(`Expected: Standard Code 2, Tools button text font-family "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//size
if (elementTextSize === '16px') {
console.log('Passed: Standard Code 2, Tools button text font-size matched as expected');
} else {
errors.push(`Expected: Standard Code 2, Tools button text font-size "16px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(255, 255, 255, 1)') {
console.log('Passed: Standard Code 2, Tools button text color matched as expected');
} else {
errors.push(`Expected: Standard Code 2, Tools button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`);
}
//button color
if (elementButtonColor === 'rgba(48, 200, 172, 1)') {
console.log('Passed: Standard Code 2, Tools button background color matched as expected');
} else {
errors.push(`Expected: Standard Code 2, Tools button background color: "rgba(48, 200, 172, 1)"; Actual: "${elementButtonColor}"`);
}
//expand icon
if (elementExpandIcon) {
console.log('Passed: Standard Code 2, Tools expand button icon found')
} else {
errors.push('FAILED: Standard Code 2, Tools expand button icon not found')
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Standard Code 2 Aligned Content button
{
description: 'Validate Standard Code 2, Aligned Content 8 button text, size, and color',
action: async () => {
const multipleChecks = 'Standard Code 2, Aligned Content 8 button';
const element = await driver.findElement(By.id('corr-1439152631-tab'));
const elementExpandIcon = await driver.findElement(By.id('colstate1439152631'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
const elementButtonColor = await element.getCssValue('background-color');
//Track all errors
const errors = [];
//text
if (elementText === 'Aligned Content 4') {
console.log('Passed: Standard Code 2, Aligned Content 4 button text matched as expected');
} else {
errors.push(`Expected: "Aligned Content 4"; Actual: "${elementText}"`);
}
//font
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Standard Code 2, Aligned Content 4 button text font-family matched as expected');
} else {
errors.push(`Expected: Standard Code 2, Aligned Content 4 button text font-family "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//size
if (elementTextSize === '15px') {
console.log('Passed: Standard Code 2, Aligned Content 4 button text font-size matched as expected');
} else {
errors.push(`Expected: Standard Code 2, Aligned Content 4 button text font-size "15px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(255, 255, 255, 1)') {
console.log('Passed: Standard Code 2, Aligned Content 4 button text color matched as expected');
} else {
errors.push(`Expected: Standard Code 2, Aligned Content 4 button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`);
}
//button color
if (elementButtonColor === 'rgba(40, 39, 90, 1)') {
console.log('Passed: Standard Code 2, Aligned Content 4 button background color matched as expected');
} else {
errors.push(`Expected: Standard Code 2, Aligned Content 4 button background color: "rgba(40, 39, 90, 1)"; Actual: "${elementButtonColor}"`);
}
//expand icon
if (elementExpandIcon) {
console.log('Passed: Standard Code 2, Aligned Content 4 expand button icon found')
} else {
errors.push('FAILED: Standard Code 2, Aligned Content 4 expand button icon not found')
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Standard Code 2 Related Standards button
{
description: 'Validate Standard Code 2, Related Standards 26 button text, size, and color',
action: async () => {
const multipleChecks = 'Standard Code 2, Related Standards 26 button';
const element = await driver.findElement(By.css('#rel-1439152631-tab'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
const elementButtonColor = await element.getCssValue('background-color');
//Track all errors
const errors = [];
//text
if (elementText === 'Related Standards 26') {
console.log('Passed: Standard Code 2, Related Standards 26 button text matched as expected');
} else {
errors.push(`Expected: "Related Standards 26"; Actual: "${elementText}"`);
}
//font
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Standard Code 2, Related Standards 26 button text font-family matched as expected');
} else {
errors.push(`Expected: Standard Code 2, Related Standards 26 button text font-family "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//size
if (elementTextSize === '15px') {
console.log('Passed: Standard Code 2, Related Standards 26 button text font-size matched as expected');
} else {
errors.push(`Expected: Standard Code 2, Related Standards 26 button text font-size "15px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(182, 186, 181, 1)') {
console.log('Passed: Standard Code 2, Related Standards 26 button text color matched as expected');
} else {
errors.push(`Expected: Standard Code 2, Related Standards 26 button text color: "rgba(182, 186, 181, 1)"; Actual: "${elementTextColor}"`);
}
//button color
if (elementButtonColor === 'rgba(0, 0, 0, 0)') {
console.log('Passed: Standard Code 2, Related Standards 26 button background color matched as expected');
} else {
errors.push(`Expected: Standard Code 2, Related Standards 26 button background color: "rgba(0, 0, 0, 0)"; Actual: "${elementButtonColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Standard Code 2 Add Direct Alignment button
{
description: 'Validate Standard Code 2, Add Direct Alignment button text, size, and color',
action: async () => {
const multipleChecks = 'Standard Code 2, Add Direct Alignment button';
const elementIcon = await driver.findElement(By.css('#add-1439152631-tab > .fa'));
const element = await driver.findElement(By.css('#add-1439152631-tab'));
//Get text, font, size, and color
const elementText = await element.getText();
const elementTextFont = await element.getCssValue('font-family');
const elementTextSize = await element.getCssValue('font-size');
const elementTextColor = await element.getCssValue('color');
const elementButtonColor = await element.getCssValue('background-color');
//Track all errors
const errors = [];
//icon
if (elementIcon) {
console.log('Passed: Standard Code 2, Add Direct Alignment button icon found')
} else {
errors.push('FAILED: Standard Code 2, Add Direct Alignment button icon not found')
}
//text
if (elementText === 'Add Direct Alignment') {
console.log('Passed: Standard Code 2, Add Direct Alignment button text matched as expected');
} else {
errors.push(`Expected: "Add Direct Alignment"; Actual: "${elementText}"`);
}
//font
if (elementTextFont === 'Poppins, sans-serif') {
console.log('Passed: Standard Code 2, Add Direct Alignment button text font-family matched as expected');
} else {
errors.push(`Expected: Standard Code 2, Add Direct Alignment button text font-family "Poppins, sans-serif"; Actual: ${elementTextFont}`);
}
//size
if (elementTextSize === '15px') {
console.log('Passed: Standard Code 2, Add Direct Alignment button text font-size matched as expected');
} else {
errors.push(`Expected: Standard Code 2, Add Direct Alignment button text font-size "15px"; Actual: "${elementTextSize}"`);
}
//color
if (elementTextColor === 'rgba(182, 186, 181, 1)') {
console.log('Passed: Standard Code 2, Add Direct Alignment button text color matched as expected');
} else {
errors.push(`Expected: Standard Code 2, Add Direct Alignment button text color: "rgba(182, 186, 181, 1)"; Actual: "${elementTextColor}"`);
}
//button color
if (elementButtonColor === 'rgba(0, 0, 0, 0)') {
console.log('Passed: Standard Code 2, Add Direct Alignment button background color matched as expected');
} else {
errors.push(`Expected: Standard Code 2, Add Direct Alignment button background color: "rgba(0, 0, 0, 0)"; Actual: "${elementButtonColor}"`);
}
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//NEXT ACTION - CLEAN UP
{
description: 'Test Case Reset - Click Standard Code 1, Content Item 2, Grade 9 checkmark icon',
action: async () => {
console.log('------------->| RESET TEST CASE |<-------------');
await driver.findElement(By.css('#\\34 9_1439152630_1162119829 .fa')).click();
console.log('----->| NEXT ACTION: Click Standard Code 1, Content Item 2, Grade 9 checkmark icon');
//Wait until the element exists in the DOM
const element = await driver.wait(
until.elementLocated(By.css('.fa-pause-circle')),
30000
);
//Wait until it becomes visible
await driver.wait(
until.elementIsVisible(element),
30000
);
console.log('Passed: Standard Code 1, Content Item 2, hidden icon appeared as expected');
}
},
//NEXT ACTION
{
description: 'Test Case Reset - Click Standard Code 1, Content Item 9, Grade 9 radio icon',
action: async () => {
await driver.findElement(By.css('#\\34 9_1439152630_1162119830 .fa')).click();
console.log('----->| NEXT ACTION: Click Standard Code 1, Content Item 9, Grade 9 radio icon');
//Wait until the element exists in the DOM
const element = await driver.wait(
until.elementLocated(By.css('.fa-dot-circle-o')),
30000
);
//Wait until it becomes visible
await driver.wait(
until.elementIsVisible(element),
30000
);
console.log('Passed: Standard Code 1, Content Item 9, radio icon appeared as expected');
}
},
//NEXT ACTION
{
description: 'Log Out',
action: async () => {
const multipleChecks = 'Log Out';
//Track all errors
const errors = [];
await driver.findElement(By.css('#navbarDropdown > span')).click();
await driver.sleep(2000);
await driver.findElement(By.linkText('Log Out')).click();
console.log('----->| NEXT ACTION: Clicked User Profile and Logged Out');
//Wait until the element exists in the DOM
const exactLogo = await driver.wait(
until.elementLocated(By.css('.logo')),
30000
);
//Wait until it becomes visible
await driver.wait(
until.elementIsVisible(exactLogo),
30000
);
//Wait for page to load completely
await driver.wait(async () => {
const readyState = await driver.executeScript('return document.readyState');
return readyState === 'complete';
}, 30000, 'ExACT Langing page did not fully load within 30 seconds');
console.log('Passed: ExACT Landing Page loaded successfully');
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
];
//STAND ALONE
const myStandardsSearch = (req, res) => {
res.send('<h2>ExACT Automated Test Script: My Standards - Aligned Content (myStandardsSearchAlignedContent) | 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 and navigate to Search Standards page',
action: async () => {
const multipleChecks = 'Log In and navigate to Search Standards page';
console.log('------------->| NAVIGATE TO SEARCH STANDARDS PAGE |<-------------');
const errors = [];
await driver.findElement(By.css('.form-control:nth-child(2)')).sendKeys('exact_juan');
await driver.findElement(By.css('.passfield')).sendKeys('Edgate1!');
await driver.findElement(By.css('.login')).click();
console.log('----->| NEXT ACTION: Entered credentials and logged in');
//Wait for page readyState
await driver.wait(async () => {
const readyState = await driver.executeScript('return document.readyState');
return readyState === 'complete';
}, 30000, 'ExACT Dashboard did not fully load within 30 seconds');
/*Wait for the dashboard container to exist in DOM
await driver.wait(
until.elementLocated(By.css('.gap-idle-wrap > img')),
30000,
'Dashboard image did not appear within 30 seconds'
);
Wait for it to be visible
await driver.wait(async () => {
try {
const img = await driver.findElement(By.css('.gap-idle-wrap > img'));
return await img.isDisplayed();
} catch (e) {
return false;
}
}, 30000, 'Dashboard image did not become visible within 30 seconds');*/
//Wait for any loading spinners to disappear
await driver.wait(async () => {
try {
const spinners = await driver.findElements(By.css('.spinner-border'));
for (const spinner of spinners) {
if (await spinner.isDisplayed()) return false;
}
return true;
} catch (e) {
return true;
}
}, 30000, 'Loading spinners did not disappear within 30 seconds');
//Wait for the slowest resource to complete
await driver.wait(async () => {
const completed = await driver.executeScript(`
const entries = performance.getEntriesByType('resource');
return entries.some(entry =>
entry.name.includes('content_sets.php') &&
entry.responseEnd > 0
);
`);
return completed;
}, 30000, 'My Content widget (content_sets.php) did not complete loading within 30 seconds');
//Final sleep to allow any remaining dynamic content to settle
await driver.sleep(2000);
//NEXT ACTION - Click Alabama view icon
await driver.findElement(By.css('tr:nth-child(1) > .text-center:nth-child(5) img')).click();
console.log('----->| NEXT ACTION: Clicked My Standards widget Alabama View icon');
//Wait for page readyState
await driver.wait(async () => {
const readyState = await driver.executeScript('return document.readyState');
return readyState === 'complete';
}, 30000, 'Browse standards page did not fully load within 30 seconds');
//Wait until the modal title is located AND visible
await driver.wait(async () => {
try {
const subjectDropdown = await driver.findElement(By.css('#selectSubjects'));
return await subjectDropdown.isDisplayed();
} catch (e) {
return false; //Element not ready yet, keep waiting
}
}, 20000, 'Browse standards tab did not become visible within 20 seconds');
//NEXT ACTION - Select subject Mathematics
await driver.findElement(By.css('#selectSubjects')).click();
await driver.sleep(2000);
await driver.findElement(By.css('#selectSubjects > option:nth-child(4)')).click();
console.log('----->| NEXT ACTION: Selected Subject: Mathematics');
await driver.sleep(2000);
//Click away to close dropdown
await driver.findElement(By.css('#browse-standards > .form-group:nth-child(1)')).click();
//Wait for the dashboard container to exist in DOM
await driver.wait(
until.elementLocated(By.css('#selectGrade')),
30000,
'Grade dropdown did not appear within 30 seconds'
);
//Wait for it to be visible
await driver.wait(async () => {
try {
const gradeDropdown = await driver.findElement(By.css('#selectGrade'));
return await gradeDropdown.isDisplayed();
} catch (e) {
return false;
}
}, 30000, 'Grade dropdown did not become visible within 30 seconds');
//Select grade 9
await driver.findElement(By.css('#selectGrade')).click();
await driver.sleep(2000);
await driver.findElement(By.css('#selectGrade > option:nth-child(11)')).click();
console.log('----->| NEXT ACTION: Selected Grade: 9');
//Click Show Correlations From to open dropdow
await driver.findElement(By.css('.col-sm-12 .multiselect-selected-text')).click();
await driver.sleep(2000);
//Wait for dropdown list to become visible
const dropdownMenu = await driver.wait(
until.elementLocated(By.css('ul.multiselect-container.dropdown-menu.show')),
10000
);
await driver.wait(
until.elementIsVisible(dropdownMenu),
10000
);
//Select "Algebra" from dropdown
await driver.findElement(By.css('.show > li:nth-child(5) input')).click();
await driver.sleep(2000);
console.log('----->| NEXT ACTION: Selected Show Correlations From: Algebra');
//Click away to close dropdown using executeScript to bypass interception
await driver.executeScript(`
document.querySelector('.col-sm-12 .multiselect-selected-text').click();
`);
await driver.sleep(2000);
//Click Include Related Standards checkbox
await driver.findElement(By.css('#doRel')).click();
await driver.sleep(2000);
console.log('----->| NEXT ACTION: Clicked Include Related Standards checkbox');
//Wait until the modal title is located AND visible
await driver.wait(async () => {
try {
const element = await driver.findElement(By.css('.col-auto .multiselect-selected-text'));
return await element.isDisplayed();
} catch (e) {
return false; //Element not ready yet, keep waiting
}
}, 20000, 'Related Standards dropdown did not become visible within 20 seconds');
//Locate and validate selected (collapsed) value
const dropdownButton = await driver.findElement(
By.css('.col-auto .multiselect-selected-text')
);
//Open dropdown - use the element directly, not findElement again
await dropdownButton.click();
await driver.sleep(2000);
//Select "Washington" from dropdown
await driver.findElement(By.css('.show > li:nth-child(12) input')).click();
await driver.sleep(2000);
//Select "Common Core State Standards" from dropdown
await driver.findElement(By.css('.show > li:nth-child(14) input')).click();
await driver.sleep(2000);
//Select "California Mathematics 1997" from dropdown
await driver.findElement(By.css('.show > li:nth-child(32) input')).click();
await driver.sleep(2000);
console.log('----->| NEXT ACTION: Selected Include Related Standards: Washington, Common Core State Standards, California Mathematics 1997');
//Click away to close dropdown using executeScript to bypass interception
await driver.executeScript(`
document.querySelector('.col-auto .multiselect-selected-text').click();
`);
await driver.sleep(2000);
//Click Search button
await driver.findElement(By.css('#stdsubmit')).click();
console.log('----->| NEXT ACTION: Clicked Search button');
//Wait for page to load completely
await driver.wait(async () => {
const readyState = await driver.executeScript('return document.readyState');
return readyState === 'complete';
}, 30000, 'Standards search page did not fully load within 30 seconds');
//Wait until the modal title is located AND visible
await driver.wait(async () => {
try {
const element = await driver.findElement(By.css('.breadcrumb-item:nth-child(2)'));
return await element.isDisplayed();
} catch (e) {
return false; //Element not ready yet, keep waiting
}
}, 20000, 'Standards search page did not become visible within 20 seconds');
console.log('Passed: Standards search page loaded successfully');
//Throw summary if any validation failed
if (errors.length > 0) {
//Add summary line only when multiple checks failed
if (errors.length > 1) {
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
}
//Throw collected messages — catch() will prefix with "FAILED:"
throw new Error(errors.join('\n'));
}
}
},
//Then spread all your existing steps
...myStandardsSearch_AlignedContent(driver)
];
const logStep = (worksheet, stepDescription, status, stepIndex, timestamp, screenshotPath) => {
const json_data = XLSX.utils.sheet_to_json(worksheet, { header: 1 });
json_data.push([stepIndex, stepDescription, status, timestamp, screenshotPath]);
return XLSX.utils.aoa_to_sheet(json_data);
};
const takeScreenshot = async (driver, stepIndex, stepDescription) => {
const screenshot = await driver.takeScreenshot();
const dir = path.join('screenshots', 'myStandardsSearchAlignedContentResults');
const screenshotFileName = `step_${stepIndex}_${stepDescription.replace(/\s+/g, '_')}.png`;
const screenshotPath = path.join(dir, screenshotFileName);
fs.writeFileSync(screenshotPath, screenshot, 'base64');
return screenshotPath;
};
const clearOldResults = () => {
//Remove old screenshots
const screenshotDir = path.join('screenshots', 'myStandardsSearchAlignedContentResults');
if (fs.existsSync(screenshotDir)) {
fs.rmSync(screenshotDir, { recursive: true, force: true });
}
fs.mkdirSync(screenshotDir, { recursive: true });
//Remove old Excel file
if (fs.existsSync('myStandardsSearchAlignedContentResults.xlsx')) {
fs.unlinkSync('myStandardsSearchAlignedContentResults.xlsx');
}
};
try {
//Initialize workbook and worksheet
clearOldResults();
//Initialize workbook and worksheet
workbook = XLSX.utils.book_new();
worksheet = XLSX.utils.aoa_to_sheet([
['Step Number', 'Step Description', 'Status', 'Timestamp', 'Screenshot']
]);
XLSX.utils.book_append_sheet(workbook, worksheet, 'Sheet1');
//Log test start time
worksheet = logStep(worksheet, 'Test Start', 'Started', '', startTime, '');
let allStepsPassed = true;
const failedSteps = []; //Track failed steps
for (const step of steps) {
const stepIndex = steps.indexOf(step) + 1;
const timestamp = new Date().toISOString();
try {
await step.action();
worksheet = logStep(
worksheet,
step.description,
'Passed',
stepIndex,
timestamp,
null
);
} catch (error) {
const screenshotPath = await takeScreenshot(
driver,
stepIndex,
`${step.description}_Failed`
);
worksheet = logStep(
worksheet,
step.description,
'Failed',
stepIndex,
timestamp,
screenshotPath
);
console.error(`Step ${stepIndex} FAILED: ${error.message}`);
failedSteps.push(`Step ${stepIndex}: ${step.description} - ${error.message}`); //Track failed step
testStatus = 'Failed';
allStepsPassed = false;
}
}
if (allStepsPassed) {
console.log('------------->| THE END |<-------------');
console.log('PASSED: My Standards Search - Aligned Content (myStandardsSearchAlignedContent); All test steps completed successfully');
testStatus = 'Passed';
} else {
console.log('------------->| THE END |<-------------');
console.log('FAILED: My Standards Search - Aligned Content (myStandardsSearchAlignedContent); One or more test steps failed');
console.log('FAILED STEPS:');
failedSteps.forEach(step => console.error(` ✗ ${step}`));
testStatus = 'Failed';
}
//Log test end time
const endTime = new Date().toISOString();
worksheet = logStep(worksheet, 'Test End', testStatus, '', endTime, '');
//Write the updated worksheet back to the workbook and save it
workbook.Sheets['Sheet1'] = worksheet;
XLSX.writeFile(workbook, 'myStandardsSearchAlignedContentResults.xlsx');
} finally {
await driver.quit();
}
})();
};
export default myStandardsSearch;