2753 lines
107 KiB
JavaScript
2753 lines
107 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_RelatedStandards = (driver) => [
|
|
{
|
|
description: 'Log Related Standards start',
|
|
action: async () => {
|
|
console.log('------------->| MY STANDARDS - RELATED STANDARDS |<-------------');
|
|
}
|
|
},
|
|
|
|
//Search breadcrumb
|
|
{
|
|
description: 'Validate Search breadcrumb link text, font, size, and color',
|
|
action: async () => {
|
|
const multipleChecks = 'Search breadcrumb link';
|
|
const element = await driver.findElement(By.linkText('Search'));
|
|
|
|
//Get text, font, size, and color
|
|
const elementText = await element.getText();
|
|
const elementFont = await element.getCssValue('font-family');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
const elementColor = await element.getCssValue('color');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//text
|
|
if (elementText === 'Search') {
|
|
console.log("Passed: Search breadcrumb text link matched as expected");
|
|
} else {
|
|
errors.push(`Expected: "Search" breadcrumb text link; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//font
|
|
if (elementFont === 'Poppins, sans-serif') {
|
|
console.log('Passed: Search breadcrumb text link font-family matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Search breadcrumb text link font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
|
|
}
|
|
|
|
//size
|
|
if (elementSize === '13px') {
|
|
console.log('Passed: Search breadcrumb text link font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Search breadcrumb text link font-size "13px"; Actual: "${elementSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementColor === 'rgba(73, 80, 87, 1)') {
|
|
console.log('Passed: Search breadcrumb text link color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Search breadcrumb text link color "rgba(73, 80, 87, 1)"; Actual: "${elementColor}"`);
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Standards breadcrumb
|
|
{
|
|
description: 'Validate Standards breadcrumb link text, font, size, and color',
|
|
action: async () => {
|
|
const multipleChecks = 'Standards breadcrum';
|
|
const element = await driver.findElement(By.css('.breadcrumb-item:nth-child(2)'));
|
|
|
|
//Get text, font, size, and color
|
|
const elementText = await element.getText();
|
|
const elementFont = await element.getCssValue('font-family');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
const elementColor = await element.getCssValue('color');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//text
|
|
if (elementText === 'Standards') {
|
|
console.log("Passed: Standards breadcrumb text link matched as expected");
|
|
} else {
|
|
errors.push(`Expected: "Standards" breadcrumb text link; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//font
|
|
if (elementFont === 'Poppins, sans-serif') {
|
|
console.log('Passed: Standards breadcrumb text link font-family matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Standards breadcrumb text link font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
|
|
}
|
|
|
|
//size
|
|
if (elementSize === '13px') {
|
|
console.log('Passed: Standards breadcrumb text link font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Standards breadcrumb text link font-size "13px"; Actual: "${elementSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementColor === 'rgba(48, 200, 172, 1)') {
|
|
console.log('Passed: Standards breadcrumb text link color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Standards breadcrumb text link color "rgba(48, 200, 172, 1)"; Actual: "${elementColor}"`);
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Save icon
|
|
{
|
|
description: 'Validate Save icon',
|
|
action: async () => {
|
|
const multipleChecks = 'Save icon';
|
|
const element = await driver.findElement(By.css('body > div.container.body > div > div.right_col > div > div.float-right.ml-1 > a:nth-child(1)'));
|
|
|
|
const elementText = await element.getAttribute('title');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//icon
|
|
if (element) {
|
|
console.log('Passed: Save icon present');
|
|
} else {
|
|
errors.push('Save icon was not found');
|
|
}
|
|
|
|
//text
|
|
if (elementText === 'Save This Search') {
|
|
console.log('Passed: Save icon tool-tip matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Save icon tool-tip: "Save This Search"; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Print icon
|
|
{
|
|
description: 'Validate Print icon',
|
|
action: async () => {
|
|
const multipleChecks = 'Print icon';
|
|
const element = await driver.findElement(By.css('.icon-link > img'));
|
|
|
|
//Get text, font, size, and color
|
|
const elementText = await element.getAttribute('title');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//icon
|
|
if (element) {
|
|
console.log('Passed: Print icon present');
|
|
} else {
|
|
errors.push('Print icon was not found');
|
|
}
|
|
|
|
//text
|
|
if (elementText === 'Print This Page') {
|
|
console.log('Passed: Print icon tool-tip matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Print icon tool-tip: "Print This Page"; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Standard Set title
|
|
{
|
|
description: 'Validate Standard Set title text, font, size, and color',
|
|
action: async () => {
|
|
const multipleChecks = 'Standard Set title';
|
|
const element = await driver.findElement(By.css('h1'));
|
|
|
|
//Get text, font, size, and color
|
|
const elementText = await element.getText();
|
|
const elementFont = await element.getCssValue('font-family');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
const elementColor = await element.getCssValue('color');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//text
|
|
if (elementText === 'Alabama Courses of Study') {
|
|
console.log("Passed: Alabama Courses of Study Standard Set title text link matched as expected");
|
|
} else {
|
|
errors.push(`Expected: "Alabama Courses of Study" Standard Set title text link; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//font
|
|
if (elementFont === 'Poppins, sans-serif') {
|
|
console.log('Passed: Alabama Courses of Study Standard Set title text link font-family matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Alabama Courses of Study Standard Set title text link font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
|
|
}
|
|
|
|
//size
|
|
if (elementSize === '18.2px') {
|
|
console.log('Passed: Alabama Courses of Study Standard Set title text link font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Alabama Courses of Study Standard Set title text link font-size "18.2px"; Actual: "${elementSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementColor === 'rgba(40, 39, 90, 1)') {
|
|
console.log('Passed: Alabama Courses of Study Standard Set title text link color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Alabama Courses of Study Standard Set title text link color "rgba(40, 39, 90, 1)"; Actual: "${elementColor}"`);
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//SubjectGrade title
|
|
{
|
|
description: 'Validate SubjectGrade title text, font, size, and color',
|
|
action: async () => {
|
|
const multipleChecks = 'SubjectGrade title';
|
|
const element = await driver.findElement(By.css('strong'));
|
|
|
|
//Get text, font, size, and color
|
|
const elementText = await element.getText();
|
|
const elementFont = await element.getCssValue('font-family');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
const elementColor = await element.getCssValue('color');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//text
|
|
if (elementText === 'Mathematics - Grade 9') {
|
|
console.log("Passed: Mathematics - Grade 9 SubjectGrade title text link matched as expected");
|
|
} else {
|
|
errors.push(`Expected: "Mathematics - Grade 9" SubjectGrade title text link; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//font
|
|
if (elementFont === 'Poppins, sans-serif') {
|
|
console.log('Passed: Mathematics - Grade 9 SubjectGrade title text link font-family matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Mathematics - Grade 9 SubjectGrade title text link font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
|
|
}
|
|
|
|
//size
|
|
if (elementSize === '13px') {
|
|
console.log('Passed: Mathematics - Grade 9 SubjectGrade title text link font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Mathematics - Grade 9 SubjectGrade title text link font-size "13px"; Actual: "${elementSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementColor === 'rgba(40, 39, 90, 1)') {
|
|
console.log('Passed: Mathematics - Grade 9 SubjectGrade title text link color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Mathematics - Grade 9 SubjectGrade title text link color "rgba(40, 39, 90, 1)"; Actual: "${elementColor}"`);
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Info icon
|
|
{
|
|
description: 'Validate Info icon',
|
|
action: async () => {
|
|
const multipleChecks = 'Info icon';
|
|
const element = await driver.findElement(By.css('body > div.container.body > div > div.right_col > div > div:nth-child(5) > a'));
|
|
|
|
//Get text, font, size, and color
|
|
const elementText = await element.getAttribute('title');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//icon
|
|
if (element) {
|
|
console.log('Passed: Info icon present');
|
|
} else {
|
|
errors.push('Info icon was not found');
|
|
}
|
|
|
|
//text
|
|
if (elementText === 'Alignment Modification Help') {
|
|
console.log('Passed: Info icon tool-tip matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Info icon tool-tip: "Alignment Modification Help"; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Show All Correlations button
|
|
{
|
|
description: 'Validate Show All Correlations button text, size, and color',
|
|
action: async () => {
|
|
const multipleChecks = 'Show All Correlations button';
|
|
const element = await driver.findElement(By.css('.btn-primary:nth-child(2)'));
|
|
|
|
//Get text, font, size, and color
|
|
const elementText = await element.getText();
|
|
const elementTextFont = await element.getCssValue('font-family');
|
|
const elementTextSize = await element.getCssValue('font-size');
|
|
const elementTextColor = await element.getCssValue('color');
|
|
const elementButtonColor = await element.getCssValue('background-color');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//text
|
|
if (elementText === 'Show All Correlations') {
|
|
console.log('Passed: Show All Correlations button text matched as expected');
|
|
} else {
|
|
errors.push(`Expected: "Show All Correlations"; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//font
|
|
if (elementTextFont === 'Poppins, sans-serif') {
|
|
console.log('Passed: Show All Correlations button text font-family matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Show All Correlations button text font-family "Poppins, sans-serif"; Actual: ${elementTextFont}`);
|
|
}
|
|
|
|
//size
|
|
if (elementTextSize === '14px') {
|
|
console.log('Passed: Show All Correlations button text font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Show All Correlations button text font-size "14px"; Actual: "${elementTextSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementTextColor === 'rgba(255, 255, 255, 1)') {
|
|
console.log('Passed: Show All Correlations button text color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Show All Correlations button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`);
|
|
}
|
|
|
|
//button color
|
|
if (elementButtonColor === 'rgba(48, 200, 172, 1)') {
|
|
console.log('Passed: Show All Correlations button background color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Show All Correlations button background color: "rgba(48, 200, 172, 1)"; Actual: "${elementButtonColor}"`);
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Level 1 Standard title
|
|
{
|
|
description: 'Validate Level 1 Standard title text, font, size, color, and background color',
|
|
action: async () => {
|
|
const multipleChecks = 'Level 1 Standard title';
|
|
const element = await driver.findElement(By.css('.card:nth-child(8) > .card-header'));
|
|
|
|
//Get text, font, size, color, and background color
|
|
const elementText = await element.getText();
|
|
const elementFont = await element.getCssValue('font-family');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
const elementColor = await element.getCssValue('color');
|
|
const elementBgColor = await element.getCssValue('background-color')
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//text
|
|
if (elementText === 'Mathematical Practices (Grade 9)') {
|
|
console.log("Passed: Mathematical Practices (Grade 9) Level 1 Standard title text matched as expected");
|
|
} else {
|
|
errors.push(`Expected: "Mathematical Practices (Grade 9)" Level 1 Standard title text; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//font
|
|
if (elementFont === 'Poppins, sans-serif') {
|
|
console.log('Passed: Mathematical Practices (Grade 9) Level 1 Standard title text font-family matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Mathematical Practices (Grade 9) Level 1 Standard title text font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
|
|
}
|
|
|
|
//size
|
|
if (elementSize === '15px') {
|
|
console.log('Passed: Mathematical Practices (Grade 9) Level 1 Standard title text font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Mathematical Practices (Grade 9) Level 1 Standard title text font-size "15px"; Actual: "${elementSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementColor === 'rgba(255, 255, 255, 1)') {
|
|
console.log('Passed: Mathematical Practices (Grade 9) Level 1 Standard title text color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Mathematical Practices (Grade 9) Level 1 Standard title text color "rgba(255, 255, 255, 1)"; Actual: "${elementColor}"`);
|
|
}
|
|
|
|
//background-color
|
|
if (elementBgColor === 'rgba(48, 200, 172, 1)') {
|
|
console.log('Passed: Mathematical Practices (Grade 9) Level 1 Standard title background color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Mathematical Practices (Grade 9) Level 1 Standard title background color "rgba(48, 200, 172, 1)"; Actual: "${elementBgColor}"`);
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Standard Code 1 title
|
|
{
|
|
description: 'Validate Standard Code 1, title text, font, size, and color',
|
|
action: async () => {
|
|
const multipleChecks = 'Standard Code 1, title';
|
|
const element = await driver.findElement(By.xpath('//div[2]/div/b'));
|
|
|
|
//Get text, font, size, and color
|
|
const elementText = await element.getText();
|
|
const elementFont = await element.getCssValue('font-family');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
const elementColor = await element.getCssValue('color');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//text
|
|
if (elementText === 'MP1') {
|
|
console.log("Passed: Standard Code 1, title text matched as expected");
|
|
} else {
|
|
errors.push(`Expected: "MP1" Standard Code 1, title text; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//font
|
|
if (elementFont === 'Poppins, sans-serif') {
|
|
console.log('Passed: Standard Code 1, title text font-family matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Standard Code 1, title text font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
|
|
}
|
|
|
|
//size
|
|
if (elementSize === '13px') {
|
|
console.log('Passed: Standard Code 1, title text font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Standard Code 1, title text font-size "13px"; Actual: "${elementSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementColor === 'rgba(40, 39, 90, 1)') {
|
|
console.log('Passed: Standard Code 1, title text color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Standard Code 1, title text color "rgba(40, 39, 90, 1)"; Actual: "${elementColor}"`);
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Standard Code 1 Description
|
|
{
|
|
description: 'Validate Standard Code 1, description text, font, size, and color',
|
|
action: async () => {
|
|
const multipleChecks = 'Standard Code 1, description';
|
|
const element = await driver.findElement(By.id('stdbox'));
|
|
|
|
//Get text, font, size, and color
|
|
const elementText = await element.getText();
|
|
const elementFont = await element.getCssValue('font-family');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
const elementColor = await element.getCssValue('color');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//text
|
|
if (elementText.includes ('Make sense of problems and persevere in solving them. (Grade 9)')) {
|
|
console.log("Passed: Standard Code 1, description text matched as expected");
|
|
} else {
|
|
errors.push(`Expected: "Make sense of problems and persevere in solving them. (Grade 9)" Standard Code 1, description text; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//font
|
|
if (elementFont === 'Poppins, sans-serif') {
|
|
console.log('Passed: Standard Code 1, description text font-family matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Standard Code 1, description text font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
|
|
}
|
|
|
|
//size
|
|
if (elementSize === '13px') {
|
|
console.log('Passed: Standard Code 1, description text font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Standard Code 1, description text font-size "13px"; Actual: "${elementSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementColor === 'rgba(40, 39, 90, 1)') {
|
|
console.log('Passed: Standard Code 1, description text color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Standard Code 1, description text color "rgba(40, 39, 90, 1)"; Actual: "${elementColor}"`);
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Standard Code 1 Tools button
|
|
{
|
|
description: 'Validate Standard Code 1, Tools button text, size, and color',
|
|
action: async () => {
|
|
const multipleChecks = 'Standard Code 1, Tools button';
|
|
const elementIcon = await driver.findElement(By.xpath(`//div[@id='stdbox']/div/div/button/i`));
|
|
const element = await driver.findElement(By.css('#stdbox > div.pull-right > div > button'));
|
|
const elementExpandIcon = await driver.findElement(By.xpath(`(//button[@type='button'])[4]`));
|
|
|
|
//Get text, font, size, and color
|
|
const elementText = await element.getText();
|
|
const elementTextFont = await element.getCssValue('font-family');
|
|
const elementTextSize = await element.getCssValue('font-size');
|
|
const elementTextColor = await element.getCssValue('color');
|
|
const elementButtonColor = await element.getCssValue('background-color');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//icon
|
|
if (elementIcon) {
|
|
console.log('Passed: Standard Code 1, tools button icon found')
|
|
} else {
|
|
errors.push('FAILED: Standard Code 1 tools button icon not found')
|
|
}
|
|
|
|
//text
|
|
if (elementText === 'Tools') {
|
|
console.log('Passed: Standard Code 1, Tools button text matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Standard Code 1, "Tools"; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//font
|
|
if (elementTextFont === 'Poppins, sans-serif') {
|
|
console.log('Passed: Standard Code 1, Tools button text font-family matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Standard Code 1, Tools button text font-family "Poppins, sans-serif"; Actual: ${elementTextFont}`);
|
|
}
|
|
|
|
//size
|
|
if (elementTextSize === '16px') {
|
|
console.log('Passed: Standard Code 1, Tools button text font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Standard Code 1, Tools button text font-size "16px"; Actual: "${elementTextSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementTextColor === 'rgba(255, 255, 255, 1)') {
|
|
console.log('Passed: Standard Code 1, Tools button text color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Standard Code 1, Tools button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`);
|
|
}
|
|
|
|
//button color
|
|
if (elementButtonColor === 'rgba(48, 200, 172, 1)') {
|
|
console.log('Passed: Standard Code 1, Tools button background color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Standard Code 1, Tools button background color: "rgba(48, 200, 172, 1)"; Actual: "${elementButtonColor}"`);
|
|
}
|
|
|
|
//expand icon
|
|
if (elementExpandIcon) {
|
|
console.log('Passed: Standard Code 1, Tools expand button icon found')
|
|
} else {
|
|
errors.push('FAILED: Standard Code 1, Tools expand button icon not found')
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Standard Code 1 Aligned Content button
|
|
{
|
|
description: 'Validate Standard Code 1, Aligned Content 8 button text, size, and color',
|
|
action: async () => {
|
|
const multipleChecks = 'Standard Code 1, Aligned Content 8 button';
|
|
const element = await driver.findElement(By.id('corr-1439152630-tab'));
|
|
const elementExpandIcon = await driver.findElement(By.id('colstate1439152630'));
|
|
|
|
//Get text, font, size, and color
|
|
const elementText = await element.getText();
|
|
const elementTextFont = await element.getCssValue('font-family');
|
|
const elementTextSize = await element.getCssValue('font-size');
|
|
const elementTextColor = await element.getCssValue('color');
|
|
const elementButtonColor = await element.getCssValue('background-color');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//text
|
|
if (elementText === 'Aligned Content 8') {
|
|
console.log('Passed: Standard Code 1, Aligned Content 8 button text matched as expected');
|
|
} else {
|
|
errors.push(`Expected: "Aligned Content 8"; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//font
|
|
if (elementTextFont === 'Poppins, sans-serif') {
|
|
console.log('Passed: Standard Code 1, Aligned Content 8 button text font-family matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Standard Code 1, Aligned Content 8 button text font-family "Poppins, sans-serif"; Actual: ${elementTextFont}`);
|
|
}
|
|
|
|
//size
|
|
if (elementTextSize === '15px') {
|
|
console.log('Passed: Standard Code 1, Aligned Content 8 button text font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Standard Code 1, Aligned Content 8 button text font-size "15px"; Actual: "${elementTextSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementTextColor === 'rgba(255, 255, 255, 1)') {
|
|
console.log('Passed: Standard Code 1, Aligned Content 8 button text color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Standard Code 1, Aligned Content 8 button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`);
|
|
}
|
|
|
|
//button color
|
|
if (elementButtonColor === 'rgba(40, 39, 90, 1)') {
|
|
console.log('Passed: Standard Code 1, Aligned Content 8 button background color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Standard Code 1, Aligned Content 8 button background color: "rgba(40, 39, 90, 1)"; Actual: "${elementButtonColor}"`);
|
|
}
|
|
|
|
//expand icon
|
|
if (elementExpandIcon) {
|
|
console.log('Passed: Standard Code 1, Aligned Content 8 expand button icon found')
|
|
} else {
|
|
errors.push('FAILED: Standard Code 1, Aligned Content 8 expand button icon not found')
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Standard Code 1 Related Standards button
|
|
{
|
|
description: 'Validate Standard Code 1, Related Standards 26 button text, size, and color',
|
|
action: async () => {
|
|
const multipleChecks = 'Standard Code 1, Related Standards 26 button';
|
|
const element = await driver.findElement(By.css('#rel-1439152630-tab'));
|
|
|
|
//Get text, font, size, and color
|
|
const elementText = await element.getText();
|
|
const elementTextFont = await element.getCssValue('font-family');
|
|
const elementTextSize = await element.getCssValue('font-size');
|
|
const elementTextColor = await element.getCssValue('color');
|
|
const elementButtonColor = await element.getCssValue('background-color');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//text
|
|
if (elementText === 'Related Standards 26') {
|
|
console.log('Passed: Standard Code 1, Related Standards 26 button text matched as expected');
|
|
} else {
|
|
errors.push(`Expected: "Related Standards 26"; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//font
|
|
if (elementTextFont === 'Poppins, sans-serif') {
|
|
console.log('Passed: Standard Code 1, Related Standards 26 button text font-family matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Standard Code 1, Related Standards 26 button text font-family "Poppins, sans-serif"; Actual: ${elementTextFont}`);
|
|
}
|
|
|
|
//size
|
|
if (elementTextSize === '15px') {
|
|
console.log('Passed: Standard Code 1, Related Standards 26 button text font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Standard Code 1, Related Standards 26 button text font-size "15px"; Actual: "${elementTextSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementTextColor === 'rgba(182, 186, 181, 1)') {
|
|
console.log('Passed: Standard Code 1, Related Standards 26 button text color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Standard Code 1, Related Standards 26 button text color: "rgba(182, 186, 181, 1)"; Actual: "${elementTextColor}"`);
|
|
}
|
|
|
|
//button color
|
|
if (elementButtonColor === 'rgba(0, 0, 0, 0)') {
|
|
console.log('Passed: Standard Code 1, Related Standards 26 button background color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Standard Code 1, Related Standards 26 button background color: "rgba(0, 0, 0, 0)"; Actual: "${elementButtonColor}"`);
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Standard Code 1 Add Direct Alignment button
|
|
{
|
|
description: 'Validate Standard Code 1, Add Direct Alignment button text, size, and color',
|
|
action: async () => {
|
|
const multipleChecks = 'Standard Code 1, Add Direct Alignment button';
|
|
const elementIcon = await driver.findElement(By.css('#add-1439152630-tab > .fa'));
|
|
const element = await driver.findElement(By.css('#add-1439152630-tab'));
|
|
|
|
//Get text, font, size, and color
|
|
const elementText = await element.getText();
|
|
const elementTextFont = await element.getCssValue('font-family');
|
|
const elementTextSize = await element.getCssValue('font-size');
|
|
const elementTextColor = await element.getCssValue('color');
|
|
const elementButtonColor = await element.getCssValue('background-color');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//icon
|
|
if (elementIcon) {
|
|
console.log('Passed: Standard Code 1, Add Direct Alignment button icon found')
|
|
} else {
|
|
errors.push('FAILED: Standard Code 1, Add Direct Alignment button icon not found')
|
|
}
|
|
|
|
//text
|
|
if (elementText === 'Add Direct Alignment') {
|
|
console.log('Passed: Standard Code 1, Add Direct Alignment button text matched as expected');
|
|
} else {
|
|
errors.push(`Expected: "Add Direct Alignment"; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//font
|
|
if (elementTextFont === 'Poppins, sans-serif') {
|
|
console.log('Passed: Standard Code 1, Add Direct Alignment button text font-family matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Standard Code 1, Add Direct Alignment button text font-family "Poppins, sans-serif"; Actual: ${elementTextFont}`);
|
|
}
|
|
|
|
//size
|
|
if (elementTextSize === '15px') {
|
|
console.log('Passed: Standard Code 1, Add Direct Alignment button text font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Standard Code 1, Add Direct Alignment button text font-size "15px"; Actual: "${elementTextSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementTextColor === 'rgba(182, 186, 181, 1)') {
|
|
console.log('Passed: Standard Code 1, Add Direct Alignment button text color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Standard Code 1, Add Direct Alignment button text color: "rgba(182, 186, 181, 1)"; Actual: "${elementTextColor}"`);
|
|
}
|
|
|
|
//button color
|
|
if (elementButtonColor === 'rgba(0, 0, 0, 0)') {
|
|
console.log('Passed: Standard Code 1, Add Direct Alignment button background color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Standard Code 1, Add Direct Alignment button background color: "rgba(0, 0, 0, 0)"; Actual: "${elementButtonColor}"`);
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//NEXT ACTION
|
|
{
|
|
description: 'Click to expand Aligned Content for Standard Code 1',
|
|
action: async () => {
|
|
//Standard Code 1 Aligned Content
|
|
await driver.findElement(By.css('#rel-1439152630-tab')).click();
|
|
console.log('----->| NEXT ACTION: Clicked Standard Code 1 Related Standards button');
|
|
|
|
//Wait until the element exists in the DOM
|
|
const openAlignmentNewWindow = await driver.wait(
|
|
until.elementLocated(By.css('#selectToggle1439152630')),
|
|
30000
|
|
);
|
|
|
|
//Wait until it becomes visible
|
|
await driver.wait(
|
|
until.elementIsVisible(openAlignmentNewWindow),
|
|
30000
|
|
);
|
|
}
|
|
},
|
|
|
|
//Search breadcrumb
|
|
{
|
|
description: 'Validate Search breadcrumb link text, font, size, and color',
|
|
action: async () => {
|
|
const multipleChecks = 'Search breadcrumb link';
|
|
const element = await driver.findElement(By.linkText('Search'));
|
|
|
|
//Get text, font, size, and color
|
|
const elementText = await element.getText();
|
|
const elementFont = await element.getCssValue('font-family');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
const elementColor = await element.getCssValue('color');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//text
|
|
if (elementText === 'Search') {
|
|
console.log("Passed: Search breadcrumb text link matched as expected");
|
|
} else {
|
|
errors.push(`Expected: "Search" breadcrumb text link; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//font
|
|
if (elementFont === 'Poppins, sans-serif') {
|
|
console.log('Passed: Search breadcrumb text link font-family matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Search breadcrumb text link font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
|
|
}
|
|
|
|
//size
|
|
if (elementSize === '13px') {
|
|
console.log('Passed: Search breadcrumb text link font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Search breadcrumb text link font-size "13px"; Actual: "${elementSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementColor === 'rgba(73, 80, 87, 1)') {
|
|
console.log('Passed: Search breadcrumb text link color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Search breadcrumb text link color "rgba(73, 80, 87, 1)"; Actual: "${elementColor}"`);
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Standards breadcrumb
|
|
{
|
|
description: 'Validate Standards breadcrumb link text, font, size, and color',
|
|
action: async () => {
|
|
const multipleChecks = 'Standards breadcrum';
|
|
const element = await driver.findElement(By.css('.breadcrumb-item:nth-child(2)'));
|
|
|
|
//Get text, font, size, and color
|
|
const elementText = await element.getText();
|
|
const elementFont = await element.getCssValue('font-family');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
const elementColor = await element.getCssValue('color');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//text
|
|
if (elementText === 'Standards') {
|
|
console.log("Passed: Standards breadcrumb text link matched as expected");
|
|
} else {
|
|
errors.push(`Expected: "Standards" breadcrumb text link; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//font
|
|
if (elementFont === 'Poppins, sans-serif') {
|
|
console.log('Passed: Standards breadcrumb text link font-family matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Standards breadcrumb text link font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
|
|
}
|
|
|
|
//size
|
|
if (elementSize === '13px') {
|
|
console.log('Passed: Standards breadcrumb text link font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Standards breadcrumb text link font-size "13px"; Actual: "${elementSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementColor === 'rgba(48, 200, 172, 1)') {
|
|
console.log('Passed: Standards breadcrumb text link color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Standards breadcrumb text link color "rgba(48, 200, 172, 1)"; Actual: "${elementColor}"`);
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Save icon
|
|
{
|
|
description: 'Validate Save icon',
|
|
action: async () => {
|
|
const multipleChecks = 'Save icon';
|
|
const element = await driver.findElement(By.css('body > div.container.body > div > div.right_col > div > div.float-right.ml-1 > a:nth-child(1)'));
|
|
|
|
const elementText = await element.getAttribute('title');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//icon
|
|
if (element) {
|
|
console.log('Passed: Save icon present');
|
|
} else {
|
|
errors.push('Save icon was not found');
|
|
}
|
|
|
|
//text
|
|
if (elementText === 'Save This Search') {
|
|
console.log('Passed: Save icon tool-tip matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Save icon tool-tip: "Save This Search"; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Print icon
|
|
{
|
|
description: 'Validate Print icon',
|
|
action: async () => {
|
|
const multipleChecks = 'Print icon';
|
|
const element = await driver.findElement(By.css('.icon-link > img'));
|
|
|
|
//Get text, font, size, and color
|
|
const elementText = await element.getAttribute('title');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//icon
|
|
if (element) {
|
|
console.log('Passed: Print icon present');
|
|
} else {
|
|
errors.push('Print icon was not found');
|
|
}
|
|
|
|
//text
|
|
if (elementText === 'Print This Page') {
|
|
console.log('Passed: Print icon tool-tip matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Print icon tool-tip: "Print This Page"; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Standard Set title
|
|
{
|
|
description: 'Validate Standard Set title text, font, size, and color',
|
|
action: async () => {
|
|
const multipleChecks = 'Standard Set title';
|
|
const element = await driver.findElement(By.css('h1'));
|
|
|
|
//Get text, font, size, and color
|
|
const elementText = await element.getText();
|
|
const elementFont = await element.getCssValue('font-family');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
const elementColor = await element.getCssValue('color');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//text
|
|
if (elementText === 'Alabama Courses of Study') {
|
|
console.log("Passed: Alabama Courses of Study Standard Set title text link matched as expected");
|
|
} else {
|
|
errors.push(`Expected: "Alabama Courses of Study" Standard Set title text link; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//font
|
|
if (elementFont === 'Poppins, sans-serif') {
|
|
console.log('Passed: Alabama Courses of Study Standard Set title text link font-family matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Alabama Courses of Study Standard Set title text link font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
|
|
}
|
|
|
|
//size
|
|
if (elementSize === '18.2px') {
|
|
console.log('Passed: Alabama Courses of Study Standard Set title text link font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Alabama Courses of Study Standard Set title text link font-size "18.2px"; Actual: "${elementSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementColor === 'rgba(40, 39, 90, 1)') {
|
|
console.log('Passed: Alabama Courses of Study Standard Set title text link color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Alabama Courses of Study Standard Set title text link color "rgba(40, 39, 90, 1)"; Actual: "${elementColor}"`);
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//SubjectGrade title
|
|
{
|
|
description: 'Validate SubjectGrade title text, font, size, and color',
|
|
action: async () => {
|
|
const multipleChecks = 'SubjectGrade title';
|
|
const element = await driver.findElement(By.css('strong'));
|
|
|
|
//Get text, font, size, and color
|
|
const elementText = await element.getText();
|
|
const elementFont = await element.getCssValue('font-family');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
const elementColor = await element.getCssValue('color');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//text
|
|
if (elementText === 'Mathematics - Grade 9') {
|
|
console.log("Passed: Mathematics - Grade 9 SubjectGrade title text link matched as expected");
|
|
} else {
|
|
errors.push(`Expected: "Mathematics - Grade 9" SubjectGrade title text link; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//font
|
|
if (elementFont === 'Poppins, sans-serif') {
|
|
console.log('Passed: Mathematics - Grade 9 SubjectGrade title text link font-family matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Mathematics - Grade 9 SubjectGrade title text link font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
|
|
}
|
|
|
|
//size
|
|
if (elementSize === '13px') {
|
|
console.log('Passed: Mathematics - Grade 9 SubjectGrade title text link font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Mathematics - Grade 9 SubjectGrade title text link font-size "13px"; Actual: "${elementSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementColor === 'rgba(40, 39, 90, 1)') {
|
|
console.log('Passed: Mathematics - Grade 9 SubjectGrade title text link color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Mathematics - Grade 9 SubjectGrade title text link color "rgba(40, 39, 90, 1)"; Actual: "${elementColor}"`);
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Info icon
|
|
{
|
|
description: 'Validate Info icon',
|
|
action: async () => {
|
|
const multipleChecks = 'Info icon';
|
|
const element = await driver.findElement(By.css('body > div.container.body > div > div.right_col > div > div:nth-child(5) > a'));
|
|
|
|
//Get text, font, size, and color
|
|
const elementText = await element.getAttribute('title');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//icon
|
|
if (element) {
|
|
console.log('Passed: Info icon present');
|
|
} else {
|
|
errors.push('Info icon was not found');
|
|
}
|
|
|
|
//text
|
|
if (elementText === 'Alignment Modification Help') {
|
|
console.log('Passed: Info icon tool-tip matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Info icon tool-tip: "Alignment Modification Help"; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Show All Correlations button
|
|
{
|
|
description: 'Validate Show All Correlations button text, size, and color',
|
|
action: async () => {
|
|
const multipleChecks = 'Show All Correlations button';
|
|
const element = await driver.findElement(By.css('.btn-primary:nth-child(2)'));
|
|
|
|
//Get text, font, size, and color
|
|
const elementText = await element.getText();
|
|
const elementTextFont = await element.getCssValue('font-family');
|
|
const elementTextSize = await element.getCssValue('font-size');
|
|
const elementTextColor = await element.getCssValue('color');
|
|
const elementButtonColor = await element.getCssValue('background-color');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//text
|
|
if (elementText === 'Show All Correlations') {
|
|
console.log('Passed: Show All Correlations button text matched as expected');
|
|
} else {
|
|
errors.push(`Expected: "Show All Correlations"; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//font
|
|
if (elementTextFont === 'Poppins, sans-serif') {
|
|
console.log('Passed: Show All Correlations button text font-family matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Show All Correlations button text font-family "Poppins, sans-serif"; Actual: ${elementTextFont}`);
|
|
}
|
|
|
|
//size
|
|
if (elementTextSize === '14px') {
|
|
console.log('Passed: Show All Correlations button text font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Show All Correlations button text font-size "14px"; Actual: "${elementTextSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementTextColor === 'rgba(255, 255, 255, 1)') {
|
|
console.log('Passed: Show All Correlations button text color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Show All Correlations button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`);
|
|
}
|
|
|
|
//button color
|
|
if (elementButtonColor === 'rgba(48, 200, 172, 1)') {
|
|
console.log('Passed: Show All Correlations button background color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Show All Correlations button background color: "rgba(48, 200, 172, 1)"; Actual: "${elementButtonColor}"`);
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Level 1 Standard title
|
|
{
|
|
description: 'Validate Level 1 Standard title text, font, size, color, and background color',
|
|
action: async () => {
|
|
const multipleChecks = 'Level 1 Standard title';
|
|
const element = await driver.findElement(By.css('.card:nth-child(8) > .card-header'));
|
|
|
|
//Get text, font, size, color, and background color
|
|
const elementText = await element.getText();
|
|
const elementFont = await element.getCssValue('font-family');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
const elementColor = await element.getCssValue('color');
|
|
const elementBgColor = await element.getCssValue('background-color')
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//text
|
|
if (elementText === 'Mathematical Practices (Grade 9)') {
|
|
console.log("Passed: Mathematical Practices (Grade 9) Level 1 Standard title text matched as expected");
|
|
} else {
|
|
errors.push(`Expected: "Mathematical Practices (Grade 9)" Level 1 Standard title text; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//font
|
|
if (elementFont === 'Poppins, sans-serif') {
|
|
console.log('Passed: Mathematical Practices (Grade 9) Level 1 Standard title text font-family matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Mathematical Practices (Grade 9) Level 1 Standard title text font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
|
|
}
|
|
|
|
//size
|
|
if (elementSize === '15px') {
|
|
console.log('Passed: Mathematical Practices (Grade 9) Level 1 Standard title text font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Mathematical Practices (Grade 9) Level 1 Standard title text font-size "15px"; Actual: "${elementSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementColor === 'rgba(255, 255, 255, 1)') {
|
|
console.log('Passed: Mathematical Practices (Grade 9) Level 1 Standard title text color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Mathematical Practices (Grade 9) Level 1 Standard title text color "rgba(255, 255, 255, 1)"; Actual: "${elementColor}"`);
|
|
}
|
|
|
|
//background-color
|
|
if (elementBgColor === 'rgba(48, 200, 172, 1)') {
|
|
console.log('Passed: Mathematical Practices (Grade 9) Level 1 Standard title background color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Mathematical Practices (Grade 9) Level 1 Standard title background color "rgba(48, 200, 172, 1)"; Actual: "${elementBgColor}"`);
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Standard Code 1 title
|
|
{
|
|
description: 'Validate Standard Code 1, title text, font, size, and color',
|
|
action: async () => {
|
|
const multipleChecks = 'Standard Code 1, title';
|
|
const element = await driver.findElement(By.xpath('//div[2]/div/b'));
|
|
|
|
//Get text, font, size, and color
|
|
const elementText = await element.getText();
|
|
const elementFont = await element.getCssValue('font-family');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
const elementColor = await element.getCssValue('color');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//text
|
|
if (elementText === 'MP1') {
|
|
console.log("Passed: Standard Code 1, title text matched as expected");
|
|
} else {
|
|
errors.push(`Expected: "MP1" Standard Code 1, title text; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//font
|
|
if (elementFont === 'Poppins, sans-serif') {
|
|
console.log('Passed: Standard Code 1, title text font-family matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Standard Code 1, title text font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
|
|
}
|
|
|
|
//size
|
|
if (elementSize === '13px') {
|
|
console.log('Passed: Standard Code 1, title text font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Standard Code 1, title text font-size "13px"; Actual: "${elementSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementColor === 'rgba(40, 39, 90, 1)') {
|
|
console.log('Passed: Standard Code 1, title text color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Standard Code 1, title text color "rgba(40, 39, 90, 1)"; Actual: "${elementColor}"`);
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Standard Code 1 Description
|
|
{
|
|
description: 'Validate Standard Code 1, description text, font, size, and color',
|
|
action: async () => {
|
|
const multipleChecks = 'Standard Code 1, description';
|
|
const element = await driver.findElement(By.id('stdbox'));
|
|
|
|
//Get text, font, size, and color
|
|
const elementText = await element.getText();
|
|
const elementFont = await element.getCssValue('font-family');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
const elementColor = await element.getCssValue('color');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//text
|
|
if (elementText.includes ('Make sense of problems and persevere in solving them. (Grade 9)')) {
|
|
console.log("Passed: Standard Code 1, description text matched as expected");
|
|
} else {
|
|
errors.push(`Expected: "Make sense of problems and persevere in solving them. (Grade 9)" Standard Code 1, description text; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//font
|
|
if (elementFont === 'Poppins, sans-serif') {
|
|
console.log('Passed: Standard Code 1, description text font-family matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Standard Code 1, description text font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
|
|
}
|
|
|
|
//size
|
|
if (elementSize === '13px') {
|
|
console.log('Passed: Standard Code 1, description text font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Standard Code 1, description text font-size "13px"; Actual: "${elementSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementColor === 'rgba(40, 39, 90, 1)') {
|
|
console.log('Passed: Standard Code 1, description text color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Standard Code 1, description text color "rgba(40, 39, 90, 1)"; Actual: "${elementColor}"`);
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Standard Code 1 Tools button
|
|
{
|
|
description: 'Validate Standard Code 1, Tools button text, size, and color',
|
|
action: async () => {
|
|
const multipleChecks = 'Standard Code 1, Tools button';
|
|
const elementIcon = await driver.findElement(By.xpath(`//div[@id='stdbox']/div/div/button/i`));
|
|
const element = await driver.findElement(By.css('#stdbox > div.pull-right > div > button'));
|
|
const elementExpandIcon = await driver.findElement(By.xpath(`(//button[@type='button'])[4]`));
|
|
|
|
//Get text, font, size, and color
|
|
const elementText = await element.getText();
|
|
const elementTextFont = await element.getCssValue('font-family');
|
|
const elementTextSize = await element.getCssValue('font-size');
|
|
const elementTextColor = await element.getCssValue('color');
|
|
const elementButtonColor = await element.getCssValue('background-color');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//icon
|
|
if (elementIcon) {
|
|
console.log('Passed: Standard Code 1, tools button icon found')
|
|
} else {
|
|
errors.push('FAILED: Standard Code 1 tools button icon not found')
|
|
}
|
|
|
|
//text
|
|
if (elementText === 'Tools') {
|
|
console.log('Passed: Standard Code 1, Tools button text matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Standard Code 1, "Tools"; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//font
|
|
if (elementTextFont === 'Poppins, sans-serif') {
|
|
console.log('Passed: Standard Code 1, Tools button text font-family matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Standard Code 1, Tools button text font-family "Poppins, sans-serif"; Actual: ${elementTextFont}`);
|
|
}
|
|
|
|
//size
|
|
if (elementTextSize === '16px') {
|
|
console.log('Passed: Standard Code 1, Tools button text font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Standard Code 1, Tools button text font-size "16px"; Actual: "${elementTextSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementTextColor === 'rgba(255, 255, 255, 1)') {
|
|
console.log('Passed: Standard Code 1, Tools button text color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Standard Code 1, Tools button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`);
|
|
}
|
|
|
|
//button color
|
|
if (elementButtonColor === 'rgba(48, 200, 172, 1)') {
|
|
console.log('Passed: Standard Code 1, Tools button background color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Standard Code 1, Tools button background color: "rgba(48, 200, 172, 1)"; Actual: "${elementButtonColor}"`);
|
|
}
|
|
|
|
//expand icon
|
|
if (elementExpandIcon) {
|
|
console.log('Passed: Standard Code 1, Tools expand button icon found')
|
|
} else {
|
|
errors.push('FAILED: Standard Code 1, Tools expand button icon not found')
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Standard Code 1 Aligned Content button
|
|
{
|
|
description: 'Validate Standard Code 1, Aligned Content 8 button text, size, and color',
|
|
action: async () => {
|
|
const multipleChecks = 'Standard Code 1, Aligned Content 8 button';
|
|
const element = await driver.findElement(By.id('corr-1439152630-tab'));
|
|
const elementExpandIcon = await driver.findElement(By.id('colstate1439152630'));
|
|
|
|
//Get text, font, size, and color
|
|
const elementText = await element.getText();
|
|
const elementTextFont = await element.getCssValue('font-family');
|
|
const elementTextSize = await element.getCssValue('font-size');
|
|
const elementTextColor = await element.getCssValue('color');
|
|
const elementButtonColor = await element.getCssValue('background-color');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//text
|
|
if (elementText === 'Aligned Content 8') {
|
|
console.log('Passed: Standard Code 1, Aligned Content 8 button text matched as expected');
|
|
} else {
|
|
errors.push(`Expected: "Aligned Content 8"; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//font
|
|
if (elementTextFont === 'Poppins, sans-serif') {
|
|
console.log('Passed: Standard Code 1, Aligned Content 8 button text font-family matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Standard Code 1, Aligned Content 8 button text font-family "Poppins, sans-serif"; Actual: ${elementTextFont}`);
|
|
}
|
|
|
|
//size
|
|
if (elementTextSize === '15px') {
|
|
console.log('Passed: Standard Code 1, Aligned Content 8 button text font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Standard Code 1, Aligned Content 8 button text font-size "15px"; Actual: "${elementTextSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementTextColor === 'rgba(182, 186, 181, 1)') {
|
|
console.log('Passed: Standard Code 1, Aligned Content 8 button text color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Standard Code 1, Aligned Content 8 button text color: "rgba(182, 186, 181, 1)"; Actual: "${elementTextColor}"`);
|
|
}
|
|
|
|
//button color
|
|
if (elementButtonColor === 'rgba(0, 0, 0, 0)') {
|
|
console.log('Passed: Standard Code 1, Aligned Content 8 button background color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Standard Code 1, Aligned Content 8 button background color: "rgba(0, 0, 0, 0)"; Actual: "${elementButtonColor}"`);
|
|
}
|
|
|
|
//expand icon
|
|
if (elementExpandIcon) {
|
|
console.log('Passed: Standard Code 1, Aligned Content 8 expand button icon found')
|
|
} else {
|
|
errors.push('FAILED: Standard Code 1, Aligned Content 8 expand button icon not found')
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Standard Code 1 Related Standards button
|
|
{
|
|
description: 'Validate Standard Code 1, Related Standards 26 button text, size, and color',
|
|
action: async () => {
|
|
const multipleChecks = 'Standard Code 1, Related Standards 26 button';
|
|
const element = await driver.findElement(By.css('#rel-1439152630-tab'));
|
|
|
|
//Get text, font, size, and color
|
|
const elementText = await element.getText();
|
|
const elementTextFont = await element.getCssValue('font-family');
|
|
const elementTextSize = await element.getCssValue('font-size');
|
|
const elementTextColor = await element.getCssValue('color');
|
|
const elementButtonColor = await element.getCssValue('background-color');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//text
|
|
if (elementText === 'Related Standards 26') {
|
|
console.log('Passed: Standard Code 1, Related Standards 26 button text matched as expected');
|
|
} else {
|
|
errors.push(`Expected: "Related Standards 26"; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//font
|
|
if (elementTextFont === 'Poppins, sans-serif') {
|
|
console.log('Passed: Standard Code 1, Related Standards 26 button text font-family matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Standard Code 1, Related Standards 26 button text font-family "Poppins, sans-serif"; Actual: ${elementTextFont}`);
|
|
}
|
|
|
|
//size
|
|
if (elementTextSize === '15px') {
|
|
console.log('Passed: Standard Code 1, Related Standards 26 button text font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Standard Code 1, Related Standards 26 button text font-size "15px"; Actual: "${elementTextSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementTextColor === 'rgba(255, 255, 255, 1)') {
|
|
console.log('Passed: Standard Code 1, Related Standards 26 button text color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Standard Code 1, Related Standards 26 button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`);
|
|
}
|
|
|
|
//button color
|
|
if (elementButtonColor === 'rgba(40, 39, 90, 1)') {
|
|
console.log('Passed: Standard Code 1, Related Standards 26 button background color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Standard Code 1, Related Standards 26 button background color: "rgba(40, 39, 90, 1)"; Actual: "${elementButtonColor}"`);
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Standard Code 1 Add Direct Alignment button
|
|
{
|
|
description: 'Validate Standard Code 1, Add Direct Alignment button text, size, and color',
|
|
action: async () => {
|
|
const multipleChecks = 'Standard Code 1, Add Direct Alignment button';
|
|
const elementIcon = await driver.findElement(By.css('#add-1439152630-tab > .fa'));
|
|
const element = await driver.findElement(By.css('#add-1439152630-tab'));
|
|
|
|
//Get text, font, size, and color
|
|
const elementText = await element.getText();
|
|
const elementTextFont = await element.getCssValue('font-family');
|
|
const elementTextSize = await element.getCssValue('font-size');
|
|
const elementTextColor = await element.getCssValue('color');
|
|
const elementButtonColor = await element.getCssValue('background-color');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//icon
|
|
if (elementIcon) {
|
|
console.log('Passed: Standard Code 1, Add Direct Alignment button icon found')
|
|
} else {
|
|
errors.push('FAILED: Standard Code 1, Add Direct Alignment button icon not found')
|
|
}
|
|
|
|
//text
|
|
if (elementText === 'Add Direct Alignment') {
|
|
console.log('Passed: Standard Code 1, Add Direct Alignment button text matched as expected');
|
|
} else {
|
|
errors.push(`Expected: "Add Direct Alignment"; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//font
|
|
if (elementTextFont === 'Poppins, sans-serif') {
|
|
console.log('Passed: Standard Code 1, Add Direct Alignment button text font-family matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Standard Code 1, Add Direct Alignment button text font-family "Poppins, sans-serif"; Actual: ${elementTextFont}`);
|
|
}
|
|
|
|
//size
|
|
if (elementTextSize === '15px') {
|
|
console.log('Passed: Standard Code 1, Add Direct Alignment button text font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Standard Code 1, Add Direct Alignment button text font-size "15px"; Actual: "${elementTextSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementTextColor === 'rgba(182, 186, 181, 1)') {
|
|
console.log('Passed: Standard Code 1, Add Direct Alignment button text color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Standard Code 1, Add Direct Alignment button text color: "rgba(182, 186, 181, 1)"; Actual: "${elementTextColor}"`);
|
|
}
|
|
|
|
//button color
|
|
if (elementButtonColor === 'rgba(0, 0, 0, 0)') {
|
|
console.log('Passed: Standard Code 1, Add Direct Alignment button background color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Standard Code 1, Add Direct Alignment button background color: "rgba(0, 0, 0, 0)"; Actual: "${elementButtonColor}"`);
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Standard Code 1 Related Standards checkbox and label
|
|
{
|
|
description: 'Validate Standard Code 1, Related Standards checkbox and label',
|
|
action: async () => {
|
|
const multipleChecks = 'Standard Code 1, Related Standards checkbox and label';
|
|
const elementCheckbox = await driver.findElement(By.css('#selectToggle1439152630')).getAttribute('checked');
|
|
const elementLabel = await driver.findElement(By.css('#rel-std-1439152630 > .ml-2'));
|
|
|
|
//Get text, font, size, and color
|
|
const elementText = await elementLabel.getText();
|
|
const elementTextFont = await elementLabel.getCssValue('font-family');
|
|
const elementTextSize = await elementLabel.getCssValue('font-size');
|
|
const elementTextColor = await elementLabel.getCssValue('color');
|
|
const elementButtonColor = await elementLabel.getCssValue('background-color');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//Validate checkbox is checked or unchecked
|
|
if (elementCheckbox) {
|
|
console.log('Passed: Standard Code 1, Select All/None checkbox is selected as expected');
|
|
} else {
|
|
errors.push(`Expected: Standard Code 1, Select All/None checkbox to be selected; Actual: checked="${elementCheckbox}"`);
|
|
}
|
|
|
|
//text
|
|
if (elementText === 'Select All/None') {
|
|
console.log('Passed: Standard Code 1, Select All/None label text matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Standard Code 1, "Select All/None"; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//font
|
|
if (elementTextFont === 'Poppins, sans-serif') {
|
|
console.log('Passed: Standard Code 1, Select All/None label text font-family matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Standard Code 1, "Select All/None" label text font-family "Poppins, sans-serif"; Actual: ${elementTextFont}`);
|
|
}
|
|
|
|
//size
|
|
if (elementTextSize === '13px') {
|
|
console.log('Passed: Standard Code 1, Select All/None label text font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Standard Code 1, "Select All/None" label text font-size "13px"; Actual: "${elementTextSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementTextColor === 'rgba(40, 39, 90, 1)') {
|
|
console.log('Passed: Standard Code 1, Select All/None label text color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Standard Code 1, "Select All/None" label text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`);
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Expand All button
|
|
{
|
|
description: 'Validate Expand All button text, size, and color',
|
|
action: async () => {
|
|
const multipleChecks = 'Expand All button';
|
|
const element = await driver.findElement(By.css('#rel-std-1439152630 > .btn:nth-child(3)'));
|
|
|
|
//Get text, font, size, and color
|
|
const elementText = await element.getText();
|
|
const elementTextFont = await element.getCssValue('font-family');
|
|
const elementTextSize = await element.getCssValue('font-size');
|
|
const elementTextColor = await element.getCssValue('color');
|
|
const elementButtonColor = await element.getCssValue('background-color');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//text
|
|
if (elementText === 'Expand All') {
|
|
console.log('Passed: Expand All button text matched as expected');
|
|
} else {
|
|
errors.push(`Expected: "Expand All"; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//font
|
|
if (elementTextFont === 'Poppins, sans-serif') {
|
|
console.log('Passed: Expand All button text font-family matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Expand All button text font-family "Poppins, sans-serif"; Actual: ${elementTextFont}`);
|
|
}
|
|
|
|
//size
|
|
if (elementTextSize === '14px') {
|
|
console.log('Passed: Expand All button text font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Expand All button text font-size "14px"; Actual: "${elementTextSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementTextColor === 'rgba(255, 255, 255, 1)') {
|
|
console.log('Passed: Expand All button text color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Expand All button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`);
|
|
}
|
|
|
|
//button color
|
|
if (elementButtonColor === 'rgba(48, 200, 172, 1)') {
|
|
console.log('Passed: Expand All button background color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Expand All button background color: "rgba(48, 200, 172, 1)"; Actual: "${elementButtonColor}"`);
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Collapse All button
|
|
{
|
|
description: 'Validate Collapse All button text, size, and color',
|
|
action: async () => {
|
|
const multipleChecks = 'Collapse All button';
|
|
const element = await driver.findElement(By.css('#rel-std-1439152630 > .btn:nth-child(4)'));
|
|
|
|
//Get text, font, size, and color
|
|
const elementText = await element.getText();
|
|
const elementTextFont = await element.getCssValue('font-family');
|
|
const elementTextSize = await element.getCssValue('font-size');
|
|
const elementTextColor = await element.getCssValue('color');
|
|
const elementButtonColor = await element.getCssValue('background-color');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//text
|
|
if (elementText === 'Collapse All') {
|
|
console.log('Passed: Collapse All button text matched as expected');
|
|
} else {
|
|
errors.push(`Expected: "Collapse All"; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//font
|
|
if (elementTextFont === 'Poppins, sans-serif') {
|
|
console.log('Passed: Collapse All button text font-family matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Collapse All button text font-family "Poppins, sans-serif"; Actual: ${elementTextFont}`);
|
|
}
|
|
|
|
//size
|
|
if (elementTextSize === '14px') {
|
|
console.log('Passed: Collapse All button text font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Collapse All button text font-size "14px"; Actual: "${elementTextSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementTextColor === 'rgba(255, 255, 255, 1)') {
|
|
console.log('Passed: Collapse All button text color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Collapse All button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`);
|
|
}
|
|
|
|
//button color
|
|
if (elementButtonColor === 'rgba(48, 200, 172, 1)') {
|
|
console.log('Passed: Collapse All button background color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Collapse All button background color: "rgba(48, 200, 172, 1)"; Actual: "${elementButtonColor}"`);
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Related Standards 1 accordion button
|
|
{
|
|
description: 'Validate Related Standards 1 accordion button text, size, and color',
|
|
action: async () => {
|
|
const multipleChecks = 'Related Standards 1 accordion button';
|
|
const element = await driver.findElement(By.css('#headingCommon-Core-State-Standards1439152630 > .btn'));
|
|
|
|
//Get text, font, size, and color
|
|
const elementText = await element.getText();
|
|
const elementTextFont = await element.getCssValue('font-family');
|
|
const elementTextSize = await element.getCssValue('font-size');
|
|
const elementTextColor = await element.getCssValue('color');
|
|
const elementButtonColor = await element.getCssValue('background-color');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//text
|
|
if (elementText === 'Common Core State Standards (13 of 13 selected)') {
|
|
console.log('Passed: Related Standards 1 accordion button text matched as expected');
|
|
} else {
|
|
errors.push(`Expected: "Common Core State Standards (13 of 13 selected)"; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//font
|
|
if (elementTextFont === 'Poppins, sans-serif') {
|
|
console.log('Passed: Related Standards 1 accordion button text font-family matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Related Standards 1 accordion button text font-family "Poppins, sans-serif"; Actual: ${elementTextFont}`);
|
|
}
|
|
|
|
//size
|
|
if (elementTextSize === '16px') {
|
|
console.log('Passed: Related Standards 1 accordion button text font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Related Standards 1 accordion button text font-size "16px"; Actual: "${elementTextSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementTextColor === 'rgba(255, 255, 255, 1)') {
|
|
console.log('Passed: Related Standards 1 accordion button text color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Related Standards 1 accordion button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`);
|
|
}
|
|
|
|
//button color
|
|
if (elementButtonColor === 'rgba(0, 0, 0, 0)') {
|
|
console.log('Passed: Related Standards 1 accordion button background color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Related Standards 1 accordion button background color: "rgba(0, 0, 0, 0)"; Actual: "${elementButtonColor}"`);
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Related Standards 2 accordion button
|
|
{
|
|
description: 'Validate Related Standards 2 accordion button text, size, and color',
|
|
action: async () => {
|
|
const multipleChecks = 'Related Standards 2 accordion button';
|
|
const element = await driver.findElement(By.css('#headingWashington-State-K-12-Learning-Standards-and-Guidelines1439152630 > .btn'));
|
|
|
|
//Get text, font, size, and color
|
|
const elementText = await element.getText();
|
|
const elementTextFont = await element.getCssValue('font-family');
|
|
const elementTextSize = await element.getCssValue('font-size');
|
|
const elementTextColor = await element.getCssValue('color');
|
|
const elementButtonColor = await element.getCssValue('background-color');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//text
|
|
if (elementText === 'Washington State K-12 Learning Standards and Guidelines (13 of 13 selected)') {
|
|
console.log('Passed: Related Standards 2 accordion button text matched as expected');
|
|
} else {
|
|
errors.push(`Expected: "Washington State K-12 Learning Standards and Guidelines (13 of 13 selected)"; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//font
|
|
if (elementTextFont === 'Poppins, sans-serif') {
|
|
console.log('Passed: Related Standards 2 accordion button text font-family matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Related Standards 2 accordion button text font-family "Poppins, sans-serif"; Actual: ${elementTextFont}`);
|
|
}
|
|
|
|
//size
|
|
if (elementTextSize === '16px') {
|
|
console.log('Passed: Related Standards 2 accordion button text font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Related Standards 2 accordion button text font-size "16px"; Actual: "${elementTextSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementTextColor === 'rgba(255, 255, 255, 1)') {
|
|
console.log('Passed: Related Standards 2 accordion button text color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Related Standards 2 accordion button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`);
|
|
}
|
|
|
|
//button color
|
|
if (elementButtonColor === 'rgba(0, 0, 0, 0)') {
|
|
console.log('Passed: Related Standards 2 accordion button background color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Related Standards 2 accordion button background color: "rgba(0, 0, 0, 0)"; Actual: "${elementButtonColor}"`);
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//NEXT ACTION
|
|
{
|
|
description: 'Click to expand Related Standards 2 Washington State K-12 Learning Standards and Guidelines accordion',
|
|
action: async () => {
|
|
//Standard Code 1 Aligned Content
|
|
await driver.findElement(By.css('#headingWashington-State-K-12-Learning-Standards-and-Guidelines1439152630 > .btn')).click();
|
|
console.log('----->| NEXT ACTION: Clicked Washington State K-12 Learning Standards and Guidelines accordion to expand');
|
|
|
|
//Wait until the element exists in the DOM
|
|
const gradeKTitle = await driver.wait(
|
|
until.elementLocated(By.css('#collapseWashington-State-K-12-Learning-Standards-and-Guidelines1439152630 .list-group-item:nth-child(1) > b')),
|
|
30000
|
|
);
|
|
|
|
//Wait until it becomes visible
|
|
await driver.wait(
|
|
until.elementIsVisible(gradeKTitle),
|
|
30000
|
|
);
|
|
}
|
|
},
|
|
|
|
//Related Standard Code 2, Grade k
|
|
{
|
|
description: 'Validate Related Standard Code 2, Grade K',
|
|
action: async () => {
|
|
const multipleChecks = 'Related Standard Code 2, Grade K';
|
|
const element = await driver.findElement(By.css('#collapseWashington-State-K-12-Learning-Standards-and-Guidelines1439152630 .list-group-item:nth-child(1) > b'));
|
|
const elementCheckbox = await driver.findElement(By.css('#chk1439152630677984548')).getAttribute('checked');
|
|
const elementLabel = await driver.findElement(By.css('#collapseWashington-State-K-12-Learning-Standards-and-Guidelines1439152630 > #rellist1439152630 > .list-group-item:nth-child(2) .form-check-label'));
|
|
|
|
//Get text, font, size, and color
|
|
const elementTitleText = await element.getText();
|
|
const elementTitleFont = await element.getCssValue('font-family');
|
|
const elementTitleSize = await element.getCssValue('font-size');
|
|
const elementTitleColor = await element.getCssValue('color');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//text
|
|
if (elementTitleText === 'Grade K') {
|
|
console.log("Passed: Related Standard Code 2, Grade K title text matched as expected");
|
|
} else {
|
|
errors.push(`Expected: "Grade K" Related Standard Code 2, Grade K title text; Actual: "${elementTitleText}"`);
|
|
}
|
|
|
|
//font
|
|
if (elementTitleFont === 'Poppins, sans-serif') {
|
|
console.log('Passed: Related Standard Code 2, Grade K title text font-family matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Related Standard Code 2, Grade K title text font-family "Poppins, sans-serif"; Actual: ${elementTitleFont}`);
|
|
}
|
|
|
|
//size
|
|
if (elementTitleSize === '14.3px') {
|
|
console.log('Passed: Related Standard Code 2, Grade K title text font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Related Standard Code 2, Grade K title text font-size "14.3px"; Actual: "${elementTitleSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementTitleColor === 'rgba(40, 39, 90, 1)') {
|
|
console.log('Passed: Related Standard Code 2, Grade K title text color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Related Standard Code 2, Grade K title text color "rgba(40, 39, 90, 1)"; Actual: "${elementTitleColor}"`);
|
|
}
|
|
|
|
//Get text, font, size, and color
|
|
const elementLabelText = await elementLabel.getText();
|
|
const elementLabelTextFont = await elementLabel.getCssValue('font-family');
|
|
const elementLabelTextSize = await elementLabel.getCssValue('font-size');
|
|
const elementLabelTextColor = await elementLabel.getCssValue('color');
|
|
const elementLabelButtonColor = await elementLabel.getCssValue('background-color');
|
|
|
|
//Validate checkbox is checked or unchecked
|
|
if (elementCheckbox) {
|
|
console.log('Passed: Related Standard Grade K, checkbox is selected as expected');
|
|
} else {
|
|
errors.push(`Expected: Related Standard Grade K, checkbox to be selected; Actual: checked="${elementCheckbox}"`);
|
|
}
|
|
|
|
//text
|
|
if (elementLabelText === 'MP.1. Make sense of problems and persevere in solving them.') {
|
|
console.log('Passed: Related Standard Grade K, description label text matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Related Standard Grade K, "MP.1. Make sense of problems and persevere in solving them."; Actual: "${elementLabelText}"`);
|
|
}
|
|
|
|
//font
|
|
if (elementLabelTextFont === 'Poppins, sans-serif') {
|
|
console.log('Passed: Related Standard Grade K, description label text font-family matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Related Standard Grade K, description label text font-family "Poppins, sans-serif"; Actual: ${elementLabelTextFont}`);
|
|
}
|
|
|
|
//size
|
|
if (elementLabelTextSize === '14.3px') {
|
|
console.log('Passed: Related Standard Grade K, description label text font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Related Standard Grade K, description label text font-size "14.3px"; Actual: "${elementLabelTextSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementLabelTextColor === 'rgba(40, 39, 90, 1)') {
|
|
console.log('Passed: Related Standard Grade K, description label text color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Related Standard Grade K, description label text color: "rgba(40, 39, 90, 1)"; Actual: "${elementLabelTextColor}"`);
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Related Standard Code 2, Grade 1
|
|
{
|
|
description: 'Validate Related Standard Code 2, Grade 1',
|
|
action: async () => {
|
|
const multipleChecks = 'Related Standard Code 2, Grade 1';
|
|
const element = await driver.findElement(By.css('#collapseWashington-State-K-12-Learning-Standards-and-Guidelines1439152630 .list-group-item:nth-child(3) > b'));
|
|
const elementCheckbox = await driver.findElement(By.css('#chk1439152630677984596')).getAttribute('checked');
|
|
const elementLabel = await driver.findElement(By.css('#collapseWashington-State-K-12-Learning-Standards-and-Guidelines1439152630 > #rellist1439152630 > .list-group-item:nth-child(4) .form-check-label'));
|
|
|
|
//Get text, font, size, and color
|
|
const elementTitleText = await element.getText();
|
|
const elementTitleFont = await element.getCssValue('font-family');
|
|
const elementTitleSize = await element.getCssValue('font-size');
|
|
const elementTitleColor = await element.getCssValue('color');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//text
|
|
if (elementTitleText === 'Grade 1') {
|
|
console.log("Passed: Related Standard Code 2, Grade 1 title text matched as expected");
|
|
} else {
|
|
errors.push(`Expected: "Grade 1" Related Standard Code 2, Grade 1 title text; Actual: "${elementTitleText}"`);
|
|
}
|
|
|
|
//font
|
|
if (elementTitleFont === 'Poppins, sans-serif') {
|
|
console.log('Passed: Related Standard Code 2, Grade 1 title text font-family matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Related Standard Code 2, Grade 1 title text font-family "Poppins, sans-serif"; Actual: ${elementTitleFont}`);
|
|
}
|
|
|
|
//size
|
|
if (elementTitleSize === '14.3px') {
|
|
console.log('Passed: Related Standard Code 2, Grade 1 title text font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Related Standard Code 2, Grade 1 title text font-size "14.3px"; Actual: "${elementTitleSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementTitleColor === 'rgba(40, 39, 90, 1)') {
|
|
console.log('Passed: Related Standard Code 2, Grade 1 title text color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Related Standard Code 2, Grade 1 title text color "rgba(40, 39, 90, 1)"; Actual: "${elementTitleColor}"`);
|
|
}
|
|
|
|
//Get text, font, size, and color
|
|
const elementLabelText = await elementLabel.getText();
|
|
const elementLabelTextFont = await elementLabel.getCssValue('font-family');
|
|
const elementLabelTextSize = await elementLabel.getCssValue('font-size');
|
|
const elementLabelTextColor = await elementLabel.getCssValue('color');
|
|
const elementLabelButtonColor = await elementLabel.getCssValue('background-color');
|
|
|
|
//Validate checkbox is checked or unchecked
|
|
if (elementCheckbox) {
|
|
console.log('Passed: Related Standard Grade 1, checkbox is selected as expected');
|
|
} else {
|
|
errors.push(`Expected: Related Standard Grade 1, checkbox to be selected; Actual: checked="${elementCheckbox}"`);
|
|
}
|
|
|
|
//text
|
|
if (elementLabelText === 'MP.1. Make sense of problems and persevere in solving them.') {
|
|
console.log('Passed: Related Standard Grade 1, description label text matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Related Standard Grade 1, "MP.1. Make sense of problems and persevere in solving them."; Actual: "${elementLabelText}"`);
|
|
}
|
|
|
|
//font
|
|
if (elementLabelTextFont === 'Poppins, sans-serif') {
|
|
console.log('Passed: Related Standard Grade 1, description label text font-family matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Related Standard Grade 1, description label text font-family "Poppins, sans-serif"; Actual: ${elementLabelTextFont}`);
|
|
}
|
|
|
|
//size
|
|
if (elementLabelTextSize === '14.3px') {
|
|
console.log('Passed: Related Standard Grade 1, description label text font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Related Standard Grade 1, description label text font-size "14.3px"; Actual: "${elementLabelTextSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementLabelTextColor === 'rgba(40, 39, 90, 1)') {
|
|
console.log('Passed: Related Standard Grade 1, description label text color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Related Standard Grade 1, description label text color: "rgba(40, 39, 90, 1)"; Actual: "${elementLabelTextColor}"`);
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
];
|
|
|
|
//STAND ALONE
|
|
const myStandardsSearchRelatedStandards = (req, res) => {
|
|
res.send('<h2>ExACT Automated Test Script: My Standards Search - Related Standards (myStandardsSearchRelatedStandards) | 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(34) input')).click();
|
|
await driver.sleep(2000);
|
|
console.log('----->| NEXT ACTION: Selected Include Related Standards: Washington, Common Core State Standards, California Mathematics 1997');
|
|
//Click away to close dropdown using executeScript to bypass interception
|
|
await driver.executeScript(`
|
|
document.querySelector('.col-auto .multiselect-selected-text').click();
|
|
`);
|
|
await driver.sleep(2000);
|
|
|
|
//Click Search button
|
|
await driver.findElement(By.css('#stdsubmit')).click();
|
|
console.log('----->| NEXT ACTION: Clicked Search button');
|
|
|
|
//Wait for page to load completely
|
|
await driver.wait(async () => {
|
|
const readyState = await driver.executeScript('return document.readyState');
|
|
return readyState === 'complete';
|
|
}, 30000, 'Standards search page did not fully load within 30 seconds');
|
|
|
|
//Wait until the modal title is located AND visible
|
|
await driver.wait(async () => {
|
|
try {
|
|
const element = await driver.findElement(By.css('.breadcrumb-item:nth-child(2)'));
|
|
return await element.isDisplayed();
|
|
} catch (e) {
|
|
return false; //Element not ready yet, keep waiting
|
|
}
|
|
}, 20000, 'Standards search page did not become visible within 20 seconds');
|
|
|
|
console.log('Passed: Standards search page loaded successfully');
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Then spread all your existing steps
|
|
...myStandardsSearch_RelatedStandards(driver)
|
|
|
|
];
|
|
|
|
const logStep = (worksheet, stepDescription, status, stepIndex, timestamp, screenshotPath) => {
|
|
const json_data = XLSX.utils.sheet_to_json(worksheet, { header: 1 });
|
|
json_data.push([stepIndex, stepDescription, status, timestamp, screenshotPath]);
|
|
return XLSX.utils.aoa_to_sheet(json_data);
|
|
};
|
|
|
|
const takeScreenshot = async (driver, stepIndex, stepDescription) => {
|
|
const screenshot = await driver.takeScreenshot();
|
|
|
|
const dir = path.join('screenshots', 'myStandardsSearchRelatedStandardsResults');
|
|
|
|
const screenshotFileName = `step_${stepIndex}_${stepDescription.replace(/\s+/g, '_')}.png`;
|
|
const screenshotPath = path.join(dir, screenshotFileName);
|
|
fs.writeFileSync(screenshotPath, screenshot, 'base64');
|
|
return screenshotPath;
|
|
};
|
|
|
|
const resultsFile = path.join('results', 'myStandardsSearchRelatedStandards.xlsx');
|
|
|
|
const clearOldResults = () => {
|
|
//Remove old screenshots
|
|
const screenshotDir = path.join('screenshots', 'myStandardsSearchRelatedStandardsResults');
|
|
if (fs.existsSync(screenshotDir)) {
|
|
fs.rmSync(screenshotDir, { recursive: true, force: true });
|
|
}
|
|
fs.mkdirSync(screenshotDir, { recursive: true });
|
|
|
|
//Remove old Excel file
|
|
if (fs.existsSync(resultsFile)) {
|
|
fs.unlinkSync(resultsFile);
|
|
}
|
|
fs.mkdirSync('results', { recursive: true });
|
|
};
|
|
|
|
try {
|
|
//Initialize workbook and worksheet
|
|
clearOldResults();
|
|
|
|
//Initialize workbook and worksheet
|
|
workbook = XLSX.utils.book_new();
|
|
worksheet = XLSX.utils.aoa_to_sheet([
|
|
['Step Number', 'Step Description', 'Status', 'Timestamp', 'Screenshot']
|
|
]);
|
|
XLSX.utils.book_append_sheet(workbook, worksheet, 'Sheet1');
|
|
|
|
//Log test start time
|
|
worksheet = logStep(worksheet, 'Test Start', 'Started', '', startTime, '');
|
|
|
|
let allStepsPassed = true;
|
|
|
|
const failedSteps = []; //Track failed steps
|
|
|
|
for (const step of steps) {
|
|
const stepIndex = steps.indexOf(step) + 1;
|
|
const timestamp = new Date().toISOString();
|
|
|
|
try {
|
|
await step.action();
|
|
worksheet = logStep(
|
|
worksheet,
|
|
step.description,
|
|
'Passed',
|
|
stepIndex,
|
|
timestamp,
|
|
null
|
|
);
|
|
|
|
} catch (error) {
|
|
const screenshotPath = await takeScreenshot(
|
|
driver,
|
|
stepIndex,
|
|
`${step.description}_Failed`
|
|
);
|
|
|
|
worksheet = logStep(
|
|
worksheet,
|
|
step.description,
|
|
'Failed',
|
|
stepIndex,
|
|
timestamp,
|
|
screenshotPath
|
|
);
|
|
|
|
console.error(`Step ${stepIndex} FAILED: ${error.message}`);
|
|
failedSteps.push(`Step ${stepIndex}: ${step.description} - ${error.message}`); //Track failed step
|
|
testStatus = 'Failed';
|
|
allStepsPassed = false;
|
|
}
|
|
}
|
|
|
|
if (allStepsPassed) {
|
|
console.log('------------->| THE END |<-------------');
|
|
console.log('PASSED: My Standards Search - Related Standards (myStandardsSearchRelatedStandards); All test steps completed successfully');
|
|
testStatus = 'Passed';
|
|
} else {
|
|
console.log('------------->| THE END |<-------------');
|
|
console.log('FAILED: My Standards Search - Related Standards (myStandardsSearchRelatedStandards); One or more test steps failed');
|
|
console.log('FAILED STEPS:');
|
|
failedSteps.forEach(step => console.error(` ✗ ${step}`));
|
|
testStatus = 'Failed';
|
|
}
|
|
|
|
//Log test end time
|
|
const endTime = new Date().toISOString();
|
|
worksheet = logStep(worksheet, 'Test End', testStatus, '', endTime, '');
|
|
|
|
//Write the updated worksheet back to the workbook and save it
|
|
workbook.Sheets['Sheet1'] = worksheet;
|
|
XLSX.writeFile(workbook, resultsFile);
|
|
} finally {
|
|
await driver.quit();
|
|
}
|
|
})();
|
|
};
|
|
|
|
export default myStandardsSearchRelatedStandards;
|