8038 lines
302 KiB
JavaScript
8038 lines
302 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 { myStandardsSearch_AlignedContent } from '../../myStandardsSearchAlignedContent.js';
|
|
|
|
const dashboardMyStandards = (req, res) => {
|
|
res.send('<h2>ExACT Automated Test Script: DASHBOARD - My Standards Widget(dashboardMyStandards) | Initiated</h2>');
|
|
(async function example() {
|
|
let driver = await new Builder()
|
|
.forBrowser('chrome')
|
|
.setChromeOptions(
|
|
new ChromeOptions()
|
|
.addArguments('--disable-features=MediaRouter')
|
|
.addArguments('--disable-extensions')
|
|
.addArguments('--disable-background-networking')
|
|
.addArguments('--log-level=3')
|
|
)
|
|
.build();
|
|
let testStatus = 'Failed';
|
|
let workbook;
|
|
let worksheet;
|
|
const startTime = new Date().toISOString();
|
|
|
|
const steps = [
|
|
{ description: 'Navigate to ExACT Landing Page', action: async () => await driver.navigate().to('https://correlation.edgate.com/exact/login.php') },
|
|
{ description: 'Expand browser', action: async () => await driver.manage().window().maximize() },
|
|
|
|
//Login
|
|
{
|
|
description: 'Login',
|
|
action: async () => {
|
|
const multipleChecks = 'Log In';
|
|
console.log('------------->| MY STANDARDS WIDGET |<-------------');
|
|
const errors = [];
|
|
|
|
await driver.findElement(By.css('.form-control:nth-child(2)')).sendKeys('exact_juan');
|
|
await driver.findElement(By.css('.passfield')).sendKeys('Edgate1!');
|
|
await driver.findElement(By.css('.login')).click();
|
|
console.log('----->| NEXT ACTION: Entered credentials and logged in');
|
|
|
|
//Wait for page readyState
|
|
await driver.wait(async () => {
|
|
const readyState = await driver.executeScript('return document.readyState');
|
|
return readyState === 'complete';
|
|
}, 30000, 'ExACT Dashboard did not fully load within 30 seconds');
|
|
|
|
//Wait for the dashboard container to exist in DOM
|
|
await driver.wait(
|
|
until.elementLocated(By.css('.gap-idle-wrap > img')),
|
|
30000,
|
|
'Dashboard image did not appear within 30 seconds'
|
|
);
|
|
|
|
//Wait for it to be visible
|
|
await driver.wait(async () => {
|
|
try {
|
|
const img = await driver.findElement(By.css('.gap-idle-wrap > img'));
|
|
return await img.isDisplayed();
|
|
} catch (e) {
|
|
return false;
|
|
}
|
|
}, 30000, 'Dashboard image did not become visible within 30 seconds');
|
|
|
|
//Wait for any loading spinners to disappear
|
|
await driver.wait(async () => {
|
|
try {
|
|
const spinners = await driver.findElements(By.css('.spinner-border'));
|
|
for (const spinner of spinners) {
|
|
if (await spinner.isDisplayed()) return false;
|
|
}
|
|
return true;
|
|
} catch (e) {
|
|
return true;
|
|
}
|
|
}, 30000, 'Loading spinners did not disappear within 30 seconds');
|
|
|
|
//Wait for the slowest resource to complete
|
|
await driver.wait(async () => {
|
|
const completed = await driver.executeScript(`
|
|
const entries = performance.getEntriesByType('resource');
|
|
return entries.some(entry =>
|
|
entry.name.includes('content_sets.php') &&
|
|
entry.responseEnd > 0
|
|
);
|
|
`);
|
|
return completed;
|
|
}, 30000, 'My Content widget (content_sets.php) did not complete loading within 30 seconds');
|
|
console.log('Passed: My Content widget (content_sets.php) loaded successfully - Dashboard fully loaded');
|
|
|
|
//Final sleep to allow any remaining dynamic content to settle
|
|
await driver.sleep(2000);
|
|
|
|
console.log('Passed: ExACT Dashboard loaded successfully');
|
|
|
|
if (errors.length > 0) {
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Dashboard title
|
|
{
|
|
description: 'Validate dashboard title text, size, and color',
|
|
action: async () => {
|
|
const multipleChecks = 'Dashboard title';
|
|
const element = await driver.findElement(By.css('.e-heading'));
|
|
|
|
//Get text, font, size, and color
|
|
const elementText = await element.getText();
|
|
const elementFont = await element.getCssValue('font-family');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
const elementColor = await element.getCssValue('color');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//text
|
|
if (elementText === 'Correlation Dashboard') {
|
|
console.log('Passed: Dashboard title text matched as expected');
|
|
} else {
|
|
errors.push(`Expected: "Correlation Dashboard"; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//font
|
|
if (elementFont === `"DM Serif Display", serif`) {
|
|
console.log('Passed: Dashboard title font-family matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard title font-family "DM Serif Display, serif"; Actual: ${elementFont}`);
|
|
}
|
|
|
|
//size
|
|
if (elementSize === '32px') {
|
|
console.log('Passed: Dashboard title text font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard title text font-size "32px"; Actual: "${elementSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementColor === 'rgba(40, 39, 90, 1)') {
|
|
console.log('Passed: Dashboard title text color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard title text color: "rgba(40, 39, 90, 1)"; Actual: "${elementColor}"`);
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//MY STANDARDS WIDGET
|
|
//Dashboard - My Standards Widget title (active)
|
|
{
|
|
description: 'Validate Dashboard Semantic Standards Comparison Widget title text, color, and size',
|
|
action: async () => {
|
|
const multipleChecks = 'My Standards Widget title (active)';
|
|
const element = await driver.findElement(By.css('#mystd-tab'));
|
|
|
|
//Get text, font, size, and color
|
|
const elementText = await element.getText();
|
|
const elementFont = await element.getCssValue('font-family');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
const elementColor = await element.getCssValue('color');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//text
|
|
if (elementText === 'My Standards') {
|
|
console.log('Passed: Dashboard - Semantic Standards Comparison Widget title matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard - "Semantic Standards Comparison"; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//font
|
|
if (elementFont === `Poppins, sans-serif`) {
|
|
console.log('Passed: Dashboard - Semantic Standards Comparison Widget font-family matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard - Semantic Standards Comparison Widget font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
|
|
}
|
|
|
|
//size
|
|
if (elementSize === '15px') {
|
|
console.log('Passed: Dashboard - Semantic Standards Comparison Widget title text font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard - Semantic Standards Comparison Widget title text font-size "15px"; Actual: "${elementSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementColor === 'rgba(40, 39, 90, 1)') {
|
|
console.log('Passed: Dashboard - Semantic Standards Comparison Widget title text color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard - Semantic Standards Comparison Widget title text color "rgba(40, 39, 90, 1)"; Actual: "${elementColor}"`);
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Dashboard - Other Available Stndards tab title
|
|
{
|
|
description: 'Validate Dashboard - Other Available Stndards tab title text, color, and size',
|
|
action: async () => {
|
|
const multipleChecks = 'Other Available Stndards tab title';
|
|
const element = await driver.findElement(By.css('#availstd-tab'));
|
|
|
|
//Get text, font, size, and color
|
|
const elementText = await element.getText();
|
|
const elementFont = await element.getCssValue('font-family');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
const elementColor = await element.getCssValue('color');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//text
|
|
if (elementText === 'Other Available Standards') {
|
|
console.log('Passed: Dashboard - Other Available Standards tab title matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard - "Other Available Standards"; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//font
|
|
if (elementFont === `Poppins, sans-serif`) {
|
|
console.log('Passed: Dashboard - Other Available Standards tab title font-family matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard - Other Available Standards tab title font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
|
|
}
|
|
|
|
//size
|
|
if (elementSize === '15px') {
|
|
console.log('Passed: Dashboard - Other Available Standards tab title text font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard - Other Available Standards tab title text font-size "15px"; Actual: "${elementSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementColor === 'rgba(182, 186, 181, 1)') {
|
|
console.log('Passed: Dashboard - Other Available Standards tab title text color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard - Other Available Standards tab title text color "rgba(182, 186, 181, 1)"'; Actual: "${elementColor}"`);
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Dashboard - My Standards dropdown
|
|
{
|
|
description: 'Validate Dashboard - My Standards dropdown list and value',
|
|
action: async () => {
|
|
const multipleChecks = 'My Standards dropdown list';
|
|
const elementDropdown = await driver.findElement(By.css('#stdparent'));
|
|
const selectedOption = await elementDropdown.findElement(By.css('option:checked'));
|
|
|
|
const elementText = await selectedOption.getText();
|
|
const elementFont = await selectedOption.getCssValue('font-family');
|
|
const elementSize = await selectedOption.getCssValue('font-size');
|
|
const elementColor = await selectedOption.getCssValue('color');
|
|
|
|
const options = await elementDropdown.findElements(By.css('option'));
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//text
|
|
if (elementText === 'United States Standards') {
|
|
console.log('Passed: Dashboard - My Standards dropdown text matched as expected');
|
|
} else {
|
|
throw new Error(`Expected: Dashboard - My Standards: "United States Standards"; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//font
|
|
if (elementFont === "Poppins, sans-serif") {
|
|
console.log('Passed: Dashboard - My Standards dropdown font-family matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard - My Standards dropdown font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
|
|
}
|
|
|
|
//size
|
|
if (elementSize === '13px') {
|
|
console.log('Passed: Dashboard - My Standards dropdown font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard - My Standards dropdown font-size "13px"; Actual: "${elementSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementColor === 'rgba(40, 39, 90, 1)') {
|
|
console.log('Passed: Dashboard - My Standards dropdown color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard - My Standards dropdown color: "rgba(40, 39, 90, 1)"; Actual: "${elementColor}"`);
|
|
}
|
|
|
|
const expected = [
|
|
'ACTFL',
|
|
'Australia',
|
|
'California',
|
|
'Canada',
|
|
'Common Core Standards',
|
|
'Creating Org',
|
|
'Demo Client Standards',
|
|
'Demo Standards',
|
|
'Imports',
|
|
'New Folder',
|
|
'QA Client Test Frameworks',
|
|
'United States Standards',
|
|
'WIDA'
|
|
];
|
|
|
|
const actual = [];
|
|
|
|
for (const opt of options) {
|
|
const text = (await opt.getText()).trim();
|
|
actual.push(text);
|
|
}
|
|
|
|
if (JSON.stringify(actual) === JSON.stringify(expected)) {
|
|
console.log('Passed: Dashboard - My Standards Dropdown list matched as expected');
|
|
} else {
|
|
throw new Error(`Expected: Dashboard - My Standards Dropdown list: ${JSON.stringify(expected)}, Actual: ${JSON.stringify(actual)}`);
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Dashboard - My Standards Organization column title
|
|
{
|
|
description: 'Validate Dashboard - My Standards Organization column title, text, and font size',
|
|
action: async () => {
|
|
const multipleChecks = 'My Standards Organization column title'
|
|
const element = await driver.findElement(By.css('.table:nth-child(2) th:nth-child(1)'));
|
|
|
|
//Get text, font, size, and color
|
|
const elementText = await element.getText();
|
|
const elementFont = await element.getCssValue('font-family');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
const elementColor = await element.getCssValue('color');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//text
|
|
if (elementText === 'Organization') {
|
|
console.log('Passed: Dashboard - My Standards Organization column title matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard - My Standards "Organization" column title; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//font
|
|
if (elementFont === "Poppins, sans-serif") {
|
|
console.log('Passed: Dashboard - My Standards Organization column title font-family matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard - My Standards Organization column title font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
|
|
}
|
|
|
|
//size
|
|
if (elementSize === '14px') {
|
|
console.log('Passed: Dashboard - My Standards Organization column title text font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard - My Standards Organization column title text font-size "14px"; Actual: "${elementSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementColor === 'rgba(94, 105, 116, 1)') {
|
|
console.log('Passed: Dashboard - My Standards Organization column title text color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard - My Standards Organization column title text color "rgba(94, 105, 116, 1)"'; Actual: "${elementColor}"`);
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Dashboard - My Standards Export column title
|
|
{
|
|
description: 'Validate Dashboard - My Standards Export column title, text, and font size',
|
|
action: async () => {
|
|
const multipleChecks = 'My Standards Export column title';
|
|
const element = await driver.findElement(By.css('.table:nth-child(2) > thead .text-center:nth-child(2)'));
|
|
|
|
//Get text, font, size, and color
|
|
const elementText = await element.getText();
|
|
const elementFont = await element.getCssValue('font-family');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
const elementColor = await element.getCssValue('color');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//text
|
|
if (elementText === 'Export') {
|
|
console.log('Passed: Dashboard - My Standards Export column title matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard - My Standards "Export" column title; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//font
|
|
if (elementFont === "Poppins, sans-serif") {
|
|
console.log('Passed: Dashboard - My Standards Export column title font-family matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard - My Standards Export column title font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
|
|
}
|
|
|
|
//size
|
|
if (elementSize === '14px') {
|
|
console.log('Passed: Dashboard - My Standards Export column title text font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard - My Standards Export column title text font-size "14px"; Actual: "${elementSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementColor === 'rgba(94, 105, 116, 1)') {
|
|
console.log('Passed: Dashboard - My Standards Export column title text color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard - My Standards Export column title text color "rgba(94, 105, 116, 1)"'; Actual: "${elementColor}"`);
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Dashboard - My Standards Manage column title
|
|
{
|
|
description: 'Validate Dashboard - My Standards Manage column title, text, and font size',
|
|
action: async () => {
|
|
const multipleChecks = 'My Standards Manage column title';
|
|
const element = await driver.findElement(By.css('.text-center:nth-child(3)'));
|
|
|
|
//Get text, font, size, and color
|
|
const elementText = await element.getText();
|
|
const elementFont = await element.getCssValue('font-family');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
const elementColor = await element.getCssValue('color');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//text
|
|
if (elementText === 'Manage') {
|
|
console.log('Passed: Dashboard - My Standards Manage column title matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard - My Standards "Manage" column title; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//font
|
|
if (elementFont === "Poppins, sans-serif") {
|
|
console.log('Passed: Dashboard - My Standards Manage column title font-family matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard - My Standards Manage column title font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
|
|
}
|
|
|
|
//size
|
|
if (elementSize === '14px') {
|
|
console.log('Passed: Dashboard - My Standards Manage column title text font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard - My Standards Manage column title text font-size "14px"; Actual: "${elementSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementColor === 'rgba(94, 105, 116, 1)') {
|
|
console.log('Passed: Dashboard - My Standards Manage column title text color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard - My Standards Manage column title text color "rgba(94, 105, 116, 1)"'; Actual: "${elementColor}"`);
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Dashboard - My Standards More Info column title
|
|
{
|
|
description: 'Validate Dashboard - My Standards More Info column title, text, and font size',
|
|
action: async () => {
|
|
const multipleChecks = 'My Standards More Info column title';
|
|
const element = await driver.findElement(By.css('.table-sm > thead .text-center:nth-child(4)'));
|
|
|
|
//Get text, font, size, and color
|
|
const elementText = await element.getText();
|
|
const elementFont = await element.getCssValue('font-family');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
const elementColor = await element.getCssValue('color');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//text
|
|
if (elementText === 'More Info') {
|
|
console.log('Passed: Dashboard - My Standards More Info column title matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard - My Standards "More Info" column title; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//font
|
|
if (elementFont === "Poppins, sans-serif") {
|
|
console.log('Passed: Dashboard - My Standards More Info column title font-family matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard - My Standards More Info column title font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
|
|
}
|
|
|
|
//size
|
|
if (elementSize === '14px') {
|
|
console.log('Passed: Dashboard - My Standards More Info column title text font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard - My Standards More Info column title text font-size "14px"; Actual: "${elementSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementColor === 'rgba(94, 105, 116, 1)') {
|
|
console.log('Passed: Dashboard - My Standards More Info column title text color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard - My Standards More Info column title text color "rgba(94, 105, 116, 1)"'; Actual: "${elementColor}"`);
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Dashboard - My Standards View column title
|
|
{
|
|
description: 'Validate Dashboard - My Standards View column title, text, and font size',
|
|
action: async () => {
|
|
const multipleChecks = 'My Standards View column title';
|
|
const element = await driver.findElement(By.css('thead .text-center:nth-child(5)'));
|
|
|
|
//Get text, font, size, and color
|
|
const elementText = await element.getText();
|
|
const elementFont = await element.getCssValue('font-family');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
const elementColor = await element.getCssValue('color');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//text
|
|
if (elementText === 'View') {
|
|
console.log('Passed: Dashboard - My Standards View column title matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard - My Standards "View" column title; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//font
|
|
if (elementFont === "Poppins, sans-serif") {
|
|
console.log('Passed: Dashboard - My Standards View column title font-family matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard - My Standards View column title font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
|
|
}
|
|
|
|
//size
|
|
if (elementSize === '14px') {
|
|
console.log('Passed: Dashboard - My Standards View column title text font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard - My Standards View column title text font-size "14px"; Actual: "${elementSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementColor === 'rgba(94, 105, 116, 1)') {
|
|
console.log('Passed: Dashboard - My Standards View column title text color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard - My Standards View column title text color "rgba(94, 105, 116, 1)"'; Actual: "${elementColor}"`);
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Dashboard - My Standards = Alabama
|
|
{
|
|
description: 'Validate Dashboard - My Standards Organization = Alabama Standards text',
|
|
action: async () => {
|
|
const multipleChecks = 'My Standards Organization - Alabama';
|
|
const element = await driver.findElement(By.css('#stdbody > tr:nth-child(1) > td:nth-child(1)'));
|
|
|
|
//Get text, font, color, and size
|
|
const elementText = await element.getText('');
|
|
const elementFont = await element.getCssValue('font-family');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
const elementColor = await element.getCssValue('color');
|
|
|
|
const elementExportIcon = await driver.findElement(By.css('#stdbody > tr:nth-child(1) > .text-center:nth-child(2) img'));
|
|
const elementMoreInfoIconTooltip = await driver.findElement(By.css('#stdbody > tr:nth-child(1) > td:nth-child(4) > a')).getAttribute('title');
|
|
const elementViewIcon = await driver.findElement(By.css('tr:nth-child(1) > .text-center:nth-child(5) img'));
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//text
|
|
if (elementText === 'Alabama') {
|
|
console.log("Passed: Dashboard - My Standards Alabama text matched as expected");
|
|
} else {
|
|
throw new Error(`Expected: Dashboard - My Standards text: "Alabama"; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//font
|
|
if (elementFont === "Poppins, sans-serif") {
|
|
console.log('Passed: Dashboard - My Standards Alabama text font-family matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard - My Standards Alabama text font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
|
|
}
|
|
|
|
//size
|
|
if (elementSize === '14.3px') {
|
|
console.log('Passed: Dashboard - My Standards Alabama text font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard - My Standards Alabama text font-size "14.3px"; Actual: "${elementSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementColor === 'rgba(33, 37, 41, 1)') {
|
|
console.log('Passed: Dashboard - My Standards Alabama text color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard - My Standards Alabama text color: "rgba(33, 37, 41, 1)"; Actual: "${elementColor}"`);
|
|
}
|
|
|
|
//export icon
|
|
if (elementExportIcon) {
|
|
console.log('Passed: Dashboard - My Standards Alabama - Export icon is present');
|
|
} else {
|
|
errors.push('Expected: Dashboard - My Standards Alabama - Export icon not found');
|
|
}
|
|
|
|
//more info icon tool-tip
|
|
if (elementMoreInfoIconTooltip === 'View Detail Information') {
|
|
console.log('Passed: Dashboard - My Standards Alabama icon tool-tip text matched as expected');
|
|
} else {
|
|
errors.push(`Expected: ashboard - My Standards Alabama: "View Detail Information"; Actual: "${elementMoreInfoIconTooltip}"`);
|
|
}
|
|
|
|
//view icon
|
|
if (elementViewIcon) {
|
|
console.log('Passed: Dashboard - My Standards Alabama - View icon is present');
|
|
} else {
|
|
errors.push('Expected: Dashboard - My Standards Alabama - View icon not found');
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Dashboard - My Standards = Arizona
|
|
{
|
|
description: 'Validate Dashboard - My Standards Organization = Arizona Standards text',
|
|
action: async () => {
|
|
const multipleChecks = 'My Standards Organization - Arizona';
|
|
const element = await driver.findElement(By.css('#stdbody > tr:nth-child(2) > td:nth-child(1)'));
|
|
|
|
//Get text, font, color, and size
|
|
const elementText = await element.getText('');
|
|
const elementFont = await element.getCssValue('font-family');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
const elementColor = await element.getCssValue('color');
|
|
|
|
const elementExportIcon = await driver.findElement(By.css('#stdbody > tr:nth-child(2) > .text-center:nth-child(2) img'));
|
|
const elementMoreInfoIconTooltip = await driver.findElement(By.css('#stdbody > tr:nth-child(2) > td:nth-child(4) > a')).getAttribute('title');
|
|
const elementViewIcon = await driver.findElement(By.css('tr:nth-child(2) > .text-center:nth-child(5) img'));
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//text
|
|
if (elementText === 'Arizona') {
|
|
console.log("Passed: Dashboard - My Standards Arizona text matched as expected");
|
|
} else {
|
|
throw new Error(`Expected: Dashboard - My Standards text: "Arizona"; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//font
|
|
if (elementFont === "Poppins, sans-serif") {
|
|
console.log('Passed: Dashboard - My Standards Arizona text font-family matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard - My Standards Arizona text font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
|
|
}
|
|
|
|
//size
|
|
if (elementSize === '14.3px') {
|
|
console.log('Passed: Dashboard - My Standards Arizona text font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard - My Standards Arizona text font-size "14.3px"; Actual: "${elementSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementColor === 'rgba(33, 37, 41, 1)') {
|
|
console.log('Passed: Dashboard - My Standards Arizona text color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard - My Standards Arizona text color: "rgba(33, 37, 41, 1)"; Actual: "${elementColor}"`);
|
|
}
|
|
|
|
//export icon
|
|
if (elementExportIcon) {
|
|
console.log('Passed: Dashboard - My Standards Arizona - Export icon is present');
|
|
} else {
|
|
errors.push('Expected: Dashboard - My Standards Arizona - Export icon not found');
|
|
}
|
|
|
|
//more info icon tool-tip
|
|
if (elementMoreInfoIconTooltip === 'View Detail Information') {
|
|
console.log('Passed: Dashboard - My Standards Arizona icon tool-tip text matched as expected');
|
|
} else {
|
|
errors.push(`Expected: ashboard - My Standards Arizona: "View Detail Information"; Actual: "${elementMoreInfoIconTooltip}"`);
|
|
}
|
|
|
|
//view icon
|
|
if (elementViewIcon) {
|
|
console.log('Passed: Dashboard - My Standards Arizona - View icon is present');
|
|
} else {
|
|
errors.push('Expected: Dashboard - My Standards Arizona - View icon not found');
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Dashboard - My Standards = California
|
|
{
|
|
description: 'Validate Dashboard - My Standards Organization = California Standards text',
|
|
action: async () => {
|
|
const multipleChecks = 'My Standards Organization - California';
|
|
const element = await driver.findElement(By.css('#stdbody > tr:nth-child(3) > td:nth-child(1)'));
|
|
|
|
//Get text, font, color, and size
|
|
const elementText = await element.getText('');
|
|
const elementFont = await element.getCssValue('font-family');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
const elementColor = await element.getCssValue('color');
|
|
|
|
const elementExportIcon = await driver.findElement(By.css('#stdbody > tr:nth-child(3) > .text-center:nth-child(2) img'));
|
|
const elementMoreInfoIconTooltip = await driver.findElement(By.css('#stdbody > tr:nth-child(3) > td:nth-child(4) > a')).getAttribute('title');
|
|
const elementViewIcon = await driver.findElement(By.css('tr:nth-child(3) > .text-center:nth-child(5) img'));
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//text
|
|
if (elementText === 'California') {
|
|
console.log("Passed: Dashboard - My Standards California text matched as expected");
|
|
} else {
|
|
throw new Error(`Expected: Dashboard - My Standards text: "California"; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//font
|
|
if (elementFont === "Poppins, sans-serif") {
|
|
console.log('Passed: Dashboard - My Standards California text font-family matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard - My Standards California text font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
|
|
}
|
|
|
|
//size
|
|
if (elementSize === '14.3px') {
|
|
console.log('Passed: Dashboard - My Standards California text font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard - My Standards California text font-size "14.3px"; Actual: "${elementSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementColor === 'rgba(33, 37, 41, 1)') {
|
|
console.log('Passed: Dashboard - My Standards California text color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard - My Standards California text color: "rgba(33, 37, 41, 1)"; Actual: "${elementColor}"`);
|
|
}
|
|
|
|
//export icon
|
|
if (elementExportIcon) {
|
|
console.log('Passed: Dashboard - My Standards California - Export icon is present');
|
|
} else {
|
|
errors.push('Expected: Dashboard - My Standards California - Export icon not found');
|
|
}
|
|
|
|
//more info icon tool-tip
|
|
if (elementMoreInfoIconTooltip === 'View Detail Information') {
|
|
console.log('Passed: Dashboard - My Standards California icon tool-tip text matched as expected');
|
|
} else {
|
|
errors.push(`Expected: ashboard - My Standards California: "View Detail Information"; Actual: "${elementMoreInfoIconTooltip}"`);
|
|
}
|
|
|
|
//view icon
|
|
if (elementViewIcon) {
|
|
console.log('Passed: Dashboard - My Standards California - View icon is present');
|
|
} else {
|
|
errors.push('Expected: Dashboard - My Standards California - View icon not found');
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Dashboard - My Standards = Florida
|
|
{
|
|
description: 'Validate Dashboard - My Standards Organization = Florida Standards text',
|
|
action: async () => {
|
|
const multipleChecks = 'My Standards Organization - Florida';
|
|
const element = await driver.findElement(By.css('#stdbody > tr:nth-child(4) > td:nth-child(1)'));
|
|
|
|
//Get text, font, color, and size
|
|
const elementText = await element.getText('');
|
|
const elementFont = await element.getCssValue('font-family');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
const elementColor = await element.getCssValue('color');
|
|
|
|
const elementExportIcon = await driver.findElement(By.css('#stdbody > tr:nth-child(4) > .text-center:nth-child(2) img'));
|
|
const elementMoreInfoIconTooltip = await driver.findElement(By.css('#stdbody > tr:nth-child(4) > td:nth-child(4) > a')).getAttribute('title');
|
|
const elementViewIcon = await driver.findElement(By.css('tr:nth-child(4) > .text-center:nth-child(5) img'));
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//text
|
|
if (elementText === 'Florida') {
|
|
console.log("Passed: Dashboard - My Standards Florida text matched as expected");
|
|
} else {
|
|
throw new Error(`Expected: Dashboard - My Standards text: "Florida"; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//font
|
|
if (elementFont === "Poppins, sans-serif") {
|
|
console.log('Passed: Dashboard - My Standards Florida text font-family matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard - My Standards Florida text font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
|
|
}
|
|
|
|
//size
|
|
if (elementSize === '14.3px') {
|
|
console.log('Passed: Dashboard - My Standards Florida text font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard - My Standards Florida text font-size "14.3px"; Actual: "${elementSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementColor === 'rgba(33, 37, 41, 1)') {
|
|
console.log('Passed: Dashboard - My Standards Florida text color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard - My Standards Florida text color: "rgba(33, 37, 41, 1)"; Actual: "${elementColor}"`);
|
|
}
|
|
|
|
//export icon
|
|
if (elementExportIcon) {
|
|
console.log('Passed: Dashboard - My Standards Florida - Export icon is present');
|
|
} else {
|
|
errors.push('Expected: Dashboard - My Standards Florida - Export icon not found');
|
|
}
|
|
|
|
//more info icon tool-tip
|
|
if (elementMoreInfoIconTooltip === 'View Detail Information') {
|
|
console.log('Passed: Dashboard - My Standards Florida icon tool-tip text matched as expected');
|
|
} else {
|
|
errors.push(`Expected: ashboard - My Standards Florida: "View Detail Information"; Actual: "${elementMoreInfoIconTooltip}"`);
|
|
}
|
|
|
|
//view icon
|
|
if (elementViewIcon) {
|
|
console.log('Passed: Dashboard - My Standards Florida - View icon is present');
|
|
} else {
|
|
errors.push('Expected: Dashboard - My Standards Florida - View icon not found');
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Dashboard - My Standards = Georgia
|
|
{
|
|
description: 'Validate Dashboard - My Standards Organization = Georgia Standards text',
|
|
action: async () => {
|
|
const multipleChecks = 'My Standards Organization - Georgia';
|
|
const element = await driver.findElement(By.css('#stdbody > tr:nth-child(5) > td:nth-child(1)'));
|
|
|
|
//Get text, font, color, and size
|
|
const elementText = await element.getText('');
|
|
const elementFont = await element.getCssValue('font-family');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
const elementColor = await element.getCssValue('color');
|
|
|
|
const elementExportIcon = await driver.findElement(By.css('#stdbody > tr:nth-child(5) > .text-center:nth-child(2) img'));
|
|
const elementMoreInfoIconTooltip = await driver.findElement(By.css('#stdbody > tr:nth-child(5) > td:nth-child(4) > a')).getAttribute('title');
|
|
const elementViewIcon = await driver.findElement(By.css('tr:nth-child(5) > .text-center:nth-child(5) img'));
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//text
|
|
if (elementText === 'Georgia') {
|
|
console.log("Passed: Dashboard - My Standards Georgia text matched as expected");
|
|
} else {
|
|
throw new Error(`Expected: Dashboard - My Standards text: "Georgia"; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//font
|
|
if (elementFont === "Poppins, sans-serif") {
|
|
console.log('Passed: Dashboard - My Standards Georgia text font-family matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard - My Standards Georgia text font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
|
|
}
|
|
|
|
//size
|
|
if (elementSize === '14.3px') {
|
|
console.log('Passed: Dashboard - My Standards Georgia text font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard - My Standards Georgia text font-size "14.3px"; Actual: "${elementSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementColor === 'rgba(33, 37, 41, 1)') {
|
|
console.log('Passed: Dashboard - My Standards Georgia text color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard - My Standards Georgia text color: "rgba(33, 37, 41, 1)"; Actual: "${elementColor}"`);
|
|
}
|
|
|
|
//export icon
|
|
if (elementExportIcon) {
|
|
console.log('Passed: Dashboard - My Standards Georgia - Export icon is present');
|
|
} else {
|
|
errors.push('Expected: Dashboard - My Standards Georgia - Export icon not found');
|
|
}
|
|
|
|
//more info icon tool-tip
|
|
if (elementMoreInfoIconTooltip === 'View Detail Information') {
|
|
console.log('Passed: Dashboard - My Standards Georgia icon tool-tip text matched as expected');
|
|
} else {
|
|
errors.push(`Expected: ashboard - My Standards Georgia: "View Detail Information"; Actual: "${elementMoreInfoIconTooltip}"`);
|
|
}
|
|
|
|
//view icon
|
|
if (elementViewIcon) {
|
|
console.log('Passed: Dashboard - My Standards Georgia - View icon is present');
|
|
} else {
|
|
errors.push('Expected: Dashboard - My Standards Georgia - View icon not found');
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Dashboard - My Standards = Illinois
|
|
{
|
|
description: 'Validate Dashboard - My Standards Organization = Illinois Standards text',
|
|
action: async () => {
|
|
const multipleChecks = 'My Standards Organization - Illinois';
|
|
const element = await driver.findElement(By.css('#stdbody > tr:nth-child(6) > td:nth-child(1)'));
|
|
|
|
//Get text, font, color, and size
|
|
const elementText = await element.getText('');
|
|
const elementFont = await element.getCssValue('font-family');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
const elementColor = await element.getCssValue('color');
|
|
|
|
const elementExportIcon = await driver.findElement(By.css('#stdbody > tr:nth-child(6) > .text-center:nth-child(2) img'));
|
|
const elementMoreInfoIconTooltip = await driver.findElement(By.css('#stdbody > tr:nth-child(6) > td:nth-child(4) > a')).getAttribute('title');
|
|
const elementViewIcon = await driver.findElement(By.css('tr:nth-child(6) > .text-center:nth-child(5) img'));
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//text
|
|
if (elementText === 'Illinois') {
|
|
console.log("Passed: Dashboard - My Standards Illinois text matched as expected");
|
|
} else {
|
|
throw new Error(`Expected: Dashboard - My Standards text: "Illinois"; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//font
|
|
if (elementFont === "Poppins, sans-serif") {
|
|
console.log('Passed: Dashboard - My Standards Illinois text font-family matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard - My Standards Illinois text font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
|
|
}
|
|
|
|
//size
|
|
if (elementSize === '14.3px') {
|
|
console.log('Passed: Dashboard - My Standards Illinois text font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard - My Standards Illinois text font-size "14.3px"; Actual: "${elementSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementColor === 'rgba(33, 37, 41, 1)') {
|
|
console.log('Passed: Dashboard - My Standards Illinois text color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard - My Standards Illinois text color: "rgba(33, 37, 41, 1)"; Actual: "${elementColor}"`);
|
|
}
|
|
|
|
//export icon
|
|
if (elementExportIcon) {
|
|
console.log('Passed: Dashboard - My Standards Illinois - Export icon is present');
|
|
} else {
|
|
errors.push('Expected: Dashboard - My Standards Illinois - Export icon not found');
|
|
}
|
|
|
|
//more info icon tool-tip
|
|
if (elementMoreInfoIconTooltip === 'View Detail Information') {
|
|
console.log('Passed: Dashboard - My Standards Illinois icon tool-tip text matched as expected');
|
|
} else {
|
|
errors.push(`Expected: ashboard - My Standards Illinois: "View Detail Information"; Actual: "${elementMoreInfoIconTooltip}"`);
|
|
}
|
|
|
|
//view icon
|
|
if (elementViewIcon) {
|
|
console.log('Passed: Dashboard - My Standards Illinois - View icon is present');
|
|
} else {
|
|
errors.push('Expected: Dashboard - My Standards Illinois - View icon not found');
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Dashboard - My Standards = New York
|
|
{
|
|
description: 'Validate Dashboard - My Standards Organization = New York Standards text',
|
|
action: async () => {
|
|
const multipleChecks = 'My Standards Organization - New York';
|
|
const element = await driver.findElement(By.css('#stdbody > tr:nth-child(7) > td:nth-child(1)'));
|
|
|
|
//Get text, font, color, and size
|
|
const elementText = await element.getText('');
|
|
const elementFont = await element.getCssValue('font-family');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
const elementColor = await element.getCssValue('color');
|
|
|
|
const elementExportIcon = await driver.findElement(By.css('#stdbody > tr:nth-child(7) > .text-center:nth-child(2) img'));
|
|
const elementMoreInfoIconTooltip = await driver.findElement(By.css('#stdbody > tr:nth-child(7) > td:nth-child(4) > a')).getAttribute('title');
|
|
const elementViewIcon = await driver.findElement(By.css('tr:nth-child(7) > .text-center:nth-child(5) img'));
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//text
|
|
if (elementText === 'New York') {
|
|
console.log("Passed: Dashboard - My Standards New York text matched as expected");
|
|
} else {
|
|
throw new Error(`Expected: Dashboard - My Standards text: "New York"; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//font
|
|
if (elementFont === "Poppins, sans-serif") {
|
|
console.log('Passed: Dashboard - My Standards New York text font-family matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard - My Standards New York text font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
|
|
}
|
|
|
|
//size
|
|
if (elementSize === '14.3px') {
|
|
console.log('Passed: Dashboard - My Standards New York text font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard - My Standards New York text font-size "14.3px"; Actual: "${elementSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementColor === 'rgba(33, 37, 41, 1)') {
|
|
console.log('Passed: Dashboard - My Standards New York text color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard - My Standards New York text color: "rgba(33, 37, 41, 1)"; Actual: "${elementColor}"`);
|
|
}
|
|
|
|
//export icon
|
|
if (elementExportIcon) {
|
|
console.log('Passed: Dashboard - My Standards New York - Export icon is present');
|
|
} else {
|
|
errors.push('Expected: Dashboard - My Standards New York - Export icon not found');
|
|
}
|
|
|
|
//more info icon tool-tip
|
|
if (elementMoreInfoIconTooltip === 'View Detail Information') {
|
|
console.log('Passed: Dashboard - My Standards New York icon tool-tip text matched as expected');
|
|
} else {
|
|
errors.push(`Expected: ashboard - My Standards New York: "View Detail Information"; Actual: "${elementMoreInfoIconTooltip}"`);
|
|
}
|
|
|
|
//view icon
|
|
if (elementViewIcon) {
|
|
console.log('Passed: Dashboard - My Standards New York - View icon is present');
|
|
} else {
|
|
errors.push('Expected: Dashboard - My Standards New York - View icon not found');
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Dashboard - My Standards = Texas
|
|
{
|
|
description: 'Validate Dashboard - My Standards Organization = Texas Standards text',
|
|
action: async () => {
|
|
const multipleChecks = 'My Standards Organization - Texas';
|
|
const element = await driver.findElement(By.css('#stdbody > tr:nth-child(8) > td:nth-child(1)'));
|
|
|
|
//Get text, font, color, and size
|
|
const elementText = await element.getText('');
|
|
const elementFont = await element.getCssValue('font-family');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
const elementColor = await element.getCssValue('color');
|
|
|
|
const elementExportIcon = await driver.findElement(By.css('#stdbody > tr:nth-child(8) > .text-center:nth-child(2) img'));
|
|
const elementMoreInfoIconTooltip = await driver.findElement(By.css('#stdbody > tr:nth-child(8) > td:nth-child(4) > a')).getAttribute('title');
|
|
const elementViewIcon = await driver.findElement(By.css('tr:nth-child(8) > .text-center:nth-child(5) img'));
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//text
|
|
if (elementText === 'Texas') {
|
|
console.log("Passed: Dashboard - My Standards Texas text matched as expected");
|
|
} else {
|
|
throw new Error(`Expected: Dashboard - My Standards text: "Texas"; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//font
|
|
if (elementFont === "Poppins, sans-serif") {
|
|
console.log('Passed: Dashboard - My Standards Texas text font-family matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard - My Standards Texas text font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
|
|
}
|
|
|
|
//size
|
|
if (elementSize === '14.3px') {
|
|
console.log('Passed: Dashboard - My Standards Texas text font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard - My Standards Texas text font-size "14.3px"; Actual: "${elementSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementColor === 'rgba(33, 37, 41, 1)') {
|
|
console.log('Passed: Dashboard - My Standards Texas text color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard - My Standards Texas text color: "rgba(33, 37, 41, 1)"; Actual: "${elementColor}"`);
|
|
}
|
|
|
|
//export icon
|
|
if (elementExportIcon) {
|
|
console.log('Passed: Dashboard - My Standards Texas - Export icon is present');
|
|
} else {
|
|
errors.push('Expected: Dashboard - My Standards Texas - Export icon not found');
|
|
}
|
|
|
|
//more info icon tool-tip
|
|
if (elementMoreInfoIconTooltip === 'View Detail Information') {
|
|
console.log('Passed: Dashboard - My Standards Texas icon tool-tip text matched as expected');
|
|
} else {
|
|
errors.push(`Expected: ashboard - My Standards Texas: "View Detail Information"; Actual: "${elementMoreInfoIconTooltip}"`);
|
|
}
|
|
|
|
//view icon
|
|
if (elementViewIcon) {
|
|
console.log('Passed: Dashboard - My Standards Texas - View icon is present');
|
|
} else {
|
|
errors.push('Expected: Dashboard - My Standards Texas - View icon not found');
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Dashboard - My Standards = Washington
|
|
{
|
|
description: 'Validate Dashboard - My Standards Organization = Washington Standards text',
|
|
action: async () => {
|
|
const multipleChecks = 'My Standards Organization - Washington';
|
|
const element = await driver.findElement(By.css('#stdbody > tr:nth-child(9) > td:nth-child(1)'));
|
|
|
|
//Get text, font, color, and size
|
|
const elementText = await element.getText('');
|
|
const elementFont = await element.getCssValue('font-family');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
const elementColor = await element.getCssValue('color');
|
|
|
|
const elementExportIcon = await driver.findElement(By.css('#stdbody > tr:nth-child(9) > .text-center:nth-child(2) img'));
|
|
const elementMoreInfoIconTooltip = await driver.findElement(By.css('#stdbody > tr:nth-child(9) > td:nth-child(4) > a')).getAttribute('title');
|
|
const elementViewIcon = await driver.findElement(By.css('tr:nth-child(9) > .text-center:nth-child(5) img'));
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//text
|
|
if (elementText === 'Washington') {
|
|
console.log("Passed: Dashboard - My Standards Washington text matched as expected");
|
|
} else {
|
|
throw new Error(`Expected: Dashboard - My Standards text: "Washington"; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//font
|
|
if (elementFont === "Poppins, sans-serif") {
|
|
console.log('Passed: Dashboard - My Standards Washington text font-family matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard - My Standards Washington text font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
|
|
}
|
|
|
|
//size
|
|
if (elementSize === '14.3px') {
|
|
console.log('Passed: Dashboard - My Standards Washington text font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard - My Standards Washington text font-size "14.3px"; Actual: "${elementSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementColor === 'rgba(33, 37, 41, 1)') {
|
|
console.log('Passed: Dashboard - My Standards Washington text color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard - My Standards Washington text color: "rgba(33, 37, 41, 1)"; Actual: "${elementColor}"`);
|
|
}
|
|
|
|
//export icon
|
|
if (elementExportIcon) {
|
|
console.log('Passed: Dashboard - My Standards Washington - Export icon is present');
|
|
} else {
|
|
errors.push('Expected: Dashboard - My Standards Washington - Export icon not found');
|
|
}
|
|
|
|
//more info icon tool-tip
|
|
if (elementMoreInfoIconTooltip === 'View Detail Information') {
|
|
console.log('Passed: Dashboard - My Standards Washington icon tool-tip text matched as expected');
|
|
} else {
|
|
errors.push(`Expected: ashboard - My Standards Washington: "View Detail Information"; Actual: "${elementMoreInfoIconTooltip}"`);
|
|
}
|
|
|
|
//view icon
|
|
if (elementViewIcon) {
|
|
console.log('Passed: Dashboard - My Standards Washington - View icon is present');
|
|
} else {
|
|
errors.push('Expected: Dashboard - My Standards Washington - View icon not found');
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//NEXT ACTION
|
|
{
|
|
description: 'Dashboard - Click Other Available Standards tab',
|
|
action: async () => {
|
|
await driver.findElement(By.css('#availstd-tab')).click();
|
|
console.log('----->| NEXT ACTION: Clicked Other Available Standards tab');
|
|
|
|
//Wait until the element exists in the DOM
|
|
const instructionText = await driver.wait(
|
|
until.elementLocated(By.css('p:nth-child(1)')),
|
|
30000
|
|
);
|
|
|
|
//Wait until it becomes visible
|
|
await driver.wait(
|
|
until.elementIsVisible(instructionText),
|
|
30000
|
|
);
|
|
}
|
|
},
|
|
|
|
//Dashboard - My Standards Widget title
|
|
{
|
|
description: 'Validate Dashboard Semantic Standards Comparison Widget title text, color, and size',
|
|
action: async () => {
|
|
const multipleChecks = 'Dashboard Semantic Standards Comparison Widget title';
|
|
const element = await driver.findElement(By.css('#mystd-tab'));
|
|
|
|
//Get text, font, color, and size
|
|
const elementText = await element.getText('');
|
|
const elementFont = await element.getCssValue('font-family');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
const elementColor = await element.getCssValue('color');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//text
|
|
if (elementText === 'My Standards') {
|
|
console.log('Passed: Dashboard - Semantic Standards Comparison Widget title matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard - "Semantic Standards Comparison"; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//font
|
|
if (elementFont === "Poppins, sans-serif") {
|
|
console.log('Passed: Dashboard - Semantic Standards Comparison Widget title text font-family matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard - Semantic Standards Comparison Widget title font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
|
|
}
|
|
|
|
//size
|
|
if (elementSize === '15px') {
|
|
console.log('Passed: Dashboard - Semantic Standards Comparison Widget title text font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard - Semantic Standards Comparison Widget title text font-size "15px"; Actual: "${elementSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementColor === 'rgba(182, 186, 181, 1)') {
|
|
console.log('Passed: Dashboard - Semantic Standards Comparison Widget title text color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard - Semantic Standards Comparison Widget title text color "rgba(182, 186, 181, 1)"; Actual: "${elementColor}"`);
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Dashboard - Other Available Stndards tab title (active)
|
|
{
|
|
description: 'Validate Dashboard - Other Available Stndards tab title text, color, and size',
|
|
action: async () => {
|
|
const multipleChecks = 'Other Available Stndards tab title';
|
|
const element = await driver.findElement(By.css('#availstd-tab'));
|
|
|
|
//Get text, font, color, and size
|
|
const elementText = await element.getText('');
|
|
const elementFont = await element.getCssValue('font-family');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
const elementColor = await element.getCssValue('color');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//text
|
|
if (elementText === 'Other Available Standards') {
|
|
console.log('Passed: Dashboard - Other Available Standards tab title matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard - "Other Available Standards"; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//font
|
|
if (elementFont === "Poppins, sans-serif") {
|
|
console.log('Passed: Dashboard - Other Available Standards tab title text font-family matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard - Other Available Standards tab title font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
|
|
}
|
|
|
|
//size
|
|
if (elementSize === '15px') {
|
|
console.log('Passed: Dashboard - Other Available Standards tab title text font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard - Other Available Standards tab title text font-size "15px"; Actual: "${elementSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementColor === 'rgba(40, 39, 90, 1)') {
|
|
console.log('Passed: Dashboard - Other Available Standards tab title text color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard - Other Available Standards tab title text color "rgba(40, 39, 90, 1)"'; Actual: "${elementColor}"`);
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Dashboard - Other Available Stndards tab title
|
|
{
|
|
description: 'Validate Dashboard - Other Available Stndards tab title text, color, and size',
|
|
action: async () => {
|
|
const multipleChecks = 'Other Available Stndards tab title';
|
|
const element = await driver.findElement(By.css('p:nth-child(1)'));
|
|
|
|
//Get text, font, color, and size
|
|
const elementText = await element.getText('');
|
|
const elementFont = await element.getCssValue('font-family');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
const elementColor = await element.getCssValue('color');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//text
|
|
if (elementText === 'The following standards are also available to clients. If you would like access to any of these standards sets, please Contact Us.') {
|
|
console.log('Passed: Dashboard - Other Available Standards description text matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard - "The following standards are also available to clients. If you would like access to any of these standards sets, please Contact Us."; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//font
|
|
if (elementFont === "Poppins, sans-serif") {
|
|
console.log('Passed: Dashboard - Other Available Standards description text font-family matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard - Other Available Standards description text font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
|
|
}
|
|
|
|
//size
|
|
if (elementSize === '13px') {
|
|
console.log('Passed: Dashboard - Other Available Standards tab title text font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard - Other Available Standards tab title text font-size "13px"; Actual: "${elementSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementColor === 'rgba(40, 39, 90, 1)') {
|
|
console.log('Passed: Dashboard - Other Available Standards tab title text color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard - Other Available Standards tab title text color "rgba(40, 39, 90, 1)"'; Actual: "${elementColor}"`);
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Dashboard - Other Available Standards dropdown
|
|
{
|
|
description: 'Validate Dashboard - Other Available Standards dropdown list and value',
|
|
action: async () => {
|
|
const multipleChecks = 'Other Available Standards';
|
|
const elementDropdown = await driver.findElement(By.css('#defstdparent'));
|
|
const selectedOption = await elementDropdown.findElement(By.css('option:checked'));
|
|
|
|
const elementText = await selectedOption.getText();
|
|
const elementFont = await selectedOption.getCssValue('font-family');
|
|
const elementSize = await selectedOption.getCssValue('font-size');
|
|
const elementColor = await selectedOption.getCssValue('color');
|
|
|
|
const options = await elementDropdown.findElements(By.css('option'));
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//text
|
|
if (elementText === 'United States Standards') {
|
|
console.log('Passed: Dashboard - Other Available Standards dropdown value matched as expected');
|
|
} else {
|
|
throw new Error(`Expected: Dashboard - Other Available Standards dropdown value - "United States Standards"; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//font
|
|
if (elementFont === "Poppins, sans-serif") {
|
|
console.log('Passed: Dashboard - Other Available Standards dropdown value font-family matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard - Other Available Standards dropdown value font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
|
|
}
|
|
|
|
//size
|
|
if (elementSize === '13px') {
|
|
console.log('Passed: Dashboard - Other Available Standards dropdown value font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard - Other Available Standards dropdown value font-size "13px"; Actual: "${elementSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementColor === 'rgba(40, 39, 90, 1)') {
|
|
console.log('Passed: Dashboard - Other Available Standards dropdown value color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard - Other Available Standards dropdown value color: "rgba(40, 39, 90, 1)"; Actual: "${elementColor}"`);
|
|
}
|
|
|
|
const expected = [
|
|
'ACT',
|
|
'ACTFL',
|
|
'AQA',
|
|
'Archived Standards',
|
|
'Australia',
|
|
'Brazil',
|
|
'Cambridge IGCSE',
|
|
'Cambridge International AS & A Level',
|
|
'Cambridge Secondary',
|
|
'Canada',
|
|
'Common Core Standards',
|
|
'Edexcel',
|
|
'England',
|
|
'Finland',
|
|
'India',
|
|
'India NCERT (Archived)',
|
|
'International Standards',
|
|
'Ireland (Archived)',
|
|
'Mexico',
|
|
'National Standards',
|
|
'New Zealand',
|
|
'OCR',
|
|
'Puerto Rico 2014',
|
|
'Saudi Arabia',
|
|
'Supplemental Standards',
|
|
'Taiwan (Additional)',
|
|
'Thailand (Additional)',
|
|
'United Arab Emirates',
|
|
'United States Standards'
|
|
];
|
|
|
|
const actual = [];
|
|
|
|
for (const opt of options) {
|
|
const text = (await opt.getText()).trim();
|
|
actual.push(text);
|
|
}
|
|
|
|
if (JSON.stringify(actual) === JSON.stringify(expected)) {
|
|
console.log('Passed: Dashboard - Other Available Standards dropdown list matched as expected');
|
|
} else {
|
|
throw new Error(`Expected: Dashboard - Other Available Standards dropdown list: ${JSON.stringify(expected)}, Actual: ${JSON.stringify(actual)}`);
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Dashboard - Other Available Standards Organization column title
|
|
{
|
|
description: 'Validate Dashboard - Other Available Standards Organization column title, text, and font size',
|
|
action: async () => {
|
|
const multiple = 'Other Available Standards Organization column title';
|
|
const element = await driver.findElement(By.css('.table:nth-child(3) th:nth-child(1)'));
|
|
|
|
//Get text, font, color, and size
|
|
const elementText = await element.getText('');
|
|
const elementFont = await element.getCssValue('font-family');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
const elementColor = await element.getCssValue('color');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//text
|
|
if (elementText === 'Organization') {
|
|
console.log('Passed: Dashboard - Other Available Standards Organization column title matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard - Other Available Standards "Organization" column title; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//font
|
|
if (elementFont === "Poppins, sans-serif") {
|
|
console.log('Passed: Dashboard - Other Available Standards Organization column title font-family matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard - Other Available Standards Organization column title font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
|
|
}
|
|
|
|
//size
|
|
if (elementSize === '14px') {
|
|
console.log('Passed: Dashboard - Other Available Standards Organization column title text font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard - Other Available Standards Organization column title text font-size "14px"; Actual: "${elementSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementColor === 'rgba(94, 105, 116, 1)') {
|
|
console.log('Passed: Dashboard - Other Available Standards Organization column title text color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard - Other Available Standards Organization column title text color "rgba(94, 105, 116, 1)"'; Actual: "${elementColor}"`);
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Dashboard - Other Available Organization column title
|
|
{
|
|
description: 'Validate Dashboard - Other Available Standards More Info column title, text, and font size',
|
|
action: async () => {
|
|
const multipleChecks = 'Other Available Organization column title';
|
|
const element = await driver.findElement(By.css('.table:nth-child(3) > thead .text-center'));
|
|
|
|
//Get text, font, color, and size
|
|
const elementText = await element.getText('');
|
|
const elementFont = await element.getCssValue('font-family');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
const elementColor = await element.getCssValue('color');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//text
|
|
if (elementText === 'More Info') {
|
|
console.log('Passed: Dashboard - Other Available Standards More Info column title matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard - Other Available Standards "More Info" column title; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//font
|
|
if (elementFont === "Poppins, sans-serif") {
|
|
console.log('Passed: Dashboard - Other Available Standards More Info column title font-family matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard - Other Available Standards More Info column title font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
|
|
}
|
|
|
|
//size
|
|
if (elementSize === '14px') {
|
|
console.log('Passed: Dashboard - Other Available Standards More Info column title text font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard - Other Available Standards More Info column title text font-size "14px"; Actual: "${elementSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementColor === 'rgba(94, 105, 116, 1)') {
|
|
console.log('Passed: Dashboard - Other Available Standards More Info column title text color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard - Other Available Standards More Info column title text color "rgba(94, 105, 116, 1)"'; Actual: "${elementColor}"`);
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Dashboard - Other Available Standards - Alaska
|
|
{
|
|
description: 'Validate Dashboard - Other Available Standards - Alaska',
|
|
action: async () => {
|
|
const multipleChecks = 'Other Available Standards - Alaska';
|
|
const element = await driver.findElement(By.css('#defstdbody > tr:nth-child(1) > td:nth-child(1)'));
|
|
|
|
//Get text, font, color, and size
|
|
const elementText = await element.getText('');
|
|
const elementFont = await element.getCssValue('font-family');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
const elementColor = await element.getCssValue('color');
|
|
|
|
const elementMoreInfoIconTooltip = await driver.findElement(By.css('#defstdbody > tr:nth-child(1) > td.text-center > a')).getAttribute('title');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//text
|
|
if (elementText === 'Alaska') {
|
|
console.log('Passed: Dashboard - Other Available Standards Alaska column title matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard - Other Available Standards "Alaska" column title; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//font
|
|
if (elementFont === "Poppins, sans-serif") {
|
|
console.log('Passed: Dashboard - Other Available Standards Alaska column title font-family matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard - Other Available Standards Alaska column title font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
|
|
}
|
|
|
|
//size
|
|
if (elementSize === '14.3px') {
|
|
console.log('Passed: Dashboard - Other Available Standards Alaska column title text font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard - Other Available Standards Alaska column title text font-size "14.3px"; Actual: "${elementSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementColor === 'rgba(33, 37, 41, 1)') {
|
|
console.log('Passed: Dashboard - Other Available Standards Alaska column title text color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard - Other Available Standards Alaska column title text color "rgba(33, 37, 41, 1)"'; Actual: "${elementColor}"`);
|
|
}
|
|
|
|
//more info icon tool-tip
|
|
if (elementMoreInfoIconTooltip === 'View Detail Information') {
|
|
console.log('Passed: Dashboard - Other Available Standards Alaska icon tool-tip text matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard - Other Available Standards Alaska: "View Detail Information"; Actual: "${elementMoreInfoIconTooltip}"`);
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Dashboard - Other Available Standards - Arkansas
|
|
{
|
|
description: 'Validate Dashboard - Other Available Standards - Arkansas',
|
|
action: async () => {
|
|
const multipleChecks = 'Other Available Standards - Arkansas';
|
|
const element = await driver.findElement(By.css('#defstdbody > tr:nth-child(2) > td:nth-child(1)'));
|
|
|
|
//Get text, font, color, and size
|
|
const elementText = await element.getText('');
|
|
const elementFont = await element.getCssValue('font-family');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
const elementColor = await element.getCssValue('color');
|
|
|
|
const elementMoreInfoIconTooltip = await driver.findElement(By.css('#defstdbody > tr:nth-child(2) > td.text-center > a')).getAttribute('title');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//text
|
|
if (elementText === 'Arkansas') {
|
|
console.log('Passed: Dashboard - Other Available Standards Arkansas column title matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard - Other Available Standards "Arkansas" column title; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//font
|
|
if (elementFont === "Poppins, sans-serif") {
|
|
console.log('Passed: Dashboard - Other Available Standards Arkansas column title font-family matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard - Other Available Standards Arkansas column title font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
|
|
}
|
|
|
|
//size
|
|
if (elementSize === '14.3px') {
|
|
console.log('Passed: Dashboard - Other Available Standards Arkansas column title text font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard - Other Available Standards Arkansas column title text font-size "14.3px"; Actual: "${elementSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementColor === 'rgba(33, 37, 41, 1)') {
|
|
console.log('Passed: Dashboard - Other Available Standards Arkansas column title text color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard - Other Available Standards Arkansas column title text color "rgba(33, 37, 41, 1)"'; Actual: "${elementColor}"`);
|
|
}
|
|
|
|
//more info icon tool-tip
|
|
if (elementMoreInfoIconTooltip === 'View Detail Information') {
|
|
console.log('Passed: Dashboard - Other Available Standards Arkansas icon tool-tip text matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard - Other Available Standards Arkansas: "View Detail Information"; Actual: "${elementMoreInfoIconTooltip}"`);
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Dashboard - Other Available Standards - Colorado
|
|
{
|
|
description: 'Validate Dashboard - Other Available Standards - Colorado',
|
|
action: async () => {
|
|
const multipleChecks = 'Other Available Standards - Colorado';
|
|
const element = await driver.findElement(By.css('#defstdbody > tr:nth-child(3) > td:nth-child(1)'));
|
|
|
|
//Get text, font, color, and size
|
|
const elementText = await element.getText('');
|
|
const elementFont = await element.getCssValue('font-family');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
const elementColor = await element.getCssValue('color');
|
|
|
|
const elementMoreInfoIconTooltip = await driver.findElement(By.css('#defstdbody > tr:nth-child(3) > td.text-center > a')).getAttribute('title');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//text
|
|
if (elementText === 'Colorado') {
|
|
console.log('Passed: Dashboard - Other Available Standards Colorado column title matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard - Other Available Standards "Colorado" column title; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//font
|
|
if (elementFont === "Poppins, sans-serif") {
|
|
console.log('Passed: Dashboard - Other Available Standards Colorado column title font-family matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard - Other Available Standards Colorado column title font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
|
|
}
|
|
|
|
//size
|
|
if (elementSize === '14.3px') {
|
|
console.log('Passed: Dashboard - Other Available Standards Colorado column title text font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard - Other Available Standards Colorado column title text font-size "14.3px"; Actual: "${elementSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementColor === 'rgba(33, 37, 41, 1)') {
|
|
console.log('Passed: Dashboard - Other Available Standards Colorado column title text color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard - Other Available Standards Colorado column title text color "rgba(33, 37, 41, 1)"'; Actual: "${elementColor}"`);
|
|
}
|
|
|
|
//more info icon tool-tip
|
|
if (elementMoreInfoIconTooltip === 'View Detail Information') {
|
|
console.log('Passed: Dashboard - Other Available Standards Colorado icon tool-tip text matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard - Other Available Standards Colorado: "View Detail Information"; Actual: "${elementMoreInfoIconTooltip}"`);
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Dashboard - Other Available Standards - Connecticut
|
|
{
|
|
description: 'Validate Dashboard - Other Available Standards - Connecticut',
|
|
action: async () => {
|
|
const multipleChecks = 'Other Available Standards - Connecticut';
|
|
const element = await driver.findElement(By.css('#defstdbody > tr:nth-child(4) > td:nth-child(1)'));
|
|
|
|
//Get text, font, color, and size
|
|
const elementText = await element.getText('');
|
|
const elementFont = await element.getCssValue('font-family');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
const elementColor = await element.getCssValue('color');
|
|
|
|
const elementMoreInfoIconTooltip = await driver.findElement(By.css('#defstdbody > tr:nth-child(4) > td.text-center > a')).getAttribute('title');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//text
|
|
if (elementText === 'Connecticut') {
|
|
console.log('Passed: Dashboard - Other Available Standards Connecticut column title matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard - Other Available Standards "Connecticut" column title; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//font
|
|
if (elementFont === "Poppins, sans-serif") {
|
|
console.log('Passed: Dashboard - Other Available Standards Connecticut column title font-family matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard - Other Available Standards Connecticut column title font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
|
|
}
|
|
|
|
//size
|
|
if (elementSize === '14.3px') {
|
|
console.log('Passed: Dashboard - Other Available Standards Connecticut column title text font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard - Other Available Standards Connecticut column title text font-size "14.3px"; Actual: "${elementSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementColor === 'rgba(33, 37, 41, 1)') {
|
|
console.log('Passed: Dashboard - Other Available Standards Connecticut column title text color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard - Other Available Standards Connecticut column title text color "rgba(33, 37, 41, 1)"'; Actual: "${elementColor}"`);
|
|
}
|
|
|
|
//more info icon tool-tip
|
|
if (elementMoreInfoIconTooltip === 'View Detail Information') {
|
|
console.log('Passed: Dashboard - Other Available Standards Connecticut icon tool-tip text matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard - Other Available Standards Connecticut: "View Detail Information"; Actual: "${elementMoreInfoIconTooltip}"`);
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Dashboard - Other Available Standards - Delaware
|
|
{
|
|
description: 'Validate Dashboard - Other Available Standards - Delaware',
|
|
action: async () => {
|
|
const multipleChecks = 'Other Available Standards - Delaware';
|
|
const element = await driver.findElement(By.css('#defstdbody > tr:nth-child(5) > td:nth-child(1)'));
|
|
|
|
//Get text, font, color, and size
|
|
const elementText = await element.getText('');
|
|
const elementFont = await element.getCssValue('font-family');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
const elementColor = await element.getCssValue('color');
|
|
|
|
const elementMoreInfoIconTooltip = await driver.findElement(By.css('#defstdbody > tr:nth-child(5) > td.text-center > a')).getAttribute('title');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//text
|
|
if (elementText === 'Delaware') {
|
|
console.log('Passed: Dashboard - Other Available Standards Delaware column title matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard - Other Available Standards "Delaware" column title; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//font
|
|
if (elementFont === "Poppins, sans-serif") {
|
|
console.log('Passed: Dashboard - Other Available Standards Delaware column title font-family matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard - Other Available Standards Delaware column title font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
|
|
}
|
|
|
|
//size
|
|
if (elementSize === '14.3px') {
|
|
console.log('Passed: Dashboard - Other Available Standards Delaware column title text font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard - Other Available Standards Delaware column title text font-size "14.3px"; Actual: "${elementSize}"`);
|
|
}
|
|
|
|
//more info icon tool-tip
|
|
if (elementMoreInfoIconTooltip === 'View Detail Information') {
|
|
console.log('Passed: Dashboard - Other Available Standards Delaware icon tool-tip text matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard - Other Available Standards Delaware: "View Detail Information"; Actual: "${elementMoreInfoIconTooltip}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementColor === 'rgba(33, 37, 41, 1)') {
|
|
console.log('Passed: Dashboard - Other Available Standards Delaware column title text color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard - Other Available Standards Delaware column title text color "rgba(33, 37, 41, 1)"'; Actual: "${elementColor}"`);
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//NEXT ACTION
|
|
{
|
|
description: 'Dashboard - Click My Standards tab',
|
|
action: async () => {
|
|
await driver.findElement(By.css('#mystd-tab')).click();
|
|
console.log('----->| NEXT ACTION: Clicked My Standards tab');
|
|
|
|
//Wait until the element exists in the DOM
|
|
const myStandardsDropdown = await driver.wait(
|
|
until.elementLocated(By.css('#stdparent')),
|
|
30000
|
|
);
|
|
|
|
//Wait until it becomes visible
|
|
await driver.wait(
|
|
until.elementIsVisible(myStandardsDropdown),
|
|
30000
|
|
);
|
|
}
|
|
},
|
|
|
|
//Dashboard - My Standards Widget title (active)
|
|
{
|
|
description: 'Validate Dashboard Semantic Standards Comparison Widget title text, color, and size',
|
|
action: async () => {
|
|
const multipleChecks = 'My Standards Widget title (active)';
|
|
const element = await driver.findElement(By.css('#mystd-tab'));
|
|
|
|
//Get text, font, color, and size
|
|
const elementText = await element.getText('');
|
|
const elementFont = await element.getCssValue('font-family');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
const elementColor = await element.getCssValue('color');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//text
|
|
if (elementText === 'My Standards') {
|
|
console.log('Passed: Dashboard - Semantic Standards Comparison Widget title matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard - "Semantic Standards Comparison"; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//font
|
|
if (elementFont === "Poppins, sans-serif") {
|
|
console.log('Passed: Dashboard - Semantic Standards Comparison Widget title font-family matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard - Semantic Standards Comparison Widget title font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
|
|
}
|
|
|
|
//size
|
|
if (elementSize === '15px') {
|
|
console.log('Passed: Dashboard - Semantic Standards Comparison Widget title text font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard - Semantic Standards Comparison Widget title text font-size "15px"; Actual: "${elementSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementColor === 'rgba(40, 39, 90, 1)') {
|
|
console.log('Passed: Dashboard - Semantic Standards Comparison Widget title text color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard - Semantic Standards Comparison Widget title text color "rgba(40, 39, 90, 1)"; Actual: "${elementColor}"`);
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Dashboard - Other Available Stndards tab title
|
|
{
|
|
description: 'Validate Dashboard - Other Available Stndards tab title text, color, and size',
|
|
action: async () => {
|
|
const multipleChecks = 'Other Available Stndards tab title';
|
|
const element = await driver.findElement(By.css('#availstd-tab'));
|
|
|
|
//Get text, font, color, and size
|
|
const elementText = await element.getText('');
|
|
const elementFont = await element.getCssValue('font-family');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
const elementColor = await element.getCssValue('color');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//text
|
|
if (elementText === 'Other Available Standards') {
|
|
console.log('Passed: Dashboard - Other Available Standards tab title matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard - "Other Available Standards"; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//font
|
|
if (elementFont === "Poppins, sans-serif") {
|
|
console.log('Passed: Dashboard - Other Available Standards tab title font-family matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard - Other Available Standards tab title font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
|
|
}
|
|
|
|
//size
|
|
if (elementSize === '15px') {
|
|
console.log('Passed: Dashboard - Other Available Standards tab title text font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard - Other Available Standards tab title text font-size "15px"; Actual: "${elementSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementColor === 'rgba(182, 186, 181, 1)') {
|
|
console.log('Passed: Dashboard - Other Available Standards tab title text color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard - Other Available Standards tab title text color "rgba(182, 186, 181, 1)"'; Actual: "${elementColor}"`);
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Dashboard - My Standards dropdown
|
|
{
|
|
description: 'Validate Dashboard - My Standards dropdown list and value',
|
|
action: async () => {
|
|
const multipleChecks = 'My Standards dropdown list';
|
|
const elementDropdown = await driver.findElement(By.css('#stdparent'));
|
|
const selectedOption = await elementDropdown.findElement(By.css('option:checked'));
|
|
|
|
const elementText = await selectedOption.getText();
|
|
const elementFont = await selectedOption.getCssValue('font-family');
|
|
const elementSize = await selectedOption.getCssValue('font-size');
|
|
const elementColor = await selectedOption.getCssValue('color');
|
|
|
|
const options = await elementDropdown.findElements(By.css('option'));
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//text
|
|
if (elementText === 'United States Standards') {
|
|
console.log('Passed: Dashboard - My Standards dropdown text matched as expected');
|
|
} else {
|
|
throw new Error(`Expected: Dashboard - My Standards: "United States Standards"; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//font
|
|
if (elementFont === "Poppins, sans-serif") {
|
|
console.log('Passed: Dashboard - My Standards dropdown font-family matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard - My Standards dropdown font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
|
|
}
|
|
|
|
//size
|
|
if (elementSize === '13px') {
|
|
console.log('Passed: Dashboard - My Standards dropdown font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard - My Standards dropdown font-size "13px"; Actual: "${elementSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementColor === 'rgba(40, 39, 90, 1)') {
|
|
console.log('Passed: Dashboard - My Standards dropdown color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard - My Standards dropdown color: "rgba(40, 39, 90, 1)"; Actual: "${elementColor}"`);
|
|
}
|
|
|
|
const expected = [
|
|
'ACTFL',
|
|
'Australia',
|
|
'California',
|
|
'Canada',
|
|
'Common Core Standards',
|
|
'Creating Org',
|
|
'Demo Client Standards',
|
|
'Demo Standards',
|
|
'Imports',
|
|
'New Folder',
|
|
'QA Client Test Frameworks',
|
|
'United States Standards',
|
|
'WIDA'
|
|
];
|
|
|
|
const actual = [];
|
|
|
|
for (const opt of options) {
|
|
const text = (await opt.getText()).trim();
|
|
actual.push(text);
|
|
}
|
|
|
|
if (JSON.stringify(actual) === JSON.stringify(expected)) {
|
|
console.log('Passed: Dashboard - My Standards Dropdown list matched as expected');
|
|
} else {
|
|
throw new Error(`Expected: Dashboard - My Standards Dropdown list: ${JSON.stringify(expected)}, Actual: ${JSON.stringify(actual)}`);
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Dashboard - My Standards Organization column title
|
|
{
|
|
description: 'Validate Dashboard - My Standards Organization column title, text, and font size',
|
|
action: async () => {
|
|
const multipleChecks = 'My Standards Organization column title'
|
|
const element = await driver.findElement(By.css('.table:nth-child(2) th:nth-child(1)'));
|
|
|
|
//Get text, font, color, and size
|
|
const elementText = await element.getText('');
|
|
const elementFont = await element.getCssValue('font-family');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
const elementColor = await element.getCssValue('color');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//text
|
|
if (elementText === 'Organization') {
|
|
console.log('Passed: Dashboard - My Standards Organization column title matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard - My Standards "Organization" column title; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//font
|
|
if (elementFont === "Poppins, sans-serif") {
|
|
console.log('Passed: Dashboard - My Standards Organization column title font-family matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard - My Standards Organization column title font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
|
|
}
|
|
|
|
//size
|
|
if (elementSize === '14px') {
|
|
console.log('Passed: Dashboard - My Standards Organization column title text font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard - My Standards Organization column title text font-size "14px"; Actual: "${elementSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementColor === 'rgba(94, 105, 116, 1)') {
|
|
console.log('Passed: Dashboard - My Standards Organization column title text color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard - My Standards Organization column title text color "rgba(94, 105, 116, 1)"'; Actual: "${elementColor}"`);
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Dashboard - My Standards Export column title
|
|
{
|
|
description: 'Validate Dashboard - My Standards Export column title, text, and font size',
|
|
action: async () => {
|
|
const multipleChecks = 'My Standards Export column title';
|
|
const element = await driver.findElement(By.css('.table:nth-child(2) > thead .text-center:nth-child(2)'));
|
|
|
|
//Get text, font, color, and size
|
|
const elementText = await element.getText('');
|
|
const elementFont = await element.getCssValue('font-family');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
const elementColor = await element.getCssValue('color');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//text
|
|
if (elementText === 'Export') {
|
|
console.log('Passed: Dashboard - My Standards Export column title matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard - My Standards "Export" column title; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//font
|
|
if (elementFont === "Poppins, sans-serif") {
|
|
console.log('Passed: Dashboard - My Standards Export column title font-family matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard - My Standards Export column title font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
|
|
}
|
|
|
|
//size
|
|
if (elementSize === '14px') {
|
|
console.log('Passed: Dashboard - My Standards Export column title text font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard - My Standards Export column title text font-size "14px"; Actual: "${elementSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementColor === 'rgba(94, 105, 116, 1)') {
|
|
console.log('Passed: Dashboard - My Standards Export column title text color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard - My Standards Export column title text color "rgba(94, 105, 116, 1)"'; Actual: "${elementColor}"`);
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Dashboard - My Standards Manage column title
|
|
{
|
|
description: 'Validate Dashboard - My Standards Manage column title, text, and font size',
|
|
action: async () => {
|
|
const multipleChecks = 'My Standards Manage column title';
|
|
const element = await driver.findElement(By.css('.text-center:nth-child(3)'));
|
|
|
|
//Get text, font, color, and size
|
|
const elementText = await element.getText('');
|
|
const elementFont = await element.getCssValue('font-family');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
const elementColor = await element.getCssValue('color');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//text
|
|
if (elementText === 'Manage') {
|
|
console.log('Passed: Dashboard - My Standards Manage column title matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard - My Standards "Manage" column title; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//font
|
|
if (elementFont === "Poppins, sans-serif") {
|
|
console.log('Passed: Dashboard - My Standards Manage column title font-family matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard - My Standards Manage column title font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
|
|
}
|
|
|
|
//size
|
|
if (elementSize === '14px') {
|
|
console.log('Passed: Dashboard - My Standards Manage column title text font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard - My Standards Manage column title text font-size "14px"; Actual: "${elementSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementColor === 'rgba(94, 105, 116, 1)') {
|
|
console.log('Passed: Dashboard - My Standards Manage column title text color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard - My Standards Manage column title text color "rgba(94, 105, 116, 1)"'; Actual: "${elementColor}"`);
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Dashboard - My Standards More Info column title,
|
|
{
|
|
description: 'Validate Dashboard - My Standards More Info column title, text, and font size',
|
|
action: async () => {
|
|
const multipleChecks = 'My Standards More Info column title';
|
|
const element = await driver.findElement(By.css('.table-sm > thead .text-center:nth-child(4)'));
|
|
|
|
//Get text, font, color, and size
|
|
const elementText = await element.getText('');
|
|
const elementFont = await element.getCssValue('font-family');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
const elementColor = await element.getCssValue('color');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//text
|
|
if (elementText === 'More Info') {
|
|
console.log('Passed: Dashboard - My Standards More Info column title matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard - My Standards "More Info" column title; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//font
|
|
if (elementFont === "Poppins, sans-serif") {
|
|
console.log('Passed: Dashboard - My Standards More Info column title font-family matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard - My Standards More Info column title font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
|
|
}
|
|
|
|
//size
|
|
if (elementSize === '14px') {
|
|
console.log('Passed: Dashboard - My Standards More Info column title text font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard - My Standards More Info column title text font-size "14px"; Actual: "${elementSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementColor === 'rgba(94, 105, 116, 1)') {
|
|
console.log('Passed: Dashboard - My Standards More Info column title text color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard - My Standards More Info column title text color "rgba(94, 105, 116, 1)"'; Actual: "${elementColor}"`);
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Dashboard - My Standards View column title
|
|
{
|
|
description: 'Validate Dashboard - My Standards View column title, text, and font size',
|
|
action: async () => {
|
|
const multipleChecks = 'My Standards View column title';
|
|
const element = await driver.findElement(By.css('thead .text-center:nth-child(5)'));
|
|
|
|
//Get text, font, color, and size
|
|
const elementText = await element.getText('');
|
|
const elementFont = await element.getCssValue('font-family');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
const elementColor = await element.getCssValue('color');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//text
|
|
if (elementText === 'View') {
|
|
console.log('Passed: Dashboard - My Standards View column title matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard - My Standards "View" column title; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//font
|
|
if (elementFont === "Poppins, sans-serif") {
|
|
console.log('Passed: Dashboard - My Standards View column title font-family matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard - My Standards View column title font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
|
|
}
|
|
|
|
//size
|
|
if (elementSize === '14px') {
|
|
console.log('Passed: Dashboard - My Standards View column title text font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard - My Standards View column title text font-size "14px"; Actual: "${elementSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementColor === 'rgba(94, 105, 116, 1)') {
|
|
console.log('Passed: Dashboard - My Standards View column title text color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard - My Standards View column title text color "rgba(94, 105, 116, 1)"'; Actual: "${elementColor}"`);
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Dashboard - My Standards = Alabama
|
|
{
|
|
description: 'Validate Dashboard - My Standards Organization = Alabama Standards text',
|
|
action: async () => {
|
|
const multipleChecks = 'My Standards Organization - Alabama';
|
|
const element = await driver.findElement(By.css('#stdbody > tr:nth-child(1) > td:nth-child(1)'));
|
|
|
|
//Get text, font, color, and size
|
|
const elementText = await element.getText('');
|
|
const elementFont = await element.getCssValue('font-family');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
const elementColor = await element.getCssValue('color');
|
|
|
|
const elementExportIcon = await driver.findElement(By.css('#stdbody > tr:nth-child(1) > .text-center:nth-child(2) img'));
|
|
const elementMoreInfoIconTooltip = await driver.findElement(By.css('#stdbody > tr:nth-child(1) > td:nth-child(4) > a')).getAttribute('title');
|
|
const elementViewIcon = await driver.findElement(By.css('tr:nth-child(1) > .text-center:nth-child(5) img'));
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//text
|
|
if (elementText === 'Alabama') {
|
|
console.log("Passed: Dashboard - My Standards Alabama text matched as expected");
|
|
} else {
|
|
throw new Error(`Expected: Dashboard - My Standards text: "Alabama"; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//font
|
|
if (elementFont === "Poppins, sans-serif") {
|
|
console.log('Passed: Dashboard - My Standards Alabama text font-family matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard - My Standards Alabama text font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
|
|
}
|
|
|
|
//size
|
|
if (elementSize === '14.3px') {
|
|
console.log('Passed: Dashboard - My Standards Alabama text font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard - My Standards Alabama text font-size "14.3px"; Actual: "${elementSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementColor === 'rgba(33, 37, 41, 1)') {
|
|
console.log('Passed: Dashboard - My Standards Alabama text color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard - My Standards Alabama text color: "rgba(33, 37, 41, 1)"; Actual: "${elementColor}"`);
|
|
}
|
|
|
|
//export icon
|
|
if (elementExportIcon) {
|
|
console.log('Passed: Dashboard - My Standards Alabama - Export icon is present');
|
|
} else {
|
|
errors.push('Expected: Dashboard - My Standards Alabama - Export icon not found');
|
|
}
|
|
|
|
//more info icon tool-tip
|
|
if (elementMoreInfoIconTooltip === 'View Detail Information') {
|
|
console.log('Passed: Dashboard - My Standards Alabama icon tool-tip text matched as expected');
|
|
} else {
|
|
errors.push(`Expected: ashboard - My Standards Alabama: "View Detail Information"; Actual: "${elementMoreInfoIconTooltip}"`);
|
|
}
|
|
|
|
//view icon
|
|
if (elementViewIcon) {
|
|
console.log('Passed: Dashboard - My Standards Alabama - View icon is present');
|
|
} else {
|
|
errors.push('Expected: Dashboard - My Standards Alabama - View icon not found');
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Dashboard - My Standards = Arizona
|
|
{
|
|
description: 'Validate Dashboard - My Standards Organization = Arizona Standards text',
|
|
action: async () => {
|
|
const multipleChecks = 'My Standards Organization - Arizona';
|
|
const element = await driver.findElement(By.css('#stdbody > tr:nth-child(2) > td:nth-child(1)'));
|
|
|
|
//Get text, font, color, and size
|
|
const elementText = await element.getText('');
|
|
const elementFont = await element.getCssValue('font-family');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
const elementColor = await element.getCssValue('color');
|
|
|
|
const elementExportIcon = await driver.findElement(By.css('#stdbody > tr:nth-child(2) > .text-center:nth-child(2) img'));
|
|
const elementMoreInfoIconTooltip = await driver.findElement(By.css('#stdbody > tr:nth-child(2) > td:nth-child(4) > a')).getAttribute('title');
|
|
const elementViewIcon = await driver.findElement(By.css('tr:nth-child(2) > .text-center:nth-child(5) img'));
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//text
|
|
if (elementText === 'Arizona') {
|
|
console.log("Passed: Dashboard - My Standards Arizona text matched as expected");
|
|
} else {
|
|
throw new Error(`Expected: Dashboard - My Standards text: "Arizona"; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//font
|
|
if (elementFont === "Poppins, sans-serif") {
|
|
console.log('Passed: Dashboard - My Standards Arizona text font-family matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard - My Standards Arizona text font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
|
|
}
|
|
|
|
//size
|
|
if (elementSize === '14.3px') {
|
|
console.log('Passed: Dashboard - My Standards Arizona text font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard - My Standards Arizona text font-size "14.3px"; Actual: "${elementSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementColor === 'rgba(33, 37, 41, 1)') {
|
|
console.log('Passed: Dashboard - My Standards Arizona text color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard - My Standards Arizona text color: "rgba(33, 37, 41, 1)"; Actual: "${elementColor}"`);
|
|
}
|
|
|
|
//export icon
|
|
if (elementExportIcon) {
|
|
console.log('Passed: Dashboard - My Standards Arizona - Export icon is present');
|
|
} else {
|
|
errors.push('Expected: Dashboard - My Standards Arizona - Export icon not found');
|
|
}
|
|
|
|
//more info icon tool-tip
|
|
if (elementMoreInfoIconTooltip === 'View Detail Information') {
|
|
console.log('Passed: Dashboard - My Standards Arizona icon tool-tip text matched as expected');
|
|
} else {
|
|
errors.push(`Expected: ashboard - My Standards Arizona: "View Detail Information"; Actual: "${elementMoreInfoIconTooltip}"`);
|
|
}
|
|
|
|
//view icon
|
|
if (elementViewIcon) {
|
|
console.log('Passed: Dashboard - My Standards Arizona - View icon is present');
|
|
} else {
|
|
errors.push('Expected: Dashboard - My Standards Arizona - View icon not found');
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Dashboard - My Standards = California
|
|
{
|
|
description: 'Validate Dashboard - My Standards Organization = California Standards text',
|
|
action: async () => {
|
|
const multipleChecks = 'My Standards Organization - California';
|
|
const element = await driver.findElement(By.css('#stdbody > tr:nth-child(3) > td:nth-child(1)'));
|
|
|
|
//Get text, font, color, and size
|
|
const elementText = await element.getText('');
|
|
const elementFont = await element.getCssValue('font-family');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
const elementColor = await element.getCssValue('color');
|
|
|
|
const elementExportIcon = await driver.findElement(By.css('#stdbody > tr:nth-child(3) > .text-center:nth-child(2) img'));
|
|
const elementMoreInfoIconTooltip = await driver.findElement(By.css('#stdbody > tr:nth-child(3) > td:nth-child(4) > a')).getAttribute('title');
|
|
const elementViewIcon = await driver.findElement(By.css('tr:nth-child(3) > .text-center:nth-child(5) img'));
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//text
|
|
if (elementText === 'California') {
|
|
console.log("Passed: Dashboard - My Standards California text matched as expected");
|
|
} else {
|
|
throw new Error(`Expected: Dashboard - My Standards text: "California"; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//font
|
|
if (elementFont === "Poppins, sans-serif") {
|
|
console.log('Passed: Dashboard - My Standards California text font-family matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard - My Standards California text font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
|
|
}
|
|
|
|
//size
|
|
if (elementSize === '14.3px') {
|
|
console.log('Passed: Dashboard - My Standards California text font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard - My Standards California text font-size "14.3px"; Actual: "${elementSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementColor === 'rgba(33, 37, 41, 1)') {
|
|
console.log('Passed: Dashboard - My Standards California text color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard - My Standards California text color: "rgba(33, 37, 41, 1)"; Actual: "${elementColor}"`);
|
|
}
|
|
|
|
//export icon
|
|
if (elementExportIcon) {
|
|
console.log('Passed: Dashboard - My Standards California - Export icon is present');
|
|
} else {
|
|
errors.push('Expected: Dashboard - My Standards California - Export icon not found');
|
|
}
|
|
|
|
//more info icon tool-tip
|
|
if (elementMoreInfoIconTooltip === 'View Detail Information') {
|
|
console.log('Passed: Dashboard - My Standards California icon tool-tip text matched as expected');
|
|
} else {
|
|
errors.push(`Expected: ashboard - My Standards California: "View Detail Information"; Actual: "${elementMoreInfoIconTooltip}"`);
|
|
}
|
|
|
|
//view icon
|
|
if (elementViewIcon) {
|
|
console.log('Passed: Dashboard - My Standards California - View icon is present');
|
|
} else {
|
|
errors.push('Expected: Dashboard - My Standards California - View icon not found');
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Dashboard - My Standards = Florida
|
|
{
|
|
description: 'Validate Dashboard - My Standards Organization = Florida Standards text',
|
|
action: async () => {
|
|
const multipleChecks = 'My Standards Organization - Florida';
|
|
const element = await driver.findElement(By.css('#stdbody > tr:nth-child(4) > td:nth-child(1)'));
|
|
|
|
//Get text, font, color, and size
|
|
const elementText = await element.getText('');
|
|
const elementFont = await element.getCssValue('font-family');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
const elementColor = await element.getCssValue('color');
|
|
|
|
const elementExportIcon = await driver.findElement(By.css('#stdbody > tr:nth-child(4) > .text-center:nth-child(2) img'));
|
|
const elementMoreInfoIconTooltip = await driver.findElement(By.css('#stdbody > tr:nth-child(4) > td:nth-child(4) > a')).getAttribute('title');
|
|
const elementViewIcon = await driver.findElement(By.css('tr:nth-child(4) > .text-center:nth-child(5) img'));
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//text
|
|
if (elementText === 'Florida') {
|
|
console.log("Passed: Dashboard - My Standards Florida text matched as expected");
|
|
} else {
|
|
throw new Error(`Expected: Dashboard - My Standards text: "Florida"; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//font
|
|
if (elementFont === "Poppins, sans-serif") {
|
|
console.log('Passed: Dashboard - My Standards Florida text font-family matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard - My Standards Florida text font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
|
|
}
|
|
|
|
//size
|
|
if (elementSize === '14.3px') {
|
|
console.log('Passed: Dashboard - My Standards Florida text font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard - My Standards Florida text font-size "14.3px"; Actual: "${elementSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementColor === 'rgba(33, 37, 41, 1)') {
|
|
console.log('Passed: Dashboard - My Standards Florida text color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard - My Standards Florida text color: "rgba(33, 37, 41, 1)"; Actual: "${elementColor}"`);
|
|
}
|
|
|
|
//export icon
|
|
if (elementExportIcon) {
|
|
console.log('Passed: Dashboard - My Standards Florida - Export icon is present');
|
|
} else {
|
|
errors.push('Expected: Dashboard - My Standards Florida - Export icon not found');
|
|
}
|
|
|
|
//more info icon tool-tip
|
|
if (elementMoreInfoIconTooltip === 'View Detail Information') {
|
|
console.log('Passed: Dashboard - My Standards Florida icon tool-tip text matched as expected');
|
|
} else {
|
|
errors.push(`Expected: ashboard - My Standards Florida: "View Detail Information"; Actual: "${elementMoreInfoIconTooltip}"`);
|
|
}
|
|
|
|
//view icon
|
|
if (elementViewIcon) {
|
|
console.log('Passed: Dashboard - My Standards Florida - View icon is present');
|
|
} else {
|
|
errors.push('Expected: Dashboard - My Standards Florida - View icon not found');
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//NEXT ACTION
|
|
{
|
|
description: 'Dashboard - Click Alabama Export icon',
|
|
action: async () => {
|
|
await driver.findElement(By.css('#stdbody > tr:nth-child(1) > .text-center:nth-child(2) img')).click();
|
|
console.log('----->| NEXT ACTION: Clicked Alabama Export icon');
|
|
|
|
//Wait until the modal title is located AND visible
|
|
await driver.wait(async () => {
|
|
try {
|
|
const element = await driver.findElement(By.css('.modal-lg .modal-title'));
|
|
return await element.isDisplayed();
|
|
} catch (e) {
|
|
return false; //Element not ready yet, keep waiting
|
|
}
|
|
}, 20000, 'Modal did not become visible within 20 seconds');
|
|
|
|
console.log('Passed: DIV - Loaded successfully');
|
|
}
|
|
},
|
|
|
|
//EXPORT STANDARD DIV
|
|
//DIV - Export Standards title
|
|
{
|
|
description: 'Validate DIV - Export Standards title text, color, and size',
|
|
action: async () => {
|
|
const multipleChecks = 'DIV - Export Standards title';
|
|
const element = await driver.findElement(By.css('.modal-lg .modal-title'));
|
|
|
|
//Get text, font, color, and size
|
|
const elementText = await element.getText('');
|
|
const elementFont = await element.getCssValue('font-family');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
const elementColor = await element.getCssValue('color');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//text
|
|
if (elementText === 'Export Standards') {
|
|
console.log('Passed: DIV - Export Standards title matched as expected');
|
|
} else {
|
|
errors.push(`Expected: DIV - "Export Standards"; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//font
|
|
if (elementFont === "Poppins, sans-serif") {
|
|
console.log('Passed: DIV - Export Standards title text font-family matched as expected');
|
|
} else {
|
|
errors.push(`Expected: DIV - Export Standards title text font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
|
|
}
|
|
|
|
//size
|
|
if (elementSize === '18px') {
|
|
console.log('Passed: DIV - Export Standards title text font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: DIV - Export Standards title text font-size "18px"; Actual: "${elementSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementColor === 'rgba(40, 39, 90, 1)') {
|
|
console.log('Passed: DIV - Export Standards title text color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: DIV - Export Standards title text color "rgba(40, 39, 90, 1)"'; Actual: "${elementColor}"`);
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//DIV - Alabama sub-title
|
|
{
|
|
description: 'Validate DIV - Alabama sub-title text, color, and size',
|
|
action: async () => {
|
|
const multipleChecks = 'DIV - Alabama sub-title';
|
|
const element = await driver.findElement(By.css('p > b'));
|
|
|
|
//Get text, font, color, and size
|
|
const elementText = await element.getText('');
|
|
const elementFont = await element.getCssValue('font-family');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
const elementColor = await element.getCssValue('color');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//text
|
|
if (elementText === 'Alabama') {
|
|
console.log('Passed: DIV - Alabama sub-title matched as expected');
|
|
} else {
|
|
errors.push(`Expected: DIV - sub-title "Alabama"; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//font
|
|
if (elementFont === "Poppins, sans-serif") {
|
|
console.log('Passed: DIV - Alabama sub-title text font-family matched as expected');
|
|
} else {
|
|
errors.push(`Expected: DIV - Alabama sub-title text font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
|
|
}
|
|
|
|
//size
|
|
if (elementSize === '13px') {
|
|
console.log('Passed: DIV - Alabama sub-title text font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: DIV - Alabama sub-title text font-size "13px"; Actual: "${elementSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementColor === 'rgba(40, 39, 90, 1)') {
|
|
console.log('Passed: DIV - Alabama sub-title text color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: DIV - Alabama sub-title text color "rgba(40, 39, 90, 1)"'; Actual: "${elementColor}"`);
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//DIV - Alabama Standards Subject label
|
|
{
|
|
description: 'Validate DIV - Alabama Standards Subject label text, color, and size',
|
|
action: async () => {
|
|
const multipleChecks = 'DIV - Alabama Standards Subject label';
|
|
const element = await driver.findElement(By.css('.form-row:nth-child(2) > .form-group:nth-child(1) > label'));
|
|
|
|
//Get text, font, color, and size
|
|
const elementText = await element.getText('');
|
|
const elementFont = await element.getCssValue('font-family');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
const elementColor = await element.getCssValue('color');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//text
|
|
if (elementText === 'Subject') {
|
|
console.log('Passed: DIV - Alabama Standards Subject label matched as expected');
|
|
} else {
|
|
errors.push(`Expected: DIV - "Subject" label; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//font
|
|
if (elementFont === "Poppins, sans-serif") {
|
|
console.log('Passed: DIV - Alabama Standards Subject label text font-family matched as expected');
|
|
} else {
|
|
errors.push(`Expected: DIV - Alabama Standards Subject label text font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
|
|
}
|
|
|
|
//size
|
|
if (elementSize === '15px') {
|
|
console.log('Passed: DIV - Alabama Standards Subject label text font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: DIV - Alabama Standards Subject label text font-size "15px"; Actual: "${elementSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementColor === 'rgba(40, 39, 90, 1)') {
|
|
console.log('Passed: DIV - Alabama Standards Subject label text color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: DIV - Alabama Standards Subject label text color "rgba(40, 39, 90, 1)"'; Actual: "${elementColor}"`);
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//DIV - Subject dropdown {custom-select}
|
|
{
|
|
description: 'Validate DIV - Subject dropdown list and value',
|
|
action: async () => {
|
|
const multipleChecks = 'DIV - Subject dropdown';
|
|
const elementDropdown = await driver.findElement(By.css('#exsubject'));
|
|
const selectedOption = await elementDropdown.findElement(By.css('option:checked'));
|
|
|
|
const elementText = await selectedOption.getText();
|
|
const elementFont = await selectedOption.getCssValue('font-family');
|
|
const elementSize = await selectedOption.getCssValue('font-size');
|
|
const elementColor = await selectedOption.getCssValue('color');
|
|
|
|
const options = await elementDropdown.findElements(By.css('option'));
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//text
|
|
if (elementText === 'Choose a subject') {
|
|
console.log('Passed: DIV - Subject dropdown text matched as expected');
|
|
} else {
|
|
throw new Error(`Expected: DIV - Subject: "Choose a subject"; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//font
|
|
if (elementFont === "Poppins, sans-serif") {
|
|
console.log('Passed: DIV - Subject dropdown font-family matched as expected');
|
|
} else {
|
|
errors.push(`Expected: DIV - Subject dropdown font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
|
|
}
|
|
|
|
//size
|
|
if (elementSize === '13px') {
|
|
console.log('Passed: DIV - Subject dropdown font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: DIV - Subject dropdown font-size "13px"; Actual: "${elementSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementColor === 'rgba(40, 39, 90, 1)') {
|
|
console.log('Passed: DIV - Subject dropdown color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: DIV - Subject dropdown color: "rgba(40, 39, 90, 1)"; Actual: "${elementColor}"`);
|
|
}
|
|
|
|
const expectedList = [
|
|
'Choose a subject',
|
|
'Health and PE',
|
|
'Language Arts',
|
|
'Mathematics',
|
|
'Science',
|
|
'Social Studies',
|
|
'Technology Education'
|
|
];
|
|
|
|
const actual = [];
|
|
|
|
for (const opt of options) {
|
|
const text = (await opt.getText()).trim();
|
|
actual.push(text);
|
|
}
|
|
|
|
if (JSON.stringify(actual) === JSON.stringify(expectedList)) {
|
|
console.log('Passed: DIV - Subject Dropdown list matched as expected');
|
|
} else {
|
|
errors.push(`Expected: DIV - Subject Dropdown list: ${JSON.stringify(expectedList)}, Actual: ${JSON.stringify(actual)}`);
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//DIV - Alabama Standards Format label
|
|
{
|
|
description: 'Validate DIV - Alabama Standards Format label text, color, and size',
|
|
action: async () => {
|
|
const multipleChecks = 'DIV - Alabama Standards Format label';
|
|
const element = await driver.findElement(By.css('.form-row:nth-child(2) > .form-group:nth-child(2) > label'));
|
|
|
|
//Get text, font, color, and size
|
|
const elementText = await element.getText('');
|
|
const elementFont = await element.getCssValue('font-family');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
const elementColor = await element.getCssValue('color');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//text
|
|
if (elementText === 'Format') {
|
|
console.log('Passed: DIV - Alabama Standards Format label matched as expected');
|
|
} else {
|
|
errors.push(`Expected: DIV - "Format" label; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//font
|
|
if (elementFont === "Poppins, sans-serif") {
|
|
console.log('Passed: DIV - Alabama Standards Format label font-family matched as expected');
|
|
} else {
|
|
errors.push(`Expected: DIV - Alabama Standards Format label font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
|
|
}
|
|
|
|
//size
|
|
if (elementSize === '15px') {
|
|
console.log('Passed: DIV - Alabama Standards Format label text font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: DIV - Alabama Standards Format label text font-size "15px"; Actual: "${elementSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementColor === 'rgba(40, 39, 90, 1)') {
|
|
console.log('Passed: DIV - Alabama Standards Format label text color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: DIV - Alabama Standards Format label text color "rgba(40, 39, 90, 1)"'; Actual: "${elementColor}"`);
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//DIV - Format dropdown
|
|
{
|
|
description: 'Validate DIV - Format dropdown list and value',
|
|
action: async () => {
|
|
const multipleChecks = 'DIV - Format dropdown';
|
|
const elementDropdown = await driver.findElement(By.css('#exformat'));
|
|
const selectedOption = await elementDropdown.findElement(By.css('option:checked'));
|
|
|
|
const elementText = await selectedOption.getText();
|
|
const elementFont = await selectedOption.getCssValue('font-family');
|
|
const elementSize = await selectedOption.getCssValue('font-size');
|
|
const elementColor = await selectedOption.getCssValue('color');
|
|
|
|
const options = await elementDropdown.findElements(By.css('option'));
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//text
|
|
if (elementText === 'CSV') {
|
|
console.log('Passed: DIV - Format dropdown text matched as expected');
|
|
} else {
|
|
throw new Error(`Expected: DIV - Format: "CSV"; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//font
|
|
if (elementFont === "Poppins, sans-serif") {
|
|
console.log('Passed: DIV - Format dropdown font-family matched as expected');
|
|
} else {
|
|
errors.push(`Expected: DIV - Format dropdown font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
|
|
}
|
|
|
|
//size
|
|
if (elementSize === '13px') {
|
|
console.log('Passed: DIV - Format dropdown font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: DIV - Format dropdown font-size "13px"; Actual: "${elementSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementColor === 'rgba(40, 39, 90, 1)') {
|
|
console.log('Passed: DIV - Format dropdown color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: DIV - Format dropdown color: "rgba(40, 39, 90, 1)"; Actual: "${elementColor}"`);
|
|
}
|
|
|
|
const expectedList = [
|
|
'CSV',
|
|
'JSON'
|
|
];
|
|
|
|
const actual = [];
|
|
|
|
for (const opt of options) {
|
|
const text = (await opt.getText()).trim();
|
|
actual.push(text);
|
|
}
|
|
|
|
if (JSON.stringify(actual) === JSON.stringify(expectedList)) {
|
|
console.log('Passed: DIV - Format Dropdown list matched as expected');
|
|
} else {
|
|
errors.push(`Expected: DIV - Format Dropdown list: ${JSON.stringify(expectedList)}, Actual: ${JSON.stringify(actual)}`);
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//DIV - Grades label
|
|
{
|
|
description: 'Validate DIV - Grades label text, color, and size',
|
|
action: async () => {
|
|
const multipleChecks = 'DIV - Grades label';
|
|
const element = await driver.findElement(By.css('.col-md-12:nth-child(1) > label'));
|
|
|
|
//Get text, font, color, and size
|
|
const elementText = await element.getText('');
|
|
const elementFont = await element.getCssValue('font-family');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
const elementColor = await element.getCssValue('color');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//text
|
|
if (elementText === 'Grades') {
|
|
console.log('Passed: DIV - Grades label matched as expected');
|
|
} else {
|
|
errors.push(`Expected: DIV - "Grades" label; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//font
|
|
if (elementFont === "Poppins, sans-serif") {
|
|
console.log('Passed: DIV - Grades label font-family matched as expected');
|
|
} else {
|
|
errors.push(`Expected: DIV - Grades label font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
|
|
}
|
|
|
|
//size
|
|
if (elementSize === '15px') {
|
|
console.log('Passed: DIV - Grades label text font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: DIV - Grades label text font-size "15px"; Actual: "${elementSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementColor === 'rgba(40, 39, 90, 1)') {
|
|
console.log('Passed: DIV - Grades label text color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: DIV - Grades label text color "rgba(40, 39, 90, 1)"'; Actual: "${elementColor}"`);
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//DIV - Grades dropdown
|
|
{
|
|
description: 'Validate DIV - Grades dropdown list and value',
|
|
action: async () => {
|
|
const multipleChecks = 'DIV - Grades dropdown';
|
|
const elementDropdown = await driver.findElement(By.css('#exgrades'));
|
|
|
|
const elementText = await elementDropdown.getText();
|
|
const elementFont = await elementDropdown.getCssValue('font-family');
|
|
const elementSize = await elementDropdown.getCssValue('font-size');
|
|
const elementColor = await elementDropdown.getCssValue('color');
|
|
|
|
const options = await elementDropdown.findElements(By.css('option'));
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//text
|
|
if (elementText === 'Please select a subject first') {
|
|
console.log('Passed: DIV - Grades dropdown text matched as expected');
|
|
} else {
|
|
throw new Error(`Expected: DIV - Grades: "Please select a subject first"; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//font
|
|
if (elementFont === "Poppins, sans-serif") {
|
|
console.log('Passed: DIV - Grades dropdown font-family matched as expected');
|
|
} else {
|
|
errors.push(`Expected: DIV - Grades dropdown font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
|
|
}
|
|
|
|
//size
|
|
if (elementSize === '14px') {
|
|
console.log('Passed: DIV - Grades dropdown font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: DIV - Grades dropdown font-size "14px"; Actual: "${elementSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementColor === 'rgba(40, 39, 90, 1)') {
|
|
console.log('Passed: DIV - Grades dropdown color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: DIV - Grades dropdown color: "rgba(40, 39, 90, 1)"; Actual: "${elementColor}"`);
|
|
}
|
|
|
|
const expectedList = [
|
|
'Please select a subject first'
|
|
];
|
|
|
|
const actual = [];
|
|
|
|
for (const opt of options) {
|
|
const text = (await opt.getText()).trim();
|
|
actual.push(text);
|
|
}
|
|
|
|
if (JSON.stringify(actual) === JSON.stringify(expectedList)) {
|
|
console.log('Passed: DIV - Grades Dropdown list matched as expected');
|
|
} else {
|
|
errors.push(`Expected: DIV - Grades Dropdown list: ${JSON.stringify(expectedList)}, Actual: ${JSON.stringify(actual)}`);
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//DIV - Download button
|
|
{
|
|
description: 'Validate DIV - Download button icon, text, and color',
|
|
action: async () => {
|
|
const multipleChecks = 'DIV - Download button';
|
|
const elementIcon = await driver.findElement(By.css('#exsubmit > .fa'));
|
|
const element = await driver.findElement(By.css('#exsubmit'));
|
|
|
|
//Get text, font, color, and size
|
|
const elementText = await element.getText('');
|
|
const elementFont = await element.getCssValue('font-family');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
const elementColor = await element.getCssValue('color');
|
|
const elementButtonColor = await element.getCssValue('background-color');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//icon
|
|
if (elementIcon) {
|
|
console.log('Passed: DIV - Download button icon is present');
|
|
} else {
|
|
errors.push('DIV - Download button icon was not found');
|
|
}
|
|
|
|
//text
|
|
if (elementText === 'Download') {
|
|
console.log('Passed: DIV - Download button text matched as expected');
|
|
} else {
|
|
errors.push(`Expected: DIV - Button text: "Download"; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//font
|
|
if (elementFont === "Poppins, sans-serif") {
|
|
console.log('Passed: DIV - Download button text font-family matched as expected');
|
|
} else {
|
|
errors.push(`Expected: DIV - Download button text font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
|
|
}
|
|
|
|
//size
|
|
if (elementSize === '16px') {
|
|
console.log('Passed: DIV - Download button text font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: DIV - Download button text font-size "16px"; Actual: "${elementSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementColor === 'rgba(255, 255, 255, 1)') {
|
|
console.log('Passed: DIV - Download button text color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: DIV - Download button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementColor}"`);
|
|
}
|
|
|
|
//button color
|
|
if (elementButtonColor === 'rgba(48, 200, 172, 1)') {
|
|
console.log('Passed: DIV - Download button background color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: DIV - Download button background color: "rgba(48, 200, 172, 1)"; Actual: "${elementButtonColor}"`);
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//DIV - Close button
|
|
{
|
|
description: 'Validate DIV - Close button text, style, font, and color',
|
|
action: async () => {
|
|
const multipleChecks = 'DIV - Close button';
|
|
const element = await driver.findElement(By.css('#modalclose'));
|
|
|
|
//Get text, font, color, and size
|
|
const elementText = await element.getText('');
|
|
const elementFont = await element.getCssValue('font-family');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
const elementColor = await element.getCssValue('color');
|
|
const elementButtonColor = await element.getCssValue('background-color');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//text
|
|
if (elementText === 'Close') {
|
|
console.log('Passed: DIV - Close button text matched as expected');
|
|
} else {
|
|
errors.push(`Expected: DIV - Button text: "Close"; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//font
|
|
if (elementFont === "Poppins, sans-serif") {
|
|
console.log('Passed: DIV - Close button text font-family matched as expected');
|
|
} else {
|
|
errors.push(`Expected: DIV - Close button text font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
|
|
}
|
|
|
|
//size
|
|
if (elementSize === '16px') {
|
|
console.log('Passed: DIV - Close button text font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: DIV - Close button text font-size "16px"; Actual: "${elementSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementColor === 'rgba(40, 39, 90, 1)') {
|
|
console.log('Passed: DIV - Close button text color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: DIV - Close button text color: "rgba(40, 39, 90, 1)"; Actual: "${elementColor}"`);
|
|
}
|
|
|
|
//button color
|
|
if (elementButtonColor === 'rgba(0, 0, 0, 0)') {
|
|
console.log('Passed: DIV - Close button background color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: DIV - Close button background color: "rgba(0, 0, 0, 0)"; Actual: "${elementButtonColor}"`);
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//NEXT ACTION
|
|
{
|
|
description: 'DIV - Click Export button',
|
|
action: async () => {
|
|
await driver.findElement(By.css('#exsubmit')).click();
|
|
console.log('----->| NEXT ACTION: Clicked Export button');
|
|
|
|
//Wait until the modal title is located AND visible
|
|
await driver.wait(async () => {
|
|
try {
|
|
const element = await driver.findElement(By.css('#metawarn > b'));
|
|
return await element.isDisplayed();
|
|
} catch (e) {
|
|
return false; //Element not ready yet, keep waiting
|
|
}
|
|
}, 20000, 'Validation text not visible within 20 seconds');
|
|
|
|
console.log('Passed: DIV - Validation message appeared');
|
|
}
|
|
},
|
|
|
|
//DIV - Validation
|
|
{
|
|
description: 'Validate DIV - Validation text, color, and size',
|
|
action: async () => {
|
|
const element = await driver.findElement(By.css('#metawarn > b'));
|
|
|
|
//Get text, color, and size
|
|
const elementText = await element.getText('');
|
|
const elementFont = await element.getCssValue('font-family');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
const elementColor = await element.getCssValue('color')
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//text
|
|
if (elementText === 'A subject and at least one grade must be selected.') {
|
|
console.log('Passed: DIV - Validation text matched as expected');
|
|
} else {
|
|
errors.push(`Expected: DIV - Validation text: "A subject and at least one grade must be selected."; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//font
|
|
if (elementFont === "Poppins, sans-serif") {
|
|
console.log('Passed: DIV - Validation text font-family matched as expected');
|
|
} else {
|
|
errors.push(`Expected: DIV - Validation text font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
|
|
}
|
|
|
|
//size
|
|
if (elementSize === '13px') {
|
|
console.log('Passed: DIV - Validation text font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: DIV - Validation text font-size "13px"; Actual: "${elementSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementColor === 'rgba(220, 53, 69, 1)') {
|
|
console.log('Passed: DIV - Validation text color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: DIV - Validation text color: "rgba(220, 53, 69, 1)"; Actual: "${elementColor}"`);
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift('Multiple validation checks did not pass');
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//NEXT ACTION
|
|
{
|
|
description: 'Select subject and grade',
|
|
action: async () => {
|
|
//Select "Mathematics" from dropdown
|
|
await driver.findElement(By.css('#exsubject')).click();
|
|
await driver.sleep(2000);
|
|
await driver.findElement(By.css('#exsubject > option:nth-child(4)')).click();
|
|
console.log('----->| NEXT ACTION: Selected Subject - Mathematics');
|
|
|
|
//Wait for the X clear icon (Select2 uses this class)
|
|
const clearGradesIcon = await driver.wait(
|
|
until.elementLocated(By.css('#exgrades + span .select2-selection__clear')),
|
|
20000
|
|
);
|
|
|
|
//Wait until visible
|
|
await driver.wait(
|
|
until.elementIsVisible(clearGradesIcon),
|
|
20000
|
|
);
|
|
|
|
//Click to clear grades
|
|
await clearGradesIcon.click();
|
|
await driver.sleep(1000);
|
|
console.log('----->| NEXT ACTION: Clicked Grades X clear icon');
|
|
|
|
await driver.findElement(By.xpath("//li[contains(text(), '9')]")).click();
|
|
await driver.sleep(1000);
|
|
|
|
await driver.findElement(By.xpath("//li[contains(text(), '10')]")).click();
|
|
await driver.sleep(1000);
|
|
|
|
await driver.findElement(By.xpath("//li[contains(text(), '11')]")).click();
|
|
await driver.sleep(1000);
|
|
|
|
await driver.findElement(By.xpath("//li[contains(text(), '12')]")).click();
|
|
await driver.sleep(1000);
|
|
|
|
//Click away from dropdown list
|
|
await driver.findElement(By.css('#exform > div:nth-child(3) > div > span')).click();
|
|
await driver.sleep(1000);
|
|
|
|
console.log('----->| NEXT ACTION: Selected grades: 9, 10, 11, and 12');
|
|
},
|
|
},
|
|
|
|
//DIV - Grade 9
|
|
{
|
|
description: 'Validate DIV - Grade 9',
|
|
action: async () => {
|
|
const multipleChecks = 'DIV - Grade 9';
|
|
const elementIconToolTip = await driver.findElement(By.css('#select2-exgrades-container > li:nth-child(1) > button')).getAttribute('title');
|
|
const element = await driver.findElement(By.css('#select2-exgrades-container > li:nth-child(1)'));
|
|
|
|
const elementText = await element.getText();
|
|
const elementToolTip = await element.getAttribute('title');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//icon tool-tip
|
|
if (elementIconToolTip === 'Remove item') {
|
|
console.log('Passed: DIV - Grade 9 icon tool-tip text matched as expected');
|
|
} else {
|
|
errors.push(`Expected: DIV - Grade 9 icon tool-tip text: "Remove item"; Actual: "${elementIconToolTip}"`);
|
|
}
|
|
|
|
//text
|
|
if (elementText.includes('9')) {
|
|
console.log('Passed: DIV - Grades selection included "9" text matched as expected');
|
|
} else {
|
|
throw new Error(`Expected: DIV - Grades selection: "9"; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//tool-tip
|
|
if (elementToolTip === '9') {
|
|
console.log('Passed: DIV - Grade 9 tool-tip text matched as expected');
|
|
} else {
|
|
errors.push(`Expected: DIV - Grade 9 tool-tip text: "9"; Actual: "${elementToolTip}"`);
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//DIV - Grade 10
|
|
{
|
|
description: 'Validate DIV - Grade 10',
|
|
action: async () => {
|
|
const multipleChecks = 'DIV - Grade 10';
|
|
const elementIconToolTip = await driver.findElement(By.css('#select2-exgrades-container > li:nth-child(2) > button')).getAttribute('title');
|
|
const element = await driver.findElement(By.css('#select2-exgrades-container > li:nth-child(2)'));
|
|
|
|
const elementText = await element.getText();
|
|
const elementToolTip = await element.getAttribute('title');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//icon tool-tip
|
|
if (elementIconToolTip === 'Remove item') {
|
|
console.log('Passed: DIV - Grade 10 icon tool-tip text matched as expected');
|
|
} else {
|
|
errors.push(`Expected: DIV - Grade 10 icon tool-tip text: "Remove item"; Actual: "${elementIconToolTip}"`);
|
|
}
|
|
|
|
//text
|
|
if (elementText.includes('10')) {
|
|
console.log('Passed: DIV - Grades selection included "10" text matched as expected');
|
|
} else {
|
|
throw new Error(`Expected: DIV - Grades selection: "10"; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//tool-tip
|
|
if (elementToolTip === '10') {
|
|
console.log('Passed: DIV - Grade 10 tool-tip text matched as expected');
|
|
} else {
|
|
errors.push(`Expected: DIV - Grade 10 tool-tip text: "9"; Actual: "${elementToolTip}"`);
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//DIV - Grade 11
|
|
{
|
|
description: 'Validate DIV - Grade 11',
|
|
action: async () => {
|
|
const multipleChecks = 'DIV - Grade 11';
|
|
const elementIconToolTip = await driver.findElement(By.css('#select2-exgrades-container > li:nth-child(3) > button')).getAttribute('title');
|
|
const element = await driver.findElement(By.css('#select2-exgrades-container > li:nth-child(3)'));
|
|
|
|
const elementText = await element.getText();
|
|
const elementToolTip = await element.getAttribute('title');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//icon tool-tip
|
|
if (elementIconToolTip === 'Remove item') {
|
|
console.log('Passed: DIV - Grade 11 icon tool-tip text matched as expected');
|
|
} else {
|
|
errors.push(`Expected: DIV - Grade 11 icon tool-tip text: "Remove item"; Actual: "${elementIconToolTip}"`);
|
|
}
|
|
|
|
//text
|
|
if (elementText.includes('11')) {
|
|
console.log('Passed: DIV - Grades selection included "11" text matched as expected');
|
|
} else {
|
|
throw new Error(`Expected: DIV - Grades selection: "11"; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//tool-tip
|
|
if (elementToolTip === '11') {
|
|
console.log('Passed: DIV - Grade 11 tool-tip text matched as expected');
|
|
} else {
|
|
errors.push(`Expected: DIV - Grade 11 tool-tip text: "9"; Actual: "${elementToolTip}"`);
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//DIV - Grade 12
|
|
{
|
|
description: 'Validate DIV - Grade 12',
|
|
action: async () => {
|
|
const multipleChecks = 'DIV - Grade 12';
|
|
const elementIconToolTip = await driver.findElement(By.css('#select2-exgrades-container > li:nth-child(4) > button')).getAttribute('title');
|
|
const element = await driver.findElement(By.css('#select2-exgrades-container > li:nth-child(4)'));
|
|
|
|
const elementText = await element.getText();
|
|
const elementToolTip = await element.getAttribute('title');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//icon tool-tip
|
|
if (elementIconToolTip === 'Remove item') {
|
|
console.log('Passed: DIV - Grade 12 icon tool-tip text matched as expected');
|
|
} else {
|
|
errors.push(`Expected: DIV - Grade 12 icon tool-tip text: "Remove item"; Actual: "${elementIconToolTip}"`);
|
|
}
|
|
|
|
//text
|
|
if (elementText.includes('12')) {
|
|
console.log('Passed: DIV - Grades selection included "12" text matched as expected');
|
|
} else {
|
|
throw new Error(`Expected: DIV - Grades selection: "12"; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//tool-tip
|
|
if (elementToolTip === '12') {
|
|
console.log('Passed: DIV - Grade 12 tool-tip text matched as expected');
|
|
} else {
|
|
errors.push(`Expected: DIV - Grade 12 tool-tip text: "9"; Actual: "${elementToolTip}"`);
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//NEXT ACTION
|
|
{
|
|
description: 'DIV - Click Export button then Close DIV',
|
|
action: async () => {
|
|
const multipleChecks = 'DIV - Processing status';
|
|
|
|
const errors = [];
|
|
|
|
//Capture styles immediately via executeScript BEFORE clicking
|
|
//This sets up a MutationObserver to catch the spinner the moment it appears
|
|
await driver.executeScript(`
|
|
window._spinnerStyles = null;
|
|
const observer = new MutationObserver(() => {
|
|
const el = document.querySelector('#modalspin strong');
|
|
if (el) {
|
|
const style = window.getComputedStyle(el);
|
|
const spinDiv = document.querySelector('#modalspin');
|
|
const spinStyle = window.getComputedStyle(spinDiv);
|
|
if (spinStyle.display !== 'none') {
|
|
window._spinnerStyles = {
|
|
text: el.textContent.trim(),
|
|
fontFamily: style.getPropertyValue('font-family'),
|
|
fontSize: style.getPropertyValue('font-size'),
|
|
color: style.getPropertyValue('color')
|
|
};
|
|
observer.disconnect();
|
|
}
|
|
}
|
|
});
|
|
observer.observe(document.querySelector('#modalspin'), {
|
|
attributes: true,
|
|
attributeFilter: ['style']
|
|
});
|
|
`);
|
|
|
|
//Now click Export
|
|
await driver.findElement(By.css('#exsubmit')).click();
|
|
console.log('----->| NEXT ACTION: Clicked Export button');
|
|
|
|
//Wait for MutationObserver to capture the styles
|
|
await driver.wait(async () => {
|
|
const captured = await driver.executeScript(`return window._spinnerStyles !== null;`);
|
|
return captured;
|
|
}, 15000, 'Processing spinner styles were not captured within 15 seconds');
|
|
|
|
//Get the captured styles
|
|
const styles = await driver.executeScript(`return window._spinnerStyles;`);
|
|
//console.log('----->| DEBUG captured styles:', JSON.stringify(styles));
|
|
|
|
//text
|
|
if (styles.text === 'Processing...') {
|
|
console.log('Passed: DIV - Status text matched as expected');
|
|
} else {
|
|
errors.push(`Expected: DIV - Status text: "Processing..."; Actual: "${styles.text}"`);
|
|
}
|
|
|
|
//font
|
|
if (styles.fontFamily === 'Poppins, sans-serif') {
|
|
console.log('Passed: DIV - Processing... status text font-family matched as expected');
|
|
} else {
|
|
errors.push(`Expected: DIV - Processing... status text font-family "Poppins, sans-serif"; Actual: "${styles.fontFamily}"`);
|
|
}
|
|
|
|
//size
|
|
if (styles.fontSize === '23.4px') {
|
|
console.log('Passed: DIV - Processing... status text font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: DIV - Processing... status text font-size "23.4px"; Actual: "${styles.fontSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (styles.color === 'rgb(40, 39, 90)') {
|
|
console.log('Passed: DIV - Processing... status text color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: DIV - Processing... status text color "rgb(40, 39, 90)"; Actual: "${styles.color}"`);
|
|
}
|
|
|
|
//Wait until processing is complete
|
|
await driver.wait(async () => {
|
|
try {
|
|
const spinDiv = await driver.findElement(By.css('#modalspin'));
|
|
return !(await spinDiv.isDisplayed());
|
|
} catch (e) {
|
|
return true;
|
|
}
|
|
}, 30000, 'Processing... Status did not disappear within 30 seconds');
|
|
console.log('Passed: Processing... Status is no longer visible as expected');
|
|
|
|
await driver.findElement(By.css('#modalclose')).click();
|
|
console.log('----->| NEXT ACTION: Clicked Close button');
|
|
|
|
//Wait for page to load completely
|
|
await driver.wait(async () => {
|
|
const readyState = await driver.executeScript('return document.readyState');
|
|
return readyState === 'complete';
|
|
}, 20000, 'ExACT Dashboard did not fully load within 60 seconds');
|
|
console.log('Passed: ExACT Dashboard loaded successfully');
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//NEXT ACTION
|
|
{
|
|
description: 'Dashboard - Click Alabama More Info icon',
|
|
action: async () => {
|
|
await driver.findElement(By.css('#stdbody > tr:nth-child(1) > .text-center:nth-child(4) img')).click();
|
|
console.log('----->| NEXT ACTION: Clicked Alabama More Info icon');
|
|
|
|
//Wait until the modal title is located AND visible
|
|
await driver.wait(async () => {
|
|
try {
|
|
const element = await driver.findElement(By.css('.modal-lg .modal-title'));
|
|
return await element.isDisplayed();
|
|
} catch (e) {
|
|
return false; //Element not ready yet, keep waiting
|
|
}
|
|
}, 20000, 'Modal did not become visible within 20 seconds');
|
|
|
|
console.log('Passed: DIV - Loaded successfully');
|
|
}
|
|
},
|
|
|
|
//Alabama Courses of Study DIV
|
|
//DIV - Alabama Courses of Study title
|
|
{
|
|
description: 'Validate DIV - Alabama Courses of Study title text, color, and size',
|
|
action: async () => {
|
|
const multipleChecks = 'DIV - Alabama Courses of Study title';
|
|
const element = await driver.findElement(By.css('.modal-lg .modal-title'));
|
|
|
|
//Get text, font, size, and color
|
|
const elementText = await element.getText('');
|
|
const elementFont = await element.getCssValue('font-family');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
const elementColor = await element.getCssValue('color')
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//text
|
|
if (elementText === 'Alabama Courses of Study') {
|
|
console.log('Passed: DIV - Alabama Courses of Study title matched as expected');
|
|
} else {
|
|
errors.push(`Expected: DIV - "Alabama Courses of Study"; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//font
|
|
if (elementFont === "Poppins, sans-serif") {
|
|
console.log('Passed: DIV - Alabama Courses of Study title font-family matched as expected');
|
|
} else {
|
|
errors.push(`Expected: DIV - Alabama Courses of Study title font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
|
|
}
|
|
|
|
//size
|
|
if (elementSize === '18px') {
|
|
console.log('Passed: DIV - Alabama Courses of Study title text font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: DIV - Alabama Courses of Study title text font-size "18px"; Actual: "${elementSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementColor === 'rgba(40, 39, 90, 1)') {
|
|
console.log('Passed: DIV - Alabama Courses of Study title text color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: DIV - Alabama Courses of Study title text color "rgba(40, 39, 90, 1)"'; Actual: "${elementColor}"`);
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//DIV - More Info Alabama sub-text
|
|
{
|
|
description: 'Validate DIV - More Info Alabma sub-text, color, and size',
|
|
action: async () => {
|
|
const multipleChecks = 'DIV - Alabama sut-text';
|
|
const element = await driver.findElement(By.css('.modal-body > .notenabled'));
|
|
|
|
//Get text, font, size, and color
|
|
const elementText = await element.getText('');
|
|
const elementFont = await element.getCssValue('font-family');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
const elementColor = await element.getCssValue('color')
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//text
|
|
if (elementText === '*Not enabled in Profile. If you would like access to any of these standards sets, please Contact Us.') {
|
|
console.log('Passed: DIV - More Info Arizona sub-text matched as expected');
|
|
} else {
|
|
errors.push(`Expected: DIV - sub-text "*Not enabled in Profile. If you would like access to any of these standards sets, please Contact Us."; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//font
|
|
if (elementFont === "Poppins, sans-serif") {
|
|
console.log('Passed: DIV - More Info Arizona sub-text font-family matched as expected');
|
|
} else {
|
|
errors.push(`Expected: DIV - More Info Arizona sub-text font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
|
|
}
|
|
|
|
//size
|
|
if (elementSize === '11.7px') {
|
|
console.log('Passed: DIV - More Info Arizona sub-text text font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: DIV - More Info Arizona sub-text text font-size "11.7px"; Actual: "${elementSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementColor === 'rgba(119, 119, 119, 1)') {
|
|
console.log('Passed: DIV - More Info Arizona sub-text color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: DIV - More Info Arizona sub-text text color "rgba(119, 119, 119, 1)"'; Actual: "${elementColor}"`);
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//DIV - More Info Alabama Contact Us link
|
|
{
|
|
description: 'Validate DIV - More Info Alabama Contact Us link text, color, and size',
|
|
action: async () => {
|
|
const multipleChecks = 'DIV - Alabama Courses of Study Contact Us link';
|
|
const element = await driver.findElement(By.linkText('Contact Us'));
|
|
|
|
//Get text, font, size, color, url
|
|
const elementText = await element.getText('');
|
|
const elementFont = await element.getCssValue('font-family');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
const elementColor = await element.getCssValue('color');
|
|
const elementURL = await element.getAttribute('href');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//text
|
|
if (elementText === 'Contact Us') {
|
|
console.log('Passed: DIV - More Info Alabama sub-text matched as expected');
|
|
} else {
|
|
errors.push(`Expected: DIV - More Info Alabama sub-text "Contact Us"; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//font
|
|
if (elementFont === 'Poppins, sans-serif') {
|
|
console.log('Passed: DIV - More Info Alabama sub-text font-family matched as expected');
|
|
} else {
|
|
errors.push(`Expected: DIV - More Info Alabama sub-text font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
|
|
}
|
|
|
|
//size
|
|
if (elementSize === '11.7px') {
|
|
console.log('Passed: DIV - More Info Alabama Contact Us link text font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: DIV - More Info Alabama Contact Us link text font-size "11.7px"; Actual: "${elementSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementColor === 'rgba(48, 200, 172, 1)') {
|
|
console.log('Passed: DIV - More Info Alabama Contact Us link text color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: DIV - More Info Alabama Contact Us link text color "rgba(48, 200, 172, 1)"'; Actual: "${elementColor}"`);
|
|
}
|
|
|
|
//url
|
|
if (elementURL === 'https://edgate.com/contact-us') {
|
|
console.log('Passed: DIV - More Info Alabama Contact Us URL link matched as expected');
|
|
} else {
|
|
errors.push(`Expected: DIV - More Info Alabama Contact Us URL: "https://edgate.com/contact-us"; Actual: "${elementURL}"`);
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//DIV - More Info Alabama Subject column title
|
|
{
|
|
description: 'Validate DIV - More Info Alabama Subject column title text, color, and size',
|
|
action: async () => {
|
|
const multipleChecks = 'DIV - Alabama Courses of Study column title';
|
|
const element = await driver.findElement(By.css('#myModal > div > div > div.modal-body > table > thead > tr > th:nth-child(1)'));
|
|
|
|
//Get text, font, size, and color
|
|
const elementText = await element.getText('');
|
|
const elementFont = await element.getCssValue('font-family');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
const elementColor = await element.getCssValue('color')
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//text
|
|
if (elementText === 'Subject') {
|
|
console.log('Passed: DIV - More Info Arizona Subject column title text matched as expected');
|
|
} else {
|
|
errors.push(`Expected: DIV - Arizona column title "Subject"; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//font
|
|
if (elementFont === 'Poppins, sans-serif') {
|
|
console.log('Passed: DIV - More Info Arizona Subject column title font-family matched as expected');
|
|
} else {
|
|
errors.push(`Expected: DIV - More Info Arizona Subject column title font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
|
|
}
|
|
|
|
//size
|
|
if (elementSize === '14px') {
|
|
console.log('Passed: DIV - More Info Arizona Subject column title text font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: DIV - More Info Arizona Subject column title text font-size "14px"; Actual: "${elementSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementColor === 'rgba(94, 105, 116, 1)') {
|
|
console.log('Passed: DIV - More Info Arizona Subject column title text color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: DIV - More Info Arizona Subject column title text color "rgba(94, 105, 116, 1)"'; Actual: "${elementColor}"`);
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//DIV - More Info Alabama Adopted column title
|
|
{
|
|
description: 'Validate DIV - More Info Alabama Adopted column title text, color, and size',
|
|
action: async () => {
|
|
const multipleChecks = 'DIV - Alabama Courses of Study Adopted column title';
|
|
const element = await driver.findElement(By.css('#myModal > div > div > div.modal-body > table > thead > tr > th:nth-child(2)'));
|
|
|
|
//Get text, font, size, and color
|
|
const elementText = await element.getText('');
|
|
const elementFont = await element.getCssValue('font-family');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
const elementColor = await element.getCssValue('color')
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//text
|
|
if (elementText === 'Adopted') {
|
|
console.log('Passed: DIV - More Info Arizona Adopted column title text matched as expected');
|
|
} else {
|
|
errors.push(`Expected: DIV - Arizona column title "Adopted"; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//font
|
|
if (elementFont === 'Poppins, sans-serif') {
|
|
console.log('Passed: DIV - More Info Arizona Adopted column title font-family matched as expected');
|
|
} else {
|
|
errors.push(`Expected: DIV - More Info Arizona Adopted column title font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
|
|
}
|
|
|
|
//size
|
|
if (elementSize === '14px') {
|
|
console.log('Passed: DIV - More Info Arizona Adopted column title text font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: DIV - More Info Arizona Adopted column title text font-size "14px"; Actual: "${elementSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementColor === 'rgba(94, 105, 116, 1)') {
|
|
console.log('Passed: DIV - More Info Arizona Adopted column title text color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: DIV - More Info Arizona Adopted column title text color "rgba(94, 105, 116, 1)"'; Actual: "${elementColor}"`);
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//DIV - More Info Alabama Grades column title
|
|
{
|
|
description: 'Validate DIV - More Info Alabama Grades column title text, color, and size',
|
|
action: async () => {
|
|
const multipleChecks = 'DIV - Alabama Courses of Study Grades column title';
|
|
const element = await driver.findElement(By.css('#myModal > div > div > div.modal-body > table > thead > tr > th:nth-child(3)'));
|
|
|
|
//Get text, font, size, and color
|
|
const elementText = await element.getText('');
|
|
const elementFont = await element.getCssValue('font-family');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
const elementColor = await element.getCssValue('color')
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//text
|
|
if (elementText === 'Grades') {
|
|
console.log('Passed: DIV - More Info Arizona Grades column title text matched as expected');
|
|
} else {
|
|
errors.push(`Expected: DIV - Arizona column title "Grades"; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//font
|
|
if (elementFont === 'Poppins, sans-serif') {
|
|
console.log('Passed: DIV - More Info Arizona Grades column title font-family matched as expected');
|
|
} else {
|
|
errors.push(`Expected: DIV - More Info Arizona Grades column title font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
|
|
}
|
|
|
|
//size
|
|
if (elementSize === '14px') {
|
|
console.log('Passed: DIV - More Info Arizona Grades column title text font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: DIV - More Info Arizona Grades column title text font-size "14px"; Actual: "${elementSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementColor === 'rgba(94, 105, 116, 1)') {
|
|
console.log('Passed: DIV - More Info Arizona Grades column title text color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: DIV - More Info Arizona Grades column title text color "rgba(94, 105, 116, 1)"'; Actual: "${elementColor}"`);
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//DIV - More Info Alabama Row 1 label
|
|
{
|
|
description: 'Validate DIV - More Info Alabama Row 1 label text, font, color, and size',
|
|
action: async () => {
|
|
const multipleChecks = 'DIV - More Info Alabama Row 1 label';
|
|
|
|
const checks = [
|
|
//Subject
|
|
{
|
|
selector: '.text-success:nth-child(1) > td:nth-child(1)',
|
|
label: 'Health and PE',
|
|
expected: {
|
|
text: 'Health and PE',
|
|
font: 'Poppins, sans-serif',
|
|
color: 'rgba(40, 167, 69, 1)',
|
|
size: '14.3px'
|
|
}
|
|
},
|
|
|
|
//Adopted
|
|
{
|
|
selector: '.text-success:nth-child(1) > td:nth-child(2)',
|
|
label: '2019',
|
|
expected: {
|
|
text: '2019',
|
|
font: 'Poppins, sans-serif',
|
|
color: 'rgba(40, 167, 69, 1)',
|
|
size: '14.3px'
|
|
}
|
|
},
|
|
|
|
//All Grades list
|
|
{
|
|
selector: '.text-success:nth-child(1) > td:nth-child(3)',
|
|
label: 'Grades List',
|
|
expected: {
|
|
text: 'K, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12',
|
|
font: 'Poppins, sans-serif',
|
|
color: 'rgba(40, 167, 69, 1)',
|
|
size: '14.3px'
|
|
}
|
|
}
|
|
];
|
|
|
|
const allErrors = [];
|
|
|
|
async function validateCell({ selector, label, expected }) {
|
|
const element = await driver.findElement(By.css(selector));
|
|
|
|
const actualText = await element.getText();
|
|
const actualFont = await element.getCssValue('font-family');
|
|
const actualSize = await element.getCssValue('font-size');
|
|
const actualColor = await element.getCssValue('color');
|
|
|
|
const errors = [];
|
|
|
|
//text
|
|
if (actualText === expected.text) {
|
|
console.log(`Passed: DIV - More Info Alabama Row 1 ${label} label text matched as expected`);
|
|
} else {
|
|
errors.push(`Expected: DIV - More Info Alabama Row 1 "${expected.text}"; Actual: "${actualText}"`);
|
|
}
|
|
|
|
//font
|
|
if (actualFont === expected.font) {
|
|
console.log(`Passed: DIV - More Info Alabama Row 1 ${label} label text font-family matched as expected`);
|
|
} else {
|
|
errors.push(`Expected: DIV - More Info Alabama Row 1 "${expected.font}"; Actual: "${actualFont}"`);
|
|
}
|
|
|
|
//size
|
|
if (actualSize === expected.size) {
|
|
console.log(`Passed: DIV - More Info Alabama Row 1 ${label} label text font-size matched as expected`);
|
|
} else {
|
|
errors.push(`Expected: DIV - More Info Alabama Row 1 ${label} label text font-size "${expected.size}"; Actual: "${actualSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (actualColor === expected.color) {
|
|
console.log(`Passed: DIV - More Info Alabama Row 1 ${label} label text color matched as expected`);
|
|
} else {
|
|
errors.push(`Expected: DIV - More Info Alabama Row 1 ${label} label text color "${expected.color}"; Actual: "${actualColor}"`);
|
|
}
|
|
|
|
return errors;
|
|
}
|
|
|
|
for (const check of checks) {
|
|
const errs = await validateCell(check);
|
|
allErrors.push(...errs);
|
|
}
|
|
|
|
if (allErrors.length > 0) {
|
|
if (allErrors.length > 1) allErrors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
throw new Error(allErrors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//DIV - More Info Alabama Row 2 label
|
|
{
|
|
description: 'Validate DIV - More Info Alabama Row 2 label text, font, color, and size',
|
|
action: async () => {
|
|
const multipleChecks = 'DIV - More Info Alabama Row 2 label';
|
|
|
|
const checks = [
|
|
//Subject
|
|
{
|
|
selector: '.text-success:nth-child(2) > td:nth-child(1)',
|
|
label: 'Language Arts',
|
|
expected: {
|
|
text: 'Language Arts',
|
|
font: 'Poppins, sans-serif',
|
|
color: 'rgba(40, 167, 69, 1)',
|
|
size: '14.3px'
|
|
}
|
|
},
|
|
|
|
//Adopted
|
|
{
|
|
selector: '.text-success:nth-child(2) > td:nth-child(2)',
|
|
label: '2021/Effective 2022',
|
|
expected: {
|
|
text: '2021/Effective 2022',
|
|
font: 'Poppins, sans-serif',
|
|
color: 'rgba(40, 167, 69, 1)',
|
|
size: '14.3px'
|
|
}
|
|
},
|
|
|
|
//All Grades list
|
|
{
|
|
selector: '.text-success:nth-child(2) > td:nth-child(3)',
|
|
label: 'Grades List',
|
|
expected: {
|
|
text: 'K, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12',
|
|
font: 'Poppins, sans-serif',
|
|
color: 'rgba(40, 167, 69, 1)',
|
|
size: '14.3px'
|
|
}
|
|
}
|
|
];
|
|
|
|
const allErrors = [];
|
|
|
|
async function validateCell({ selector, label, expected }) {
|
|
const element = await driver.findElement(By.css(selector));
|
|
|
|
const actualText = await element.getText();
|
|
const actualFont = await element.getCssValue('font-family');
|
|
const actualSize = await element.getCssValue('font-size');
|
|
const actualColor = await element.getCssValue('color');
|
|
|
|
const errors = [];
|
|
|
|
//text
|
|
if (actualText === expected.text) {
|
|
console.log(`Passed: DIV - More Info Alabama Row 2 ${label} label text matched as expected`);
|
|
} else {
|
|
errors.push(`Expected: DIV - More Info Alabama Row 2 "${expected.text}"; Actual: "${actualText}"`);
|
|
}
|
|
|
|
//font
|
|
if (actualFont === expected.font) {
|
|
console.log(`Passed: DIV - More Info Alabama Row 2 ${label} label text font matched as expected`);
|
|
} else {
|
|
errors.push(`Expected: DIV - More Info Alabama Row 2 "${expected.font}"; Actual: "${actualFont}"`);
|
|
}
|
|
|
|
//size
|
|
if (actualSize === expected.size) {
|
|
console.log(`Passed: DIV - More Info Alabama Row 2 ${label} label text font-size matched as expected`);
|
|
} else {
|
|
errors.push(`Expected: DIV - More Info Alabama Row 2 ${label} label text font-size "${expected.size}"; Actual: "${actualSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (actualColor === expected.color) {
|
|
console.log(`Passed: DIV - More Info Alabama Row 2 ${label} label text color matched as expected`);
|
|
} else {
|
|
errors.push(`Expected: DIV - More Info Alabama Row 2 ${label} label text color "${expected.color}"; Actual: "${actualColor}"`);
|
|
}
|
|
|
|
return errors;
|
|
}
|
|
|
|
for (const check of checks) {
|
|
const errs = await validateCell(check);
|
|
allErrors.push(...errs);
|
|
}
|
|
|
|
if (allErrors.length > 0) {
|
|
if (allErrors.length > 1) allErrors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
throw new Error(allErrors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//DIV - More Info Alabama Row 3 label
|
|
{
|
|
description: 'Validate DIV - More Info Alabama Row 3 label text, color, and font size',
|
|
action: async () => {
|
|
const multipleChecks = 'DIV - More Info Alabama Row 3 label';
|
|
|
|
const checks = [
|
|
//Subject
|
|
{
|
|
selector: '.text-success:nth-child(3) > td:nth-child(1)',
|
|
label: 'Mathematics',
|
|
expected: {
|
|
text: 'Mathematics',
|
|
font: 'Poppins, sans-serif',
|
|
color: 'rgba(40, 167, 69, 1)',
|
|
size: '14.3px'
|
|
}
|
|
},
|
|
|
|
//Adopted
|
|
{
|
|
selector: '.text-success:nth-child(3) > td:nth-child(2)',
|
|
label: '2019/Impl. 2020',
|
|
expected: {
|
|
text: '2019/Impl. 2020',
|
|
font: 'Poppins, sans-serif',
|
|
color: 'rgba(40, 167, 69, 1)',
|
|
size: '14.3px'
|
|
}
|
|
},
|
|
|
|
//All Grades list
|
|
{
|
|
selector: '.text-success:nth-child(3) > td:nth-child(3)',
|
|
label: 'Grades List',
|
|
expected: {
|
|
text: 'K, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12',
|
|
font: 'Poppins, sans-serif',
|
|
color: 'rgba(40, 167, 69, 1)',
|
|
size: '14.3px'
|
|
}
|
|
}
|
|
];
|
|
|
|
const allErrors = [];
|
|
|
|
async function validateCell({ selector, label, expected }) {
|
|
const element = await driver.findElement(By.css(selector));
|
|
|
|
const actualText = await element.getText();
|
|
const actualFont = await element.getCssValue('font-family');
|
|
const actualSize = await element.getCssValue('font-size');
|
|
const actualColor = await element.getCssValue('color');
|
|
|
|
const errors = [];
|
|
|
|
//text
|
|
if (actualText === expected.text) {
|
|
console.log(`Passed: DIV - More Info Alabama Row 3 ${label} label text matched as expected`);
|
|
} else {
|
|
errors.push(`Expected: DIV - More Info Alabama Row 3 "${expected.text}"; Actual: "${actualText}"`);
|
|
}
|
|
|
|
//font
|
|
if (actualFont === expected.font) {
|
|
console.log(`Passed: DIV - More Info Alabama Row 3 ${label} label text font matched as expected`);
|
|
} else {
|
|
errors.push(`Expected: DIV - More Info Alabama Row 3 "${expected.font}"; Actual: "${actualFont}"`);
|
|
}
|
|
|
|
//size
|
|
if (actualSize === expected.size) {
|
|
console.log(`Passed: DIV - More Info Alabama Row 3 ${label} label text font-size matched as expected`);
|
|
} else {
|
|
errors.push(`Expected: DIV - More Info Alabama Row 3 ${label} label text font-size "${expected.size}"; Actual: "${actualSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (actualColor === expected.color) {
|
|
console.log(`Passed: DIV - More Info Alabama Row 3 ${label} label text color matched as expected`);
|
|
} else {
|
|
errors.push(`Expected: DIV - More Info Alabama Row 3 ${label} label text color "${expected.color}"; Actual: "${actualColor}"`);
|
|
}
|
|
|
|
return errors;
|
|
}
|
|
|
|
for (const check of checks) {
|
|
const errs = await validateCell(check);
|
|
allErrors.push(...errs);
|
|
}
|
|
|
|
if (allErrors.length > 0) {
|
|
if (allErrors.length > 1) allErrors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
throw new Error(allErrors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//DIV - More Info Alabama Row 4 label
|
|
{
|
|
description: 'Validate DIV - More Info Alabama Row 4 label text, color, and font size',
|
|
action: async () => {
|
|
const multipleChecks = 'DIV - More Info Alabama Row 4 label';
|
|
|
|
const checks = [
|
|
//Subject
|
|
{
|
|
selector: '.text-success:nth-child(4) > td:nth-child(1)',
|
|
label: 'Science',
|
|
expected: {
|
|
text: 'Science',
|
|
font: 'Poppins, sans-serif',
|
|
color: 'rgba(40, 167, 69, 1)',
|
|
size: '14.3px'
|
|
}
|
|
},
|
|
|
|
//Adopted
|
|
{
|
|
selector: '.text-success:nth-child(4) > td:nth-child(2)',
|
|
label: '2023',
|
|
expected: {
|
|
text: '2023',
|
|
font: 'Poppins, sans-serif',
|
|
color: 'rgba(40, 167, 69, 1)',
|
|
size: '14.3px'
|
|
}
|
|
},
|
|
|
|
//All Grades list
|
|
{
|
|
selector: '.text-success:nth-child(4) > td:nth-child(3)',
|
|
label: 'Grades List',
|
|
expected: {
|
|
text: 'K, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12',
|
|
font: 'Poppins, sans-serif',
|
|
color: 'rgba(40, 167, 69, 1)',
|
|
size: '14.3px'
|
|
}
|
|
}
|
|
];
|
|
|
|
const allErrors = [];
|
|
|
|
async function validateCell({ selector, label, expected }) {
|
|
const element = await driver.findElement(By.css(selector));
|
|
|
|
const actualText = await element.getText();
|
|
const actualFont = await element.getCssValue('font-family');
|
|
const actualSize = await element.getCssValue('font-size');
|
|
const actualColor = await element.getCssValue('color');
|
|
|
|
const errors = [];
|
|
|
|
//text
|
|
if (actualText === expected.text) {
|
|
console.log(`Passed: DIV - More Info Alabama Row 4 ${label} label text matched as expected`);
|
|
} else {
|
|
errors.push(`Expected: DIV - More Info Alabama Row 4 "${expected.text}"; Actual: "${actualText}"`);
|
|
}
|
|
|
|
//font
|
|
if (actualFont === expected.font) {
|
|
console.log(`Passed: DIV - More Info Alabama Row 4 ${label} label text font matched as expected`);
|
|
} else {
|
|
errors.push(`Expected: DIV - More Info Alabama Row 4 "${expected.font}"; Actual: "${actualFont}"`);
|
|
}
|
|
|
|
//size
|
|
if (actualSize === expected.size) {
|
|
console.log(`Passed: DIV - More Info Alabama Row 4 ${label} label text font-size matched as expected`);
|
|
} else {
|
|
errors.push(`Expected: DIV - More Info Alabama Row 4 ${label} label text font-size "${expected.size}"; Actual: "${actualSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (actualColor === expected.color) {
|
|
console.log(`Passed: DIV - More Info Alabama Row 4 ${label} label text color matched as expected`);
|
|
} else {
|
|
errors.push(`Expected: DIV - More Info Alabama Row 4 ${label} label text color "${expected.color}"; Actual: "${actualColor}"`);
|
|
}
|
|
|
|
return errors;
|
|
}
|
|
|
|
for (const check of checks) {
|
|
const errs = await validateCell(check);
|
|
allErrors.push(...errs);
|
|
}
|
|
|
|
if (allErrors.length > 0) {
|
|
if (allErrors.length > 1) allErrors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
throw new Error(allErrors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//DIV - More Info Alabama Row 5 label
|
|
{
|
|
description: 'Validate DIV - More Info Alabama Row 5 label text, color, and font size',
|
|
action: async () => {
|
|
const multipleChecks = 'DIV - More Info Alabama Row 5 label';
|
|
|
|
const checks = [
|
|
//Subject
|
|
{
|
|
selector: '.text-success:nth-child(5) > td:nth-child(1)',
|
|
label: 'Social Studies',
|
|
expected: {
|
|
text: 'Social Studies',
|
|
font: 'Poppins, sans-serif',
|
|
color: 'rgba(40, 167, 69, 1)',
|
|
size: '14.3px'
|
|
}
|
|
},
|
|
|
|
//Adopted
|
|
{
|
|
selector: '.text-success:nth-child(5) > td:nth-child(2)',
|
|
label: '2024',
|
|
expected: {
|
|
text: '2024',
|
|
font: 'Poppins, sans-serif',
|
|
color: 'rgba(40, 167, 69, 1)',
|
|
size: '14.3px'
|
|
}
|
|
},
|
|
|
|
//All Grades list
|
|
{
|
|
selector: '.text-success:nth-child(5) > td:nth-child(3)',
|
|
label: 'Grades List',
|
|
expected: {
|
|
text: 'K, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12',
|
|
font: 'Poppins, sans-serif',
|
|
color: 'rgba(40, 167, 69, 1)',
|
|
size: '14.3px'
|
|
}
|
|
}
|
|
];
|
|
|
|
const allErrors = [];
|
|
|
|
async function validateCell({ selector, label, expected }) {
|
|
const element = await driver.findElement(By.css(selector));
|
|
|
|
const actualText = await element.getText();
|
|
const actualFont = await element.getCssValue('font-family');
|
|
const actualSize = await element.getCssValue('font-size');
|
|
const actualColor = await element.getCssValue('color');
|
|
|
|
const errors = [];
|
|
|
|
//text
|
|
if (actualText === expected.text) {
|
|
console.log(`Passed: DIV - More Info Alabama Row 5 ${label} label text matched as expected`);
|
|
} else {
|
|
errors.push(`Expected: DIV - More Info Alabama Row 5 "${expected.text}"; Actual: "${actualText}"`);
|
|
}
|
|
|
|
//font
|
|
if (actualFont === expected.font) {
|
|
console.log(`Passed: DIV - More Info Alabama Row 5 ${label} label text font matched as expected`);
|
|
} else {
|
|
errors.push(`Expected: DIV - More Info Alabama Row 5 "${expected.font}"; Actual: "${actualFont}"`);
|
|
}
|
|
|
|
//size
|
|
if (actualSize === expected.size) {
|
|
console.log(`Passed: DIV - More Info Alabama Row 5 ${label} label text font-size matched as expected`);
|
|
} else {
|
|
errors.push(`Expected: DIV - More Info Alabama Row 5 ${label} label text font-size "${expected.size}"; Actual: "${actualSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (actualColor === expected.color) {
|
|
console.log(`Passed: DIV - More Info Alabama Row 5 ${label} label text color matched as expected`);
|
|
} else {
|
|
errors.push(`Expected: DIV - More Info Alabama Row 5 ${label} label text color "${expected.color}"; Actual: "${actualColor}"`);
|
|
}
|
|
|
|
return errors;
|
|
}
|
|
|
|
for (const check of checks) {
|
|
const errs = await validateCell(check);
|
|
allErrors.push(...errs);
|
|
}
|
|
|
|
if (allErrors.length > 0) {
|
|
if (allErrors.length > 1) allErrors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
throw new Error(allErrors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//DIV - More Info Alabama Row 6 label
|
|
{
|
|
description: 'Validate DIV - More Info Alabama Row 6 label text, color, and font size',
|
|
action: async () => {
|
|
const multipleChecks = 'DIV - More Info Alabama Row 6 label';
|
|
|
|
const checks = [
|
|
//Subject
|
|
{
|
|
selector: '.text-success:nth-child(6) > td:nth-child(1)',
|
|
label: 'Technology Education',
|
|
expected: {
|
|
text: 'Technology Education',
|
|
font: 'Poppins, sans-serif',
|
|
color: 'rgba(40, 167, 69, 1)',
|
|
size: '14.3px'
|
|
}
|
|
},
|
|
|
|
//Adopted
|
|
{
|
|
selector: '.text-success:nth-child(6) > td:nth-child(2)',
|
|
label: '2025',
|
|
expected: {
|
|
text: '2025',
|
|
font: 'Poppins, sans-serif',
|
|
color: 'rgba(40, 167, 69, 1)',
|
|
size: '14.3px'
|
|
}
|
|
},
|
|
|
|
//All Grades list
|
|
{
|
|
selector: '.text-success:nth-child(6) > td:nth-child(3)',
|
|
label: 'Grades List',
|
|
expected: {
|
|
text: 'K, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12',
|
|
font: 'Poppins, sans-serif',
|
|
color: 'rgba(40, 167, 69, 1)',
|
|
size: '14.3px'
|
|
}
|
|
}
|
|
];
|
|
|
|
const allErrors = [];
|
|
|
|
async function validateCell({ selector, label, expected }) {
|
|
const element = await driver.findElement(By.css(selector));
|
|
|
|
const actualText = await element.getText();
|
|
const actualFont = await element.getCssValue('font-family');
|
|
const actualSize = await element.getCssValue('font-size');
|
|
const actualColor = await element.getCssValue('color');
|
|
|
|
const errors = [];
|
|
|
|
//text
|
|
if (actualText === expected.text) {
|
|
console.log(`Passed: DIV - More Info Alabama Row 6 ${label} label text matched as expected`);
|
|
} else {
|
|
errors.push(`Expected: DIV - More Info Alabama Row 6 "${expected.text}"; Actual: "${actualText}"`);
|
|
}
|
|
|
|
//font
|
|
if (actualFont === expected.font) {
|
|
console.log(`Passed: DIV - More Info Alabama Row 6 ${label} label text font matched as expected`);
|
|
} else {
|
|
errors.push(`Expected: DIV - More Info Alabama Row 6 "${expected.font}"; Actual: "${actualFont}"`);
|
|
}
|
|
|
|
//size
|
|
if (actualSize === expected.size) {
|
|
console.log(`Passed: DIV - More Info Alabama Row 6 ${label} label text font-size matched as expected`);
|
|
} else {
|
|
errors.push(`Expected: DIV - More Info Alabama Row 6 ${label} label text font-size "${expected.size}"; Actual: "${actualSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (actualColor === expected.color) {
|
|
console.log(`Passed: DIV - More Info Alabama Row 6 ${label} label text color matched as expected`);
|
|
} else {
|
|
errors.push(`Expected: DIV - More Info Alabama Row 6 ${label} label text color "${expected.color}"; Actual: "${actualColor}"`);
|
|
}
|
|
|
|
return errors;
|
|
}
|
|
|
|
for (const check of checks) {
|
|
const errs = await validateCell(check);
|
|
allErrors.push(...errs);
|
|
}
|
|
|
|
if (allErrors.length > 0) {
|
|
if (allErrors.length > 1) allErrors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
throw new Error(allErrors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//DIV - More Info Alabama Row 7 label
|
|
{
|
|
description: 'Validate DIV - More Info Alabama Row 7 label text, color, and font size',
|
|
action: async () => {
|
|
const multipleChecks = 'DIV - More Info Alabama Row 7 label';
|
|
|
|
const checks = [
|
|
//Subject
|
|
{
|
|
selector: '.notenabled:nth-child(7) > td:nth-child(1)',
|
|
label: 'Arts Education*',
|
|
expected: {
|
|
text: 'Arts Education*',
|
|
font: 'Poppins, sans-serif',
|
|
color: 'rgba(119, 119, 119, 1)',
|
|
size: '12.87px'
|
|
}
|
|
},
|
|
|
|
//Adopted
|
|
{
|
|
selector: '.notenabled:nth-child(7) > td:nth-child(2)',
|
|
label: '2024',
|
|
expected: {
|
|
text: '2024',
|
|
font: 'Poppins, sans-serif',
|
|
color: 'rgba(119, 119, 119, 1)',
|
|
size: '12.87px'
|
|
}
|
|
},
|
|
|
|
//Grades
|
|
{
|
|
selector: '.notenabled:nth-child(7) > td:nth-child(3)',
|
|
label: 'Grades List',
|
|
expected: {
|
|
text: 'K, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12',
|
|
font: 'Poppins, sans-serif',
|
|
color: 'rgba(119, 119, 119, 1)',
|
|
size: '12.87px'
|
|
}
|
|
}
|
|
];
|
|
|
|
const allErrors = [];
|
|
|
|
async function validateCell({ selector, label, expected }) {
|
|
const element = await driver.findElement(By.css(selector));
|
|
|
|
const actualText = await element.getText();
|
|
const actualFont = await element.getCssValue('font-family');
|
|
const actualSize = await element.getCssValue('font-size');
|
|
const actualColor = await element.getCssValue('color');
|
|
|
|
const errors = [];
|
|
|
|
//text
|
|
if (actualText === expected.text) {
|
|
console.log(`Passed: DIV - More Info Alabama Row 7 ${label} label text matched as expected`);
|
|
} else {
|
|
errors.push(`Expected: DIV - More Info Alabama Row 7 "${expected.text}"; Actual: "${actualText}"`);
|
|
}
|
|
|
|
//font
|
|
if (actualFont === expected.font) {
|
|
console.log(`Passed: DIV - More Info Alabama Row 7 ${label} label text font matched as expected`);
|
|
} else {
|
|
errors.push(`Expected: DIV - More Info Alabama Row 7 "${expected.font}"; Actual: "${actualFont}"`);
|
|
}
|
|
|
|
//size
|
|
if (actualSize === expected.size) {
|
|
console.log(`Passed: DIV - More Info Alabama Row 7 ${label} label text font-size matched as expected`);
|
|
} else {
|
|
errors.push(`Expected: DIV - More Info Alabama Row 7 ${label} label text font-size "${expected.size}"; Actual: "${actualSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (actualColor === expected.color) {
|
|
console.log(`Passed: DIV - More Info Alabama Row 7 ${label} label text color matched as expected`);
|
|
} else {
|
|
errors.push(`Expected: DIV - More Info Alabama Row 7 ${label} label text color "${expected.color}"; Actual: "${actualColor}"`);
|
|
}
|
|
|
|
return errors;
|
|
}
|
|
|
|
for (const check of checks) {
|
|
const errs = await validateCell(check);
|
|
allErrors.push(...errs);
|
|
}
|
|
|
|
if (allErrors.length > 0) {
|
|
if (allErrors.length > 1) allErrors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
throw new Error(allErrors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//DIV - More Info Alabama Row 8 label
|
|
{
|
|
description: 'Validate DIV - More Info Alabama Row 8 label text, color, and font size',
|
|
action: async () => {
|
|
const multipleChecks = 'DIV - More Info Alabama Row 8 label';
|
|
|
|
const checks = [
|
|
//Subject
|
|
{
|
|
selector: '.notenabled:nth-child(8) > td:nth-child(1)',
|
|
label: 'Career Development*',
|
|
expected: {
|
|
text: 'Career Development*',
|
|
font: 'Poppins, sans-serif',
|
|
color: 'rgba(119, 119, 119, 1)',
|
|
size: '12.87px'
|
|
}
|
|
},
|
|
|
|
//Adopted
|
|
{
|
|
selector: '.notenabled:nth-child(8) > td:nth-child(2)',
|
|
label: '2016',
|
|
expected: {
|
|
text: '2016',
|
|
font: 'Poppins, sans-serif',
|
|
color: 'rgba(119, 119, 119, 1)',
|
|
size: '12.87px'
|
|
}
|
|
},
|
|
|
|
//All Grades list
|
|
{
|
|
selector: '.notenabled:nth-child(8) > td:nth-child(3)',
|
|
label: 'Grades List',
|
|
expected: {
|
|
text: '9, 10, 11, 12',
|
|
font: 'Poppins, sans-serif',
|
|
color: 'rgba(119, 119, 119, 1)',
|
|
size: '12.87px'
|
|
}
|
|
}
|
|
];
|
|
|
|
const allErrors = [];
|
|
|
|
async function validateCell({ selector, label, expected }) {
|
|
const element = await driver.findElement(By.css(selector));
|
|
|
|
const actualText = await element.getText();
|
|
const actualFont = await element.getCssValue('font-family');
|
|
const actualSize = await element.getCssValue('font-size');
|
|
const actualColor = await element.getCssValue('color');
|
|
|
|
const errors = [];
|
|
|
|
//text
|
|
if (actualText === expected.text) {
|
|
console.log(`Passed: DIV - More Info Alabama Row 8 ${label} label text matched as expected`);
|
|
} else {
|
|
errors.push(`Expected: DIV - More Info Alabama Row 8 "${expected.text}"; Actual: "${actualText}"`);
|
|
}
|
|
|
|
//font
|
|
if (actualFont === expected.font) {
|
|
console.log(`Passed: DIV - More Info Alabama Row 8 ${label} label text font matched as expected`);
|
|
} else {
|
|
errors.push(`Expected: DIV - More Info Alabama Row 8 "${expected.font}"; Actual: "${actualFont}"`);
|
|
}
|
|
|
|
//size
|
|
if (actualSize === expected.size) {
|
|
console.log(`Passed: DIV - More Info Alabama Row 8 ${label} label text font-size matched as expected`);
|
|
} else {
|
|
errors.push(`Expected: DIV - More Info Alabama Row 8 ${label} label text font-size "${expected.size}"; Actual: "${actualSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (actualColor === expected.color) {
|
|
console.log(`Passed: DIV - More Info Alabama Row 8 ${label} label text color matched as expected`);
|
|
} else {
|
|
errors.push(`Expected: DIV - More Info Alabama Row 8 ${label} label text color "${expected.color}"; Actual: "${actualColor}"`);
|
|
}
|
|
|
|
return errors;
|
|
}
|
|
|
|
for (const check of checks) {
|
|
const errs = await validateCell(check);
|
|
allErrors.push(...errs);
|
|
}
|
|
|
|
if (allErrors.length > 0) {
|
|
if (allErrors.length > 1) allErrors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
throw new Error(allErrors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//DIV - More Info Alabama Row 9 label text
|
|
{
|
|
description: 'Validate DIV - More Info Alabama Row 9 label text, color, and font size',
|
|
action: async () => {
|
|
const multipleChecks = 'DIV - More Info Alabama Row 9 label';
|
|
|
|
const checks = [
|
|
//Subject
|
|
{
|
|
selector: '.notenabled:nth-child(9) > td:nth-child(1)',
|
|
label: 'Early Childhood Education*',
|
|
expected: {
|
|
text: 'Early Childhood Education*',
|
|
font: 'Poppins, sans-serif',
|
|
color: 'rgba(119, 119, 119, 1)',
|
|
size: '12.87px'
|
|
}
|
|
},
|
|
|
|
//Adopted
|
|
{
|
|
selector: '.notenabled:nth-child(9) > td:nth-child(2)',
|
|
label: '2023',
|
|
expected: {
|
|
text: '2023',
|
|
font: 'Poppins, sans-serif',
|
|
color: 'rgba(119, 119, 119, 1)',
|
|
size: '12.87px'
|
|
}
|
|
},
|
|
|
|
//Ages 3-5*
|
|
{
|
|
selector: '.notenabled:nth-child(9) .notenabled',
|
|
label: 'Ages 3-5*',
|
|
expected: {
|
|
text: 'Ages 3-5*',
|
|
font: 'Poppins, sans-serif',
|
|
color: 'rgba(119, 119, 119, 1)',
|
|
size: '11.583px'
|
|
}
|
|
},
|
|
|
|
//All Grades list 1
|
|
{
|
|
selector: '.notenabled:nth-child(2)',
|
|
label: 'Ages Birth to 12 months*',
|
|
expected: {
|
|
text: 'Ages Birth to 12 months*',
|
|
font: 'Poppins, sans-serif',
|
|
color: 'rgba(119, 119, 119, 1)',
|
|
size: '11.583px'
|
|
}
|
|
},
|
|
|
|
//All Grades list 2
|
|
{
|
|
selector: '.notenabled:nth-child(3)',
|
|
label: 'Ages 13 to 24 months*',
|
|
expected: {
|
|
text: 'Ages 13 to 24 months*',
|
|
font: 'Poppins, sans-serif',
|
|
color: 'rgba(119, 119, 119, 1)',
|
|
size: '11.583px'
|
|
}
|
|
},
|
|
|
|
//All Grades list 3
|
|
{
|
|
selector: '.notenabled:nth-child(4)',
|
|
label: 'Ages 25 to 36 months*',
|
|
expected: {
|
|
text: 'Ages 25 to 36 months*',
|
|
font: 'Poppins, sans-serif',
|
|
color: 'rgba(119, 119, 119, 1)',
|
|
size: '11.583px'
|
|
}
|
|
}
|
|
];
|
|
|
|
const allErrors = [];
|
|
|
|
async function validateCell({ selector, label, expected }) {
|
|
const element = await driver.findElement(By.css(selector));
|
|
|
|
const actualText = await element.getText();
|
|
const actualFont = await element.getCssValue('font-family');
|
|
const actualSize = await element.getCssValue('font-size');
|
|
const actualColor = await element.getCssValue('color');
|
|
|
|
const errors = [];
|
|
|
|
//text
|
|
if (actualText === expected.text) {
|
|
console.log(`Passed: DIV - More Info Alabama Row 9 ${label} label text matched as expected`);
|
|
} else {
|
|
errors.push(`Expected: DIV - More Info Alabama Row 9 "${expected.text}"; Actual: "${actualText}"`);
|
|
}
|
|
|
|
//font
|
|
if (actualFont === expected.font) {
|
|
console.log(`Passed: DIV - More Info Alabama Row 9 ${label} label text font matched as expected`);
|
|
} else {
|
|
errors.push(`Expected: DIV - More Info Alabama Row 9 "${expected.font}"; Actual: "${actualFont}"`);
|
|
}
|
|
|
|
//size
|
|
if (actualSize === expected.size) {
|
|
console.log(`Passed: DIV - More Info Alabama Row 9 ${label} label text font-size matched as expected`);
|
|
} else {
|
|
errors.push(`Expected: DIV - More Info Alabama Row 9 ${label} label text font-size "${expected.size}"; Actual: "${actualSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (actualColor === expected.color) {
|
|
console.log(`Passed: DIV - More Info Alabama Row 9 ${label} label text color matched as expected`);
|
|
} else {
|
|
errors.push(`Expected: DIV - More Info Alabama Row 9 ${label} label text color "${expected.color}"; Actual: "${actualColor}"`);
|
|
}
|
|
|
|
return errors;
|
|
}
|
|
|
|
for (const check of checks) {
|
|
const errs = await validateCell(check);
|
|
allErrors.push(...errs);
|
|
}
|
|
|
|
if (allErrors.length > 0) {
|
|
if (allErrors.length > 1) allErrors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
throw new Error(allErrors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//DIV - More Info Alabama Row 10 label text
|
|
{
|
|
description: 'Validate DIV - More Info Alabama Row 10 label text, color, and font size',
|
|
action: async () => {
|
|
const multipleChecks = 'DIV - More Info Alabama Row 10 label';
|
|
|
|
const checks = [
|
|
//Subject
|
|
{
|
|
selector: '.notenabled:nth-child(10) > td:nth-child(1)',
|
|
label: 'English Language Learners*',
|
|
expected: {
|
|
text: 'English Language Learners*',
|
|
font: 'Poppins, sans-serif',
|
|
color: 'rgba(119, 119, 119, 1)',
|
|
size: '12.87px'
|
|
}
|
|
},
|
|
|
|
//Adopted
|
|
{
|
|
selector: '.notenabled:nth-child(10) > td:nth-child(2)',
|
|
label: '2020',
|
|
expected: {
|
|
text: '2020',
|
|
font: 'Poppins, sans-serif',
|
|
color: 'rgba(119, 119, 119, 1)',
|
|
size: '12.87px'
|
|
}
|
|
},
|
|
|
|
//All Grades list
|
|
{
|
|
selector: '.notenabled:nth-child(10) > td:nth-child(3)',
|
|
label: 'Grades List',
|
|
expected: {
|
|
text: 'K, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12',
|
|
font: 'Poppins, sans-serif',
|
|
color: 'rgba(119, 119, 119, 1)',
|
|
size: '12.87px'
|
|
}
|
|
}
|
|
];
|
|
|
|
const allErrors = [];
|
|
|
|
async function validateCell({ selector, label, expected }) {
|
|
const element = await driver.findElement(By.css(selector));
|
|
|
|
const actualText = await element.getText();
|
|
const actualFont = await element.getCssValue('font-family');
|
|
const actualSize = await element.getCssValue('font-size');
|
|
const actualColor = await element.getCssValue('color');
|
|
|
|
const errors = [];
|
|
|
|
//text
|
|
if (actualText === expected.text) {
|
|
console.log(`Passed: DIV - More Info Alabama Row 10 ${label} label text matched as expected`);
|
|
} else {
|
|
errors.push(`Expected: DIV - More Info Alabama Row 10 "${expected.text}"; Actual: "${actualText}"`);
|
|
}
|
|
|
|
//font
|
|
if (actualFont === expected.font) {
|
|
console.log(`Passed: DIV - More Info Alabama Row 10 ${label} label text font matched as expected`);
|
|
} else {
|
|
errors.push(`Expected: DIV - More Info Alabama Row 10 "${expected.font}"; Actual: "${actualFont}"`);
|
|
}
|
|
|
|
//size
|
|
if (actualSize === expected.size) {
|
|
console.log(`Passed: DIV - More Info Alabama Row 10 ${label} label text font-size matched as expected`);
|
|
} else {
|
|
errors.push(`Expected: DIV - More Info Alabama Row 10 ${label} label text font-size "${expected.size}"; Actual: "${actualSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (actualColor === expected.color) {
|
|
console.log(`Passed: DIV - More Info Alabama Row 10 ${label} label text color matched as expected`);
|
|
} else {
|
|
errors.push(`Expected: DIV - More Info Alabama Row 10 ${label} label text color "${expected.color}"; Actual: "${actualColor}"`);
|
|
}
|
|
|
|
return errors;
|
|
}
|
|
|
|
for (const check of checks) {
|
|
const errs = await validateCell(check);
|
|
allErrors.push(...errs);
|
|
}
|
|
|
|
if (allErrors.length > 0) {
|
|
if (allErrors.length > 1) allErrors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
throw new Error(allErrors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//DIV - More Info Alabama Row 11 label
|
|
{
|
|
description: 'Validate DIV - More Info Alabama Row 11 label text, color, and font size',
|
|
action: async () => {
|
|
const multipleChecks = 'DIV - More Info Alabama Row 11 label';
|
|
|
|
const checks = [
|
|
//Subject
|
|
{
|
|
selector: '.notenabled:nth-child(11) > td:nth-child(1)',
|
|
label: 'Social and Emotional Learning*',
|
|
expected: {
|
|
text: 'Social and Emotional Learning*',
|
|
font: 'Poppins, sans-serif',
|
|
color: 'rgba(119, 119, 119, 1)',
|
|
size: '12.87px'
|
|
}
|
|
},
|
|
|
|
//Adopted
|
|
{
|
|
selector: '.notenabled:nth-child(11) > td:nth-child(2)',
|
|
label: '2013',
|
|
expected: {
|
|
text: '2013',
|
|
font: 'Poppins, sans-serif',
|
|
color: 'rgba(119, 119, 119, 1)',
|
|
size: '12.87px'
|
|
}
|
|
},
|
|
|
|
//Pre K*
|
|
{
|
|
selector: '.notenabled:nth-child(11) .notenabled',
|
|
label: 'Pre K*',
|
|
expected: {
|
|
text: 'Pre K*',
|
|
font: 'Poppins, sans-serif',
|
|
color: 'rgba(119, 119, 119, 1)',
|
|
size: '11.583px'
|
|
}
|
|
}
|
|
];
|
|
|
|
const allErrors = [];
|
|
|
|
async function validateCell({ selector, label, expected }) {
|
|
const element = await driver.findElement(By.css(selector));
|
|
|
|
const actualText = await element.getText();
|
|
const actualFont = await element.getCssValue('font-family');
|
|
const actualSize = await element.getCssValue('font-size');
|
|
const actualColor = await element.getCssValue('color');
|
|
|
|
const errors = [];
|
|
|
|
//text
|
|
if (actualText === expected.text) {
|
|
console.log(`Passed: DIV - More Info Alabama Row 11 ${label} label text matched as expected`);
|
|
} else {
|
|
errors.push(`Expected: DIV - More Info Alabama Row 11 "${expected.text}"; Actual: "${actualText}"`);
|
|
}
|
|
|
|
//font
|
|
if (actualFont === expected.font) {
|
|
console.log(`Passed: DIV - More Info Alabama Row 11 ${label} label text font matched as expected`);
|
|
} else {
|
|
errors.push(`Expected: DIV - More Info Alabama Row 11 "${expected.font}"; Actual: "${actualFont}"`);
|
|
}
|
|
|
|
//size
|
|
if (actualSize === expected.size) {
|
|
console.log(`Passed: DIV - More Info Alabama Row 11 ${label} label text font-size matched as expected`);
|
|
} else {
|
|
errors.push(`Expected: DIV - More Info Alabama Row 11 ${label} label text font-size "${expected.size}"; Actual: "${actualSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (actualColor === expected.color) {
|
|
console.log(`Passed: DIV - More Info Alabama Row 11 ${label} label text color matched as expected`);
|
|
} else {
|
|
errors.push(`Expected: DIV - More Info Alabama Row 11 ${label} label text color "${expected.color}"; Actual: "${actualColor}"`);
|
|
}
|
|
|
|
return errors;
|
|
}
|
|
|
|
for (const check of checks) {
|
|
const errs = await validateCell(check);
|
|
allErrors.push(...errs);
|
|
}
|
|
|
|
if (allErrors.length > 0) {
|
|
if (allErrors.length > 1) allErrors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
throw new Error(allErrors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//DIV - More Info Alabama Row 12 label text
|
|
{
|
|
description: 'Validate DIV - More Info Alabama Row 12 label text, color, and font size',
|
|
action: async () => {
|
|
const multipleChecks = 'DIV - More Info Alabama Row 12 label';
|
|
|
|
const checks = [
|
|
//Subject
|
|
{
|
|
selector: '.notenabled:nth-child(12) > td:nth-child(1)',
|
|
label: 'World Languages*',
|
|
expected: {
|
|
text: 'World Languages*',
|
|
font: 'Poppins, sans-serif',
|
|
color: 'rgba(119, 119, 119, 1)',
|
|
size: '12.87px'
|
|
}
|
|
},
|
|
|
|
//Adopted
|
|
{
|
|
selector: '.notenabled:nth-child(12) > td:nth-child(2)',
|
|
label: '2017',
|
|
expected: {
|
|
text: '2017',
|
|
font: 'Poppins, sans-serif',
|
|
color: 'rgba(119, 119, 119, 1)',
|
|
size: '12.87px'
|
|
}
|
|
},
|
|
|
|
//All Grades list
|
|
{
|
|
selector: '.notenabled:nth-child(12) > td:nth-child(3)',
|
|
label: 'Grades List',
|
|
expected: {
|
|
text: 'K, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12',
|
|
font: 'Poppins, sans-serif',
|
|
color: 'rgba(119, 119, 119, 1)',
|
|
size: '12.87px'
|
|
}
|
|
}
|
|
];
|
|
|
|
const allErrors = [];
|
|
|
|
async function validateCell({ selector, label, expected }) {
|
|
const element = await driver.findElement(By.css(selector));
|
|
|
|
const actualText = await element.getText();
|
|
const actualFont = await element.getCssValue('font-family');
|
|
const actualSize = await element.getCssValue('font-size');
|
|
const actualColor = await element.getCssValue('color');
|
|
|
|
const errors = [];
|
|
|
|
//text
|
|
if (actualText === expected.text) {
|
|
console.log(`Passed: DIV - More Info Alabama Row 10 ${label} label text matched as expected`);
|
|
} else {
|
|
errors.push(`Expected: DIV - More Info Alabama Row 10 "${expected.text}"; Actual: "${actualText}"`);
|
|
}
|
|
|
|
//font
|
|
if (actualFont === expected.font) {
|
|
console.log(`Passed: DIV - More Info Alabama Row 10 ${label} label text font matched as expected`);
|
|
} else {
|
|
errors.push(`Expected: DIV - More Info Alabama Row 10 "${expected.font}"; Actual: "${actualFont}"`);
|
|
}
|
|
|
|
//size
|
|
if (actualSize === expected.size) {
|
|
console.log(`Passed: DIV - More Info Alabama Row 10 ${label} label text font-size matched as expected`);
|
|
} else {
|
|
errors.push(`Expected: DIV - More Info Alabama Row 10 ${label} label text font-size "${expected.size}"; Actual: "${actualSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (actualColor === expected.color) {
|
|
console.log(`Passed: DIV - More Info Alabama Row 10 ${label} label text color matched as expected`);
|
|
} else {
|
|
errors.push(`Expected: DIV - More Info Alabama Row 10 ${label} label text color "${expected.color}"; Actual: "${actualColor}"`);
|
|
}
|
|
|
|
return errors;
|
|
}
|
|
|
|
for (const check of checks) {
|
|
const errs = await validateCell(check);
|
|
allErrors.push(...errs);
|
|
}
|
|
|
|
if (allErrors.length > 0) {
|
|
if (allErrors.length > 1) allErrors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
throw new Error(allErrors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//NEXT ACTION
|
|
{
|
|
description: 'Dashboard - Click DIV X icon',
|
|
action: async () => {
|
|
await driver.findElement(By.css('.modal-lg .modal-header span')).click();
|
|
console.log('----->| NEXT ACTION: Clicked DIV X icon');
|
|
|
|
//Wait for page to load completely
|
|
await driver.wait(async () => {
|
|
const readyState = await driver.executeScript('return document.readyState');
|
|
return readyState === 'complete';
|
|
}, 20000, 'ExACT Dashboard did not fully load within 60 seconds');
|
|
console.log('Passed: ExACT Dashboard loaded successfully');
|
|
}
|
|
},
|
|
|
|
//NEXT ACTION
|
|
{
|
|
description: 'Dashboard - Click Alabama View icon',
|
|
action: async () => {
|
|
await driver.findElement(By.css('tr:nth-child(1) > .text-center:nth-child(5) img')).click();
|
|
console.log('----->| NEXT ACTION: Clicked Alabama View icon');
|
|
|
|
//Wait for page readyState
|
|
await driver.wait(async () => {
|
|
const readyState = await driver.executeScript('return document.readyState');
|
|
return readyState === 'complete';
|
|
}, 30000, 'Browse standards page did not fully load within 30 seconds');
|
|
|
|
//Wait until the modal title is located AND visible
|
|
await driver.wait(async () => {
|
|
try {
|
|
const element = await driver.findElement(By.linkText('Content'));
|
|
return await element.isDisplayed();
|
|
} catch (e) {
|
|
return false; //Element not ready yet, keep waiting
|
|
}
|
|
}, 20000, 'Content tab did not become visible within 20 seconds');
|
|
|
|
console.log('Passed: Content tab loaded successfully');
|
|
}
|
|
},
|
|
|
|
//Content tab title
|
|
{
|
|
description: 'Validate Content tab title text, size, and color',
|
|
action: async () => {
|
|
const multipleChecks = 'Content tab title';
|
|
const element = await driver.findElement(By.linkText('Content'));
|
|
|
|
//Get text, font, size, and color
|
|
const elementText = await element.getText();
|
|
const elementTextFont = await element.getCssValue('font-family');
|
|
const elementTextSize = await element.getCssValue('font-size');
|
|
const elementTextColor = await element.getCssValue('color');
|
|
const elementButtonColor = await element.getCssValue('background-color');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//text
|
|
if (elementText === 'Content') {
|
|
console.log('Passed: Content tab title text matched as expected');
|
|
} else {
|
|
errors.push(`Expected: "Content"; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//font
|
|
if (elementTextFont === 'Poppins, sans-serif') {
|
|
console.log('Passed: Content tab title font-family matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Content tab title font-family "Poppins, sans-serif"; Actual: ${elementTextFont}`);
|
|
}
|
|
|
|
//size
|
|
if (elementTextSize === '15px') {
|
|
console.log('Passed: Content tab title text font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Content tab title text font-size "15px"; Actual: "${elementTextSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementTextColor === 'rgba(182, 186, 181, 1)') {
|
|
console.log('Passed: Content tab title text color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Content tab title text color: "rgba(182, 186, 181, 1)"; Actual: "${elementTextColor}"`);
|
|
}
|
|
|
|
//button color
|
|
if (elementButtonColor === 'rgba(0, 0, 0, 0)') {
|
|
console.log('Passed: Content tab background color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Content tab background color: "rgba(0, 0, 0, 0)"; Actual: "${elementButtonColor}"`);
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Standards tab tab title (active)
|
|
{
|
|
description: 'Validate Standards tab title text, size, and color',
|
|
action: async () => {
|
|
const multipleChecks = 'By Standard tab title';
|
|
const element = await driver.findElement(By.linkText('Standards'));
|
|
|
|
//Get text, font, size, and color
|
|
const elementText = await element.getText();
|
|
const elementTextFont = await element.getCssValue('font-family');
|
|
const elementTextSize = await element.getCssValue('font-size');
|
|
const elementTextColor = await element.getCssValue('color');
|
|
const elementButtonColor = await element.getCssValue('background-color');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//text
|
|
if (elementText === 'Standards') {
|
|
console.log('Passed: Standards tab title text matched as expected');
|
|
} else {
|
|
errors.push(`Expected: "Standards"; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//font
|
|
if (elementTextFont === 'Poppins, sans-serif') {
|
|
console.log('Passed: Standards tab title font-family matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Standards tab title font-family "Poppins, sans-serif"; Actual: ${elementTextFont}`);
|
|
}
|
|
|
|
//size
|
|
if (elementTextSize === '15px') {
|
|
console.log('Passed: Standards tab title text font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Standards tab title text font-size "15px"; Actual: "${elementTextSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementTextColor === 'rgba(255, 255, 255, 1)') {
|
|
console.log('Passed: Standards tab title text color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Standards tab title text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`);
|
|
}
|
|
|
|
//button color
|
|
if (elementButtonColor === 'rgba(40, 39, 90, 1)') {
|
|
console.log('Passed: Standards tab background color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Standards tab background color: "rgba(40, 39, 90, 1)"; Actual: "${elementButtonColor}"`);
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//AutoAlign tab title
|
|
{
|
|
description: 'Validate AutoAlign tab title text, size, and color',
|
|
action: async () => {
|
|
const multipleChecks = 'AutoAlign tab title';
|
|
const element = await driver.findElement(By.linkText('AutoAlign'));
|
|
|
|
//Get text, font, size, and color
|
|
const elementText = await element.getText();
|
|
const elementTextFont = await element.getCssValue('font-family');
|
|
const elementTextSize = await element.getCssValue('font-size');
|
|
const elementTextColor = await element.getCssValue('color');
|
|
const elementButtonColor = await element.getCssValue('background-color');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//text
|
|
if (elementText === 'AutoAlign') {
|
|
console.log('Passed: AutoAlign tab title text matched as expected');
|
|
} else {
|
|
errors.push(`Expected: "AutoAlign"; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//font
|
|
if (elementTextFont === 'Poppins, sans-serif') {
|
|
console.log('Passed: AutoAlign tab title font-family matched as expected');
|
|
} else {
|
|
errors.push(`Expected: AutoAlign tab title font-family "DM Serif Display, serif"; Actual: ${elementTextFont}`);
|
|
}
|
|
|
|
//size
|
|
if (elementTextSize === '15px') {
|
|
console.log('Passed: AutoAlign tab title text font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: AutoAlign tab title text font-size "15px"; Actual: "${elementTextSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementTextColor === 'rgba(182, 186, 181, 1)') {
|
|
console.log('Passed: AutoAlign tab title text color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: AutoAlign tab title text color: "rgba(182, 186, 181, 1)"; Actual: "${elementTextColor}"`);
|
|
}
|
|
|
|
//button color
|
|
if (elementButtonColor === 'rgba(0, 0, 0, 0)') {
|
|
console.log('Passed: AutoAlign tab background color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: AutoAlign tab background color: "rgba(0, 0, 0, 0)"; Actual: "${elementButtonColor}"`);
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Browse - Browse standards sub-title
|
|
{
|
|
description: 'Validate Browse - Browse standards sub-title text, color, and size',
|
|
action: async () => {
|
|
const multipleChecks = 'Browse sub-title';
|
|
const element = await driver.findElement(By.css('#std .fom-title'));
|
|
|
|
//Get text, font, size, and color
|
|
const elementText = await element.getText();
|
|
const elementFont = await element.getCssValue('font-family');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
const elementColor = await element.getCssValue('color');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//text
|
|
if (elementText === 'Browse standards') {
|
|
console.log("Passed: Browse page - Browse standards sub-title matched as expected");
|
|
} else {
|
|
errors.push(`Expected: "Browse standards" sub-title; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//font
|
|
if (elementFont === 'Poppins, sans-serif') {
|
|
console.log('Passed: Browse page - Browse standards sub-title font-family matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Browse page - Browse standards sub-title font-family "DM Serif Display, serif"; Actual: ${elementFont}`);
|
|
}
|
|
|
|
//size
|
|
if (elementSize === '13px') {
|
|
console.log('Passed: Browse page - Browse standards sub-title text font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Browse page - Browse standards sub-title text font-size "13px"; Actual: "${elementSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementColor === 'rgba(40, 39, 90, 1)') {
|
|
console.log('Passed: Browse page - Browse standards sub-title text color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Browse page - Browse standards sub-title text color "rgba(40, 39, 90, 1)"; Actual: "${elementColor}"`);
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Standards label
|
|
{
|
|
description: 'Validate Standards label text, font, size, and color',
|
|
action: async () => {
|
|
const multipleChecks = 'Standards label';
|
|
const element = await driver.findElement(By.css('#browse-standards > .form-group:nth-child(1) > .col-sm-12'));
|
|
|
|
//Get text, font, size, and color
|
|
const elementText = await element.getText();
|
|
const elementFont = await element.getCssValue('font-family');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
const elementColor = await element.getCssValue('color');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//text
|
|
if (elementText === 'Standards') {
|
|
console.log("Passed: Standards label matched as expected");
|
|
} else {
|
|
errors.push(`Expected: "Standards" label; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//font
|
|
if (elementFont === 'Poppins, sans-serif') {
|
|
console.log('Passed: Standards label font-family matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Standards label font-family "DM Serif Display, serif"; Actual: ${elementFont}`);
|
|
}
|
|
|
|
//size
|
|
if (elementSize === '13px') {
|
|
console.log('Passed: Standards label text font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Standards label text font-size "13px"; Actual: "${elementSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementColor === 'rgba(40, 39, 90, 1)') {
|
|
console.log('Passed: Standards label text color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Standards label text color "rgba(40, 39, 90, 1)"; Actual: "${elementColor}"`);
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Standards dropdown
|
|
{
|
|
description: 'Validate Standards dropdown list and value',
|
|
action: async () => {
|
|
const multipleChecks = 'Standards Dropdown List';
|
|
const select = await driver.findElement(By.css('#stdselect'));
|
|
|
|
//Get text, font, size, and color
|
|
const selectedOption = await select.findElement(By.css('option:checked'));
|
|
const elementText = await selectedOption.getText();
|
|
const elementFont = await selectedOption.getCssValue('font-family');
|
|
const elementSize = await selectedOption.getCssValue('font-size');
|
|
const elementColor = await selectedOption.getCssValue('color');
|
|
|
|
//text
|
|
if (elementText === 'Alabama') {
|
|
console.log("Passed: Alabama default option matched as expected");
|
|
} else {
|
|
errors.push(`Expected option: "Alabama"; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//font
|
|
if (elementFont === 'Poppins, sans-serif') {
|
|
console.log('Passed: Alabama default text font-family matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Alabama default text font-family "DM Serif Display, serif"; Actual: ${elementFont}`);
|
|
}
|
|
|
|
//size
|
|
if (elementSize === '13px') {
|
|
console.log('Passed: Alabama default text font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Alabama default text font-size "13px"; Actual: "${elementSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementColor === 'rgba(40, 39, 90, 1)') {
|
|
console.log('Passed: Alabama default text color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Alabama default text color "rgba(40, 39, 90, 1)"; Actual: "${elementColor}"`);
|
|
}
|
|
|
|
const options = await select.findElements(By.css('option'));
|
|
const expectedList = [
|
|
'Select standards',
|
|
'Alabama',
|
|
'Arizona',
|
|
'California',
|
|
'Florida',
|
|
'Georgia',
|
|
'Illinois',
|
|
'New York',
|
|
'Texas',
|
|
'Washington',
|
|
'Common Core State Standards',
|
|
'Alberta Standards',
|
|
'Ontario Curriculum',
|
|
'Australian Curriculum (ACARA) v8',
|
|
'New South Wales',
|
|
'NCSSFL-ACTFL CAN-DO STATEMENTS',
|
|
'WIDA Consortium (2020)',
|
|
'5th Grade Import ECS-2732',
|
|
'Imported Framework Updated',
|
|
'NewTicket',
|
|
'ECS-2933 Testing On Prod',
|
|
'Widget Test',
|
|
'ecs31444',
|
|
'California Mathematics 1997',
|
|
'Georgia Archived Language Arts QA',
|
|
'Georgia Current Language Arts QA',
|
|
'Georgia Future Language Arts QA',
|
|
'create group test',
|
|
'IMport Test',
|
|
'Georgia WL Import'
|
|
];
|
|
const actual = [];
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
for (const opt of options) {
|
|
const text = (await opt.getText()).trim();
|
|
actual.push(text);
|
|
}
|
|
|
|
if (JSON.stringify(actual) === JSON.stringify(expectedList)) {
|
|
console.log('Passed: Standards Dropdown list matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Standards Dropdown list: ${JSON.stringify(expectedList)}, Actual: ${JSON.stringify(actual)}`);
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Standards Display label
|
|
{
|
|
description: 'Validate Standards Display label text, font, size, and color',
|
|
action: async () => {
|
|
const multipleChecks = 'Standards Display label';
|
|
const element = await driver.findElement(By.css('.form-group:nth-child(2) > .col-sm-2'));
|
|
|
|
//Get text, font, size, and color
|
|
const elementText = await element.getText();
|
|
const elementFont = await element.getCssValue('font-family');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
const elementColor = await element.getCssValue('color');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//text
|
|
if (elementText === 'Standards Display') {
|
|
console.log("Passed: Standards Display label text matched as expected");
|
|
} else {
|
|
errors.push(`Expected: ""Standards Display" label text; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//font
|
|
if (elementFont === 'Poppins, sans-serif') {
|
|
console.log('Passed: Standards Display label font-family matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Standards Display label font-family "DM Serif Display, serif"; Actual: ${elementFont}`);
|
|
}
|
|
|
|
//size
|
|
if (elementSize === '13px') {
|
|
console.log('Passed: Standards Display label text font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Standards Display label text font-size "13px"; Actual: "${elementSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementColor === 'rgba(40, 39, 90, 1)') {
|
|
console.log('Passed: Standards Display label text color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Standards Display label text color "rgba(40, 39, 90, 1)"; Actual: "${elementColor}"`);
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//All radio option
|
|
{
|
|
description: 'Validate All radio option text, font, size, and color',
|
|
action: async () => {
|
|
const multipleChecks = 'All radio option';
|
|
const elementOption = await driver.findElement(By.css('#gap1')).getAttribute('checked');
|
|
const element = await driver.findElement(By.css('.form-check:nth-child(1) > .form-check-label'));
|
|
|
|
//Get text, font, size, and color
|
|
const elementText = await element.getText();
|
|
const elementTextFont = await element.getCssValue('font-family');
|
|
const elementTextSize = await element.getCssValue('font-size');
|
|
const elementTextColor = await element.getCssValue('color');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//icon
|
|
if (elementOption === 'true') {
|
|
console.log('Passed: All radio option selected as expected');
|
|
} else {
|
|
throw new Error(`All radio option value was not selected; Actual: "${elementOption}"`);
|
|
}
|
|
|
|
//text
|
|
if (elementText === 'All') {
|
|
console.log('Passed: All radio label text matched as expected');
|
|
} else {
|
|
errors.push(`Expected: "All" radio label text; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//font-family
|
|
if (elementTextFont === 'Poppins, sans-serif') {
|
|
console.log('Passed: All radio label font matched as expected');
|
|
} else {
|
|
errors.push(`Expected: All radio label font "DM Serif Display, serif"; Actual: ${elementTextFont}`);
|
|
}
|
|
|
|
//font size
|
|
if (elementTextSize === '13px') {
|
|
console.log('Passed: All radio label text font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: All radio label text font-size "13px"; Actual: "${elementTextSize}"`);
|
|
}
|
|
|
|
//text color
|
|
if (elementTextColor === 'rgba(40, 39, 90, 1)') {
|
|
console.log('Passed: All radio label text color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: All radio label text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`);
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Correlated Only radio option
|
|
{
|
|
description: 'Validate Correlated Only radio option text, font, size, and color',
|
|
action: async () => {
|
|
const multipleChecks = 'Correlated Only radio option';
|
|
const elementOption = await driver.findElement(By.css('#gap2'));
|
|
const element = await driver.findElement(By.css('.form-check:nth-child(2) > .form-check-label'));
|
|
|
|
//Get text, font, size, and color
|
|
const elementText = await element.getText();
|
|
const elementTextFont = await element.getCssValue('font-family');
|
|
const elementTextSize = await element.getCssValue('font-size');
|
|
const elementTextColor = await element.getCssValue('color');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//icon
|
|
if (elementOption) {
|
|
console.log('Passed: Correlated Only radio option is present');
|
|
} else {
|
|
throw new Error(`Correlated Only radio option was not found; Actual: "${elementOption}"`);
|
|
}
|
|
|
|
//text
|
|
if (elementText === 'Correlated Only') {
|
|
console.log('Passed: Correlated Only radio label text matched as expected');
|
|
} else {
|
|
errors.push(`Expected: "Correlated Only" radio label text; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//font-family
|
|
if (elementTextFont === 'Poppins, sans-serif') {
|
|
console.log('Passed: Correlated Only radio label font matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Correlated Only radio label font "DM Serif Display, serif"; Actual: ${elementTextFont}`);
|
|
}
|
|
|
|
//font size
|
|
if (elementTextSize === '13px') {
|
|
console.log('Passed: Correlated Only radio label text font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Correlated Only radio label text font-size "13px"; Actual: "${elementTextSize}"`);
|
|
}
|
|
|
|
//text color
|
|
if (elementTextColor === 'rgba(40, 39, 90, 1)') {
|
|
console.log('Passed: Correlated Only radio label text color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Correlated Only radio label text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`);
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Uncorrelated Only radio option
|
|
{
|
|
description: 'Validate Uncorrelated Only radio option text, font, size, and color',
|
|
action: async () => {
|
|
const multipleChecks = 'Uncorrelated Only radio option';
|
|
const elementOption = await driver.findElement(By.css('#gap3'));
|
|
const element = await driver.findElement(By.css('.form-check:nth-child(3) > .form-check-label'));
|
|
|
|
//Get text, font, size, and color
|
|
const elementText = await element.getText();
|
|
const elementTextFont = await element.getCssValue('font-family');
|
|
const elementTextSize = await element.getCssValue('font-size');
|
|
const elementTextColor = await element.getCssValue('color');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//icon
|
|
if (elementOption) {
|
|
console.log('Passed: Uncorrelated Only radio option is present');
|
|
} else {
|
|
throw new Error(`Uncorrelated Only radio option was not found; Actual: "${elementOption}"`);
|
|
}
|
|
|
|
//text
|
|
if (elementText === 'Uncorrelated Only') {
|
|
console.log('Passed: Uncorrelated Only radio label text matched as expected');
|
|
} else {
|
|
errors.push(`Expected: "Uncorrelated Only" radio label text; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//font-family
|
|
if (elementTextFont === 'Poppins, sans-serif') {
|
|
console.log('Passed: Uncorrelated Only radio label font matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Uncorrelated Only radio label font "DM Serif Display, serif"; Actual: ${elementTextFont}`);
|
|
}
|
|
|
|
//font size
|
|
if (elementTextSize === '13px') {
|
|
console.log('Passed: Uncorrelated Only radio label text font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Uncorrelated Only radio label text font-size "13px"; Actual: "${elementTextSize}"`);
|
|
}
|
|
|
|
//text color
|
|
if (elementTextColor === 'rgba(40, 39, 90, 1)') {
|
|
console.log('Passed: Uncorrelated Only radio label text color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Uncorrelated Only radio label text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`);
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Subject label
|
|
{
|
|
description: 'Validate Subject label text, font, size, and color',
|
|
action: async () => {
|
|
const multipleChecks = 'Subject label';
|
|
const element = await driver.findElement(By.css('.hideSubject > .col-form-label'));
|
|
|
|
//Get text, font, size, and color
|
|
const elementText = await element.getText();
|
|
const elementFont = await element.getCssValue('font-family');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
const elementColor = await element.getCssValue('color');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//text
|
|
if (elementText === 'Subject') {
|
|
console.log("Passed: Subject label text matched as expected");
|
|
} else {
|
|
errors.push(`Expected: "Subject" label text; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//font
|
|
if (elementFont === 'Poppins, sans-serif') {
|
|
console.log('Passed: Subject label font-family matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Subject label font-family "DM Serif Display, serif"; Actual: ${elementFont}`);
|
|
}
|
|
|
|
//size
|
|
if (elementSize === '13px') {
|
|
console.log('Passed: Subject label text font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Subject label text font-size "13px"; Actual: "${elementSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementColor === 'rgba(40, 39, 90, 1)') {
|
|
console.log('Passed: Subject label text color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Subject label text color "rgba(40, 39, 90, 1)"; Actual: "${elementColor}"`);
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Subject dropdown
|
|
{
|
|
description: 'Validate Subject dropdown list and value',
|
|
action: async () => {
|
|
const multipleChecks = 'Subject Dropdown List';
|
|
const select = await driver.findElement(By.css('#selectSubjects'));
|
|
|
|
//Get text, font, size, and color
|
|
const selectedOption = await select.findElement(By.css('option:checked'));
|
|
const elementText = await selectedOption.getText();
|
|
const elementFont = await selectedOption.getCssValue('font-family');
|
|
const elementSize = await selectedOption.getCssValue('font-size');
|
|
const elementColor = await selectedOption.getCssValue('color');
|
|
|
|
//text
|
|
if (elementText === 'Select a subject') {
|
|
console.log("Passed: Select a subject default option matched as expected");
|
|
} else {
|
|
errors.push(`Expected option: "Select a subject"; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//font
|
|
if (elementFont === 'Poppins, sans-serif') {
|
|
console.log('Passed: Select a subject default text font-family matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Select a subject default text font-family "DM Serif Display, serif"; Actual: ${elementFont}`);
|
|
}
|
|
|
|
//size
|
|
if (elementSize === '13px') {
|
|
console.log('Passed: Select a subject default text font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Select a subject default text font-size "13px"; Actual: "${elementSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementColor === 'rgba(40, 39, 90, 1)') {
|
|
console.log('Passed: Select a subject default text color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Select a subject default text color "rgba(40, 39, 90, 1)"; Actual: "${elementColor}"`);
|
|
}
|
|
|
|
const options = await select.findElements(By.css('option'));
|
|
const expectedList = [
|
|
'Select a subject',
|
|
'Health and PE',
|
|
'Language Arts',
|
|
"Mathematics",
|
|
"Science",
|
|
"Social Studies",
|
|
"Technology Education"
|
|
];
|
|
const actual = [];
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
for (const opt of options) {
|
|
const text = (await opt.getText()).trim();
|
|
actual.push(text);
|
|
}
|
|
|
|
if (JSON.stringify(actual) === JSON.stringify(expectedList)) {
|
|
console.log('Passed: Subject Dropdown list matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Subject Dropdown list: ${JSON.stringify(expectedList)}, Actual: ${JSON.stringify(actual)}`);
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Grade label and dropdown
|
|
{
|
|
description: 'Validate Grade label and dropdown are hidden',
|
|
action: async () => {
|
|
const multipleChecks = 'Grade label and dropdown are hidden';
|
|
const errors = [];
|
|
|
|
const visibility = await driver.executeScript(`
|
|
const hideGradeDiv = document.querySelector('.hideGrade');
|
|
if (!hideGradeDiv) return { found: false };
|
|
const style = window.getComputedStyle(hideGradeDiv);
|
|
return {
|
|
found: true,
|
|
hidden: style.display === 'none',
|
|
display: style.display
|
|
};
|
|
`);
|
|
//console.log('----->| DEBUG hideGrade visibility:', JSON.stringify(visibility));
|
|
|
|
//Both label and dropdown are inside the same hideGrade div
|
|
//so we only need to check the parent container once
|
|
if (visibility.found && visibility.hidden) {
|
|
console.log('Passed: Grade label is hidden as expected');
|
|
console.log('Passed: Grade dropdown is hidden as expected');
|
|
} else {
|
|
errors.push(`Expected: Grade label and dropdown to be hidden; Actual: display="${visibility.display}"`);
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Show Correlations From label
|
|
{
|
|
description: 'Validate Show Correlations From label text, font, size, and color',
|
|
action: async () => {
|
|
const multipleChecks = 'Show Correlations From label';
|
|
const element = await driver.findElement(By.css('.form-group:nth-child(3) > .col-form-label'));
|
|
|
|
//Get text, font, size, and color
|
|
const elementText = await element.getText();
|
|
const elementFont = await element.getCssValue('font-family');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
const elementColor = await element.getCssValue('color');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//text
|
|
if (elementText === 'Show Correlations From') {
|
|
console.log("Passed: Show Correlations From label text matched as expected");
|
|
} else {
|
|
errors.push(`Expected: "Show Correlations From" label text; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//font
|
|
if (elementFont === 'Poppins, sans-serif') {
|
|
console.log('Passed: Show Correlations From label font-family matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Show Correlations From label font-family "DM Serif Display, serif"; Actual: ${elementFont}`);
|
|
}
|
|
|
|
//size
|
|
if (elementSize === '13px') {
|
|
console.log('Passed: Show Correlations From label text font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Show Correlations From label text font-size "13px"; Actual: "${elementSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementColor === 'rgba(40, 39, 90, 1)') {
|
|
console.log('Passed: Show Correlations From label text color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Show Correlations From label text color "rgba(40, 39, 90, 1)"; Actual: "${elementColor}"`);
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Show Correlations From dropdown value
|
|
{
|
|
description: 'Validate Show Correlations From dropdown value',
|
|
action: async () => {
|
|
const multipleChecks = 'Show Correlations From dropdown value';
|
|
|
|
//Locate and validate selected (collapsed) value
|
|
const dropdownButton = await driver.findElement(
|
|
By.css('button.multiselect.dropdown-toggle')
|
|
);
|
|
|
|
const selectedOption = await driver.findElement(By.css('#browse-standards > div:nth-child(3) > div > div > div:nth-child(3) > div > div > button > span'));
|
|
|
|
//Get text, font, size, and color
|
|
const elementText = await selectedOption.getText('');
|
|
const elementFont = await selectedOption.getCssValue('font-family');
|
|
const elementSize = await selectedOption.getCssValue('font-size');
|
|
const elementColor = await selectedOption.getCssValue('color');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//text
|
|
if (elementText === 'All Content Sets') {
|
|
console.log("Passed: All Content Sets default option matched as expected");
|
|
} else {
|
|
errors.push(`Expected option: "All Content Sets"; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//font
|
|
if (elementFont === 'Poppins, sans-serif') {
|
|
console.log('Passed: All Content Sets default text font-family matched as expected');
|
|
} else {
|
|
errors.push(`Expected: All Content Sets default text font-family "DM Serif Display, serif"; Actual: ${elementFont}`);
|
|
}
|
|
|
|
//size
|
|
if (elementSize === '16px') {
|
|
console.log('Passed: All Content Sets default text font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: All Content Sets default text font-size "16px"; Actual: "${elementSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementColor === 'rgba(33, 37, 41, 1)') {
|
|
console.log('Passed: All Content Sets default text color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: All Content Sets default text color "rgba(33, 37, 41, 1)"; Actual: "${elementColor}"`);
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Term Search label
|
|
{
|
|
description: 'Validate Term Search label text, font, size, and color',
|
|
action: async () => {
|
|
const multipleChecks = 'Term Search label';
|
|
const element = await driver.findElement(By.css('.form-group:nth-child(7) > .col-sm-2'));
|
|
|
|
//Get text, font, size, and color
|
|
const elementText = await element.getText();
|
|
const elementFont = await element.getCssValue('font-family');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
const elementColor = await element.getCssValue('color');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//text
|
|
if (elementText === 'Term Search') {
|
|
console.log("Passed: Term Search label text matched as expected");
|
|
} else {
|
|
errors.push(`Expected: "Term Search" label text; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//font
|
|
if (elementFont === 'Poppins, sans-serif') {
|
|
console.log('Passed: Term Search label font-family matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Term Search label font-family "DM Serif Display, serif"; Actual: ${elementFont}`);
|
|
}
|
|
|
|
//size
|
|
if (elementSize === '13px') {
|
|
console.log('Passed: Term Search label text font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Term Search label text font-size "13px"; Actual: "${elementSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementColor === 'rgba(40, 39, 90, 1)') {
|
|
console.log('Passed: Term Search label text color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Term Search label text color "rgba(40, 39, 90, 1)"; Actual: "${elementColor}"`);
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Term Search placeholder
|
|
{
|
|
description: 'Validate Term Search placeholder',
|
|
action: async () => {
|
|
const elementPlaceholder = await driver.findElement(By.css('#searchTerm')).getAttribute('placeholder');
|
|
|
|
if (elementPlaceholder === '') {
|
|
console.log('Passed: Term Search "blank" placeholder text matched as expected');
|
|
} else {
|
|
throw new Error(`Expected: Term Search "blank" placeholder text; Actual: "${elementPlaceholder}"`);
|
|
}
|
|
}
|
|
},
|
|
|
|
//Include Related Standards checkbox
|
|
{
|
|
description: 'Validate Include Related Standards checkbox',
|
|
action: async () => {
|
|
const elementType = await driver.findElement(By.css('#doRel')).getAttribute('type');
|
|
|
|
if (elementType === 'checkbox') {
|
|
console.log('Passed: Include Related Standards checkbox type matched as expected');
|
|
} else {
|
|
throw new Error(`Include Related Standards checkbox type did not match; Actual: "${elementType}"`);
|
|
}
|
|
}
|
|
},
|
|
|
|
//Include Related Standards label
|
|
{
|
|
description: 'Validate Include Related Standards label text, font, size, and color',
|
|
action: async () => {
|
|
const multipleChecks = 'Include Related Standards label';
|
|
const element = await driver.findElement(By.css('.col-sm-offset-2 > label'));
|
|
|
|
//Get text, font, size, and color
|
|
const elementText = await element.getText();
|
|
const elementFont = await element.getCssValue('font-family');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
const elementColor = await element.getCssValue('color');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//text
|
|
if (elementText === 'Include Related Standards') {
|
|
console.log("Passed: Include Related Standards label text matched as expected");
|
|
} else {
|
|
errors.push(`Expected: "Include Related Standards" label text; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//font
|
|
if (elementFont === 'Poppins, sans-serif') {
|
|
console.log('Passed: Include Related Standards label font-family matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Include Related Standards label font-family "DM Serif Display, serif"; Actual: ${elementFont}`);
|
|
}
|
|
|
|
//size
|
|
if (elementSize === '13px') {
|
|
console.log('Passed: Include Related Standards label text font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Include Related Standards label text font-size "13px"; Actual: "${elementSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementColor === 'rgba(40, 39, 90, 1)') {
|
|
console.log('Passed: Include Related Standards label text color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Include Related Standards label text color "rgba(40, 39, 90, 1)"; Actual: "${elementColor}"`);
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Search button
|
|
{
|
|
description: 'Validate Search button text, size, and color',
|
|
action: async () => {
|
|
const multipleChecks = 'Search button';
|
|
const element = await driver.findElement(By.css('#stdsubmit'));
|
|
|
|
//Get text, font, size, and color
|
|
const elementText = await element.getAttribute('value');
|
|
const elementTextFont = await element.getCssValue('font-family');
|
|
const elementTextSize = await element.getCssValue('font-size');
|
|
const elementTextColor = await element.getCssValue('color');
|
|
const elementButtonColor = await element.getCssValue('background-color');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//text
|
|
if (elementText === 'Search') {
|
|
console.log('Passed: Search button text matched as expected');
|
|
} else {
|
|
errors.push(`Expected: "Search"; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//font
|
|
if (elementTextFont === 'Poppins, sans-serif') {
|
|
console.log('Passed: Search button text font-family matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Search button text font-family "Poppins, sans-serif"; Actual: ${elementTextFont}`);
|
|
}
|
|
|
|
//size
|
|
if (elementTextSize === '16px') {
|
|
console.log('Passed: Search button text font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Search button text font-size "16px"; Actual: "${elementTextSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementTextColor === 'rgba(255, 255, 255, 1)') {
|
|
console.log('Passed: Search button text color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Search button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`);
|
|
}
|
|
|
|
//button color
|
|
if (elementButtonColor === 'rgba(48, 200, 172, 1)') {
|
|
console.log('Passed: Search button background color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Search button background color: "rgba(48, 200, 172, 1)"; Actual: "${elementButtonColor}"`);
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//NEXT ACTION
|
|
{
|
|
description: 'Validate alert message',
|
|
action: async () => {
|
|
const multipleChecks = 'Validate alert message';
|
|
const errors = [];
|
|
|
|
//Click delete button
|
|
const element = await driver.findElement(By.css('#stdsubmit')).click();
|
|
await driver.sleep(5000);
|
|
console.log('----->| NEXT ACTION: Clicked Search button');
|
|
|
|
//Wait for confirm dialog to appear
|
|
const alert = await driver.wait(until.alertIsPresent(), 5000);
|
|
console.log('----->| NEXT ACTION: Alert dialog appeared as expected');
|
|
|
|
//Get alert text
|
|
const alertText = await alert.getText();
|
|
|
|
//Validate alert message text
|
|
const expectedText = 'You must select a subject';
|
|
if (alertText === expectedText) {
|
|
console.log('Passed: Alert dialog text matched as expected');
|
|
} else {
|
|
errors.push(`Expected: "${expectedText}"; Actual: "${alertText}"`);
|
|
}
|
|
|
|
//Throw summary before dismissing if errors found
|
|
if (errors.length > 0) {
|
|
await alert.dismiss(); //Cancel the delete if validation failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
|
|
//Accept the alert (click OK) to proceed with deletion
|
|
await alert.accept();
|
|
console.log('----->| NEXT ACTION: Clicked alert message OK button');
|
|
await driver.sleep(2000);
|
|
}
|
|
},
|
|
|
|
//NEXT ACTION
|
|
{
|
|
description: 'Click Subject dropdown',
|
|
action: async () => {
|
|
//Select "Mathematics" from dropdown
|
|
const subjectDropdown = await driver.findElement(By.css('#selectSubjects'));
|
|
const mathematicsOption = await driver.findElement(By.css('#selectSubjects > option:nth-child(4)'));
|
|
|
|
await subjectDropdown.click();
|
|
await driver.sleep(2000);
|
|
|
|
await mathematicsOption.click();
|
|
await driver.sleep(2000);
|
|
console.log('----->| NEXT ACTION: Selected Subject - Mathematics');
|
|
|
|
//Click away to close dropdown
|
|
await driver.findElement(By.css('#browse-standards > .form-group:nth-child(1)')).click();
|
|
|
|
//Wait for the dashboard container to exist in DOM
|
|
await driver.wait(
|
|
until.elementLocated(By.css('#selectGrade')),
|
|
30000,
|
|
'Grade dropdown did not appear within 30 seconds'
|
|
);
|
|
|
|
//Wait for it to be visible
|
|
await driver.wait(async () => {
|
|
try {
|
|
const gradeDropdown = await driver.findElement(By.css('#selectGrade'));
|
|
return await gradeDropdown.isDisplayed();
|
|
} catch (e) {
|
|
return false;
|
|
}
|
|
}, 30000, 'Grade dropdown did not become visible within 30 seconds');
|
|
},
|
|
},
|
|
|
|
//Grade label
|
|
{
|
|
description: 'Validate Grade label text, font, size, and color',
|
|
action: async () => {
|
|
const multipleChecks = 'Grade label';
|
|
const element = await driver.findElement(By.css('.hideGrade > .col-form-label'));
|
|
|
|
//Get text, font, size, and color
|
|
const elementText = await element.getText();
|
|
const elementFont = await element.getCssValue('font-family');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
const elementColor = await element.getCssValue('color');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//text
|
|
if (elementText === 'Grade') {
|
|
console.log("Passed: Grade label text matched as expected");
|
|
} else {
|
|
errors.push(`Expected: "Grade" label text; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//font
|
|
if (elementFont === 'Poppins, sans-serif') {
|
|
console.log('Passed: Grade label font-family matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Grade label font-family "DM Serif Display, serif"; Actual: ${elementFont}`);
|
|
}
|
|
|
|
//size
|
|
if (elementSize === '13px') {
|
|
console.log('Passed: Grade label text font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Grade label text font-size "13px"; Actual: "${elementSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementColor === 'rgba(40, 39, 90, 1)') {
|
|
console.log('Passed: Grade label text color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Grade label text color "rgba(40, 39, 90, 1)"; Actual: "${elementColor}"`);
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Grade dropdown
|
|
{
|
|
description: 'Validate Grade dropdown list and value',
|
|
action: async () => {
|
|
const multipleChecks = 'Grade Dropdown List';
|
|
const select = await driver.findElement(By.css('#selectGrade'));
|
|
|
|
//Get text, font, size, and color
|
|
const selectedOption = await select.findElement(By.css('option:checked'));
|
|
const elementText = await selectedOption.getText();
|
|
const elementFont = await selectedOption.getCssValue('font-family');
|
|
const elementSize = await selectedOption.getCssValue('font-size');
|
|
const elementColor = await selectedOption.getCssValue('color');
|
|
|
|
//text
|
|
if (elementText === 'Select a grade') {
|
|
console.log("Passed: Select a grade default option matched as expected");
|
|
} else {
|
|
errors.push(`Expected option: "Select a grade"; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//font
|
|
if (elementFont === 'Poppins, sans-serif') {
|
|
console.log('Passed: Select a grade default text font-family matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Select a grade default text font-family "DM Serif Display, serif"; Actual: ${elementFont}`);
|
|
}
|
|
|
|
//size
|
|
if (elementSize === '13px') {
|
|
console.log('Passed: Select a grade default text font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Select a grade default text font-size "13px"; Actual: "${elementSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementColor === 'rgba(40, 39, 90, 1)') {
|
|
console.log('Passed: Select a grade default text color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Select a grade default text color "rgba(40, 39, 90, 1)"; Actual: "${elementColor}"`);
|
|
}
|
|
|
|
const options = await select.findElements(By.css('option'));
|
|
const expectedList = [
|
|
'Select a grade',
|
|
'K',
|
|
'1',
|
|
'2',
|
|
'3',
|
|
'4',
|
|
'5',
|
|
'6',
|
|
'7',
|
|
'8',
|
|
'9',
|
|
'10',
|
|
'11',
|
|
'12'
|
|
];
|
|
const actual = [];
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
for (const opt of options) {
|
|
const text = (await opt.getText()).trim();
|
|
actual.push(text);
|
|
}
|
|
|
|
if (JSON.stringify(actual) === JSON.stringify(expectedList)) {
|
|
console.log('Passed: Grade Dropdown list matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Grade Dropdown list: ${JSON.stringify(expectedList)}, Actual: ${JSON.stringify(actual)}`);
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//NEXT ACTION
|
|
{
|
|
description: 'Validate alert message',
|
|
action: async () => {
|
|
const multipleChecks = 'Validate alert message';
|
|
const errors = [];
|
|
|
|
//Click delete button
|
|
const element = await driver.findElement(By.css('#stdsubmit')).click();
|
|
await driver.sleep(5000);
|
|
console.log('----->| NEXT ACTION: Clicked Search button');
|
|
|
|
//Wait for confirm dialog to appear
|
|
const alert = await driver.wait(until.alertIsPresent(), 5000);
|
|
console.log('----->| NEXT ACTION: Alert dialog appeared as expected');
|
|
|
|
//Get alert text
|
|
const alertText = await alert.getText();
|
|
|
|
//Validate alert message text
|
|
const expectedText = 'You must select a grade';
|
|
if (alertText === expectedText) {
|
|
console.log('Passed: Alert dialog text matched as expected');
|
|
} else {
|
|
errors.push(`Expected: "${expectedText}"; Actual: "${alertText}"`);
|
|
}
|
|
|
|
//Throw summary before dismissing if errors found
|
|
if (errors.length > 0) {
|
|
await alert.dismiss(); //Cancel the delete if validation failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
|
|
//Accept the alert (click OK) to proceed with deletion
|
|
await alert.accept();
|
|
console.log('----->| NEXT ACTION: Clicked alert message OK button');
|
|
await driver.sleep(2000);
|
|
}
|
|
},
|
|
|
|
//NEXT ACTION
|
|
{
|
|
description: 'Select grade',
|
|
action: async () => {
|
|
//Select "9" from dropdown
|
|
await driver.findElement(By.css('#selectGrade')).click();
|
|
await driver.sleep(2000);
|
|
await driver.findElement(By.css('#selectGrade > option:nth-child(11)')).click();
|
|
|
|
console.log('----->| NEXT ACTION: Selected grade: 9');
|
|
},
|
|
},
|
|
|
|
//Show Correlations From dropdown
|
|
{
|
|
description: 'Validate Show Correlations From dropdown list and value',
|
|
action: async () => {
|
|
const multipleChecks = 'Show Correlations From dropdown list';
|
|
|
|
//Locate and validate selected (collapsed) value
|
|
const dropdownButton = await driver.findElement(
|
|
By.css('button.multiselect.dropdown-toggle')
|
|
);
|
|
|
|
const selectedOption = await driver.findElement(By.css('#browse-standards > div:nth-child(3) > div > div > div:nth-child(3) > div > div > button > span'));
|
|
|
|
//Get text, font, size, and color
|
|
const elementText = await selectedOption.getText('');
|
|
const elementFont = await selectedOption.getCssValue('font-family');
|
|
const elementSize = await selectedOption.getCssValue('font-size');
|
|
const elementColor = await selectedOption.getCssValue('color');
|
|
|
|
//text
|
|
if (elementText === 'All Content Sets') {
|
|
console.log("Passed: All Content Sets default option matched as expected");
|
|
} else {
|
|
errors.push(`Expected option: "All Content Sets"; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//font
|
|
if (elementFont === 'Poppins, sans-serif') {
|
|
console.log('Passed: All Content Sets default text font-family matched as expected');
|
|
} else {
|
|
errors.push(`Expected: All Content Sets default text font-family "DM Serif Display, serif"; Actual: ${elementFont}`);
|
|
}
|
|
|
|
//size
|
|
if (elementSize === '16px') {
|
|
console.log('Passed: All Content Sets default text font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: All Content Sets default text font-size "16px"; Actual: "${elementSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementColor === 'rgba(33, 37, 41, 1)') {
|
|
console.log('Passed: All Content Sets default text color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: All Content Sets default text color "rgba(33, 37, 41, 1)"; Actual: "${elementColor}"`);
|
|
}
|
|
|
|
//Open dropdown
|
|
await driver.findElement(By.css('.col-sm-12 .multiselect-selected-text')).click();
|
|
await driver.sleep(2000);
|
|
console.log('----->| NEXT ACTION: Clicked Show Correlations From dropdown');
|
|
|
|
//Wait for dropdown list to become visible
|
|
const dropdownMenu = await driver.wait(
|
|
until.elementLocated(By.css('ul.multiselect-container.dropdown-menu.show')),
|
|
10000
|
|
);
|
|
|
|
await driver.wait(
|
|
until.elementIsVisible(dropdownMenu),
|
|
10000
|
|
);
|
|
|
|
//Now safely get option labels
|
|
const optionLabels = await dropdownMenu.findElements(
|
|
By.css('li label.checkbox')
|
|
);
|
|
|
|
//Extract list values
|
|
const actualOptions = [];
|
|
for (const label of optionLabels) {
|
|
const text = (await label.getText()).trim();
|
|
if (text) {
|
|
actualOptions.push(text);
|
|
}
|
|
}
|
|
|
|
const expectedOptions = [
|
|
'Select all',
|
|
'US History III',
|
|
'English I',
|
|
'Algebra',
|
|
'Biology',
|
|
'Copy Move Delete Test 1',
|
|
'Copy Move Delete Test 2',
|
|
'Import Align - Concept Based 1',
|
|
'Import Align - Concept Based 2',
|
|
'Import Align - Direct Align 1',
|
|
'Import Align - Direct Align 2',
|
|
'Math Alignment Import Test',
|
|
'create me',
|
|
'Illustrative Math Test 1',
|
|
'Illustrative Math Test 2',
|
|
'Khan URL test',
|
|
'seesaw test',
|
|
'ECS-3037 On Prod TC2',
|
|
'ECS-3037 On Prod TC1',
|
|
'webinar test',
|
|
'Review Screen Open',
|
|
'New One For Agust Post Night',
|
|
'Post NIght July26',
|
|
'create import test'
|
|
];
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//Length validation
|
|
if (actualOptions.length !== expectedOptions.length) {
|
|
errors.push(
|
|
`Expected option count ${expectedOptions.length}; Actual ${actualOptions.length}`
|
|
);
|
|
}
|
|
|
|
//Value-by-value validation
|
|
expectedOptions.forEach((expected, i) => {
|
|
if (actualOptions[i] !== expected) {
|
|
errors.push(
|
|
`Index ${i}: Expected "${expected}", Actual "${actualOptions[i]}"`
|
|
);
|
|
}
|
|
});
|
|
|
|
//Select "Algebra" from dropdown
|
|
//Runs even if validation above already failed — errors are thrown after this,
|
|
//so log order does not reflect when the failing check actually ran
|
|
await driver.findElement(By.css('.show > li:nth-child(5) input')).click();
|
|
await driver.sleep(2000);
|
|
|
|
console.log('----->| NEXT ACTION: Selected correlation: Algebra');
|
|
|
|
//Click away to close dropdown using executeScript to bypass interception
|
|
await driver.executeScript(`
|
|
document.querySelector('.col-sm-12 .multiselect-selected-text').click();
|
|
`);
|
|
await driver.sleep(2000);
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Related Standards options
|
|
{
|
|
description: 'Validate Include Related Standards options are hidden',
|
|
action: async () => {
|
|
const multipleChecks = 'Include Related Standards labels and dropdowns are hidden';
|
|
const errors = [];
|
|
|
|
const visibility = await driver.executeScript(`
|
|
const elementRelStdnt = document.querySelector('#relsel');
|
|
if (!elementRelStdnt) return { found: false };
|
|
const style = window.getComputedStyle(elementRelStdnt);
|
|
return {
|
|
found: true,
|
|
hidden: style.display === 'none',
|
|
display: style.display
|
|
};
|
|
`);
|
|
//console.log('----->| DEBUG RelStdnt visibility:', JSON.stringify(visibility));
|
|
|
|
//Both label and dropdown are inside the same hideGrade div
|
|
//so we only need to check the parent container once
|
|
if (visibility.found && visibility.hidden) {
|
|
console.log('Passed: Related Standards dropdown is hidden as expected');
|
|
console.log('Passed: Best Match dropdown is hidden as expected');
|
|
} else {
|
|
errors.push(`Expected: Related Standards and Best Match dropdowns to be hidden; Actual: display="${visibility.display}"`);
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//NEXT ACTION
|
|
{
|
|
description: 'Select Include Related Standards checkbox',
|
|
action: async () => {
|
|
await driver.findElement(By.css('#doRel')).click();
|
|
await driver.sleep(2000);
|
|
console.log('----->| NEXT ACTION: Clicked Include Related Standards checkbox');
|
|
|
|
//Wait until the modal title is located AND visible
|
|
await driver.wait(async () => {
|
|
try {
|
|
const element = await driver.findElement(By.css('.col-auto .multiselect-selected-text'));
|
|
return await element.isDisplayed();
|
|
} catch (e) {
|
|
return false; //Element not ready yet, keep waiting
|
|
}
|
|
}, 20000, 'Related Standards dropdown did not become visible within 20 seconds');
|
|
|
|
console.log('Passed: Related Standards dropdown loaded successfully');
|
|
}
|
|
},
|
|
|
|
//NEXT ACTION
|
|
{
|
|
description: 'Validate alert message',
|
|
action: async () => {
|
|
const multipleChecks = 'Validate alert message';
|
|
const errors = [];
|
|
|
|
//Click delete button
|
|
const element = await driver.findElement(By.css('#stdsubmit')).click();
|
|
await driver.sleep(5000);
|
|
console.log('----->| NEXT ACTION: Clicked Search button');
|
|
|
|
//Wait for confirm dialog to appear
|
|
const alert = await driver.wait(until.alertIsPresent(), 5000);
|
|
console.log('----->| NEXT ACTION: Alert dialog appeared as expected');
|
|
|
|
//Get alert text
|
|
const alertText = await alert.getText();
|
|
|
|
//Validate alert message text
|
|
const expectedText = 'You must select at least one set of related standards';
|
|
if (alertText === expectedText) {
|
|
console.log('Passed: Alert dialog text matched as expected');
|
|
} else {
|
|
errors.push(`Expected: "${expectedText}"; Actual: "${alertText}"`);
|
|
}
|
|
|
|
//Throw summary before dismissing if errors found
|
|
if (errors.length > 0) {
|
|
await alert.dismiss(); //Cancel the delete if validation failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
|
|
//Accept the alert (click OK) to proceed with deletion
|
|
await alert.accept();
|
|
console.log('----->| NEXT ACTION: Clicked alert message OK button');
|
|
await driver.sleep(2000);
|
|
}
|
|
},
|
|
|
|
//Related Standards dropdown
|
|
{
|
|
description: 'Validate Related Standards dropdown list and value',
|
|
action: async () => {
|
|
const multipleChecks = 'Related Standards dropdown list';
|
|
|
|
//Locate and validate selected (collapsed) value
|
|
const dropdownButton = await driver.findElement(
|
|
By.css('.col-auto .multiselect-selected-text')
|
|
);
|
|
|
|
//Open dropdown - use the element directly, not findElement again
|
|
await dropdownButton.click();
|
|
await driver.sleep(2000);
|
|
console.log('----->| NEXT ACTION: Clicked Related Standards dropdown');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//Get text, font, size, and color
|
|
const elementText = await dropdownButton.getText();
|
|
const elementFont = await dropdownButton.getCssValue('font-family');
|
|
const elementSize = await dropdownButton.getCssValue('font-size');
|
|
const elementColor = await dropdownButton.getCssValue('color');
|
|
|
|
//text
|
|
if (elementText === 'None Selected') {
|
|
console.log("Passed: None Selected default option matched as expected");
|
|
} else {
|
|
errors.push(`Expected option: "None Selected"; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//font
|
|
if (elementFont === 'Poppins, sans-serif') {
|
|
console.log('Passed: None Selected default text font-family matched as expected');
|
|
} else {
|
|
errors.push(`Expected: None Selected default text font-family "DM Serif Display, serif"; Actual: ${elementFont}`);
|
|
}
|
|
|
|
//size
|
|
if (elementSize === '16px') {
|
|
console.log('Passed: None Selected default text font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: None Selected default text font-size "16px"; Actual: "${elementSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementColor === 'rgba(33, 37, 41, 1)') {
|
|
console.log('Passed: None Selected default text color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: None Selected default text color "rgba(33, 37, 41, 1)"; Actual: "${elementColor}"`);
|
|
}
|
|
|
|
//Wait for dropdown list to become visible
|
|
const dropdownMenu = await driver.wait(
|
|
until.elementLocated(By.css('ul.multiselect-container.dropdown-menu.show')),
|
|
10000
|
|
);
|
|
|
|
await driver.wait(
|
|
until.elementIsVisible(dropdownMenu),
|
|
10000
|
|
);
|
|
|
|
//Now safely get option labels
|
|
const optionLabels = await dropdownMenu.findElements(
|
|
By.css('li label.checkbox')
|
|
);
|
|
|
|
//Extract list values
|
|
const actualOptions = [];
|
|
for (const label of optionLabels) {
|
|
const text = (await label.getText()).trim();
|
|
if (text) {
|
|
actualOptions.push(text);
|
|
}
|
|
}
|
|
|
|
const expectedOptions = [
|
|
'Select all',
|
|
'Alabama',
|
|
'Arizona',
|
|
'California',
|
|
'Florida',
|
|
'Georgia',
|
|
'Illinois',
|
|
'New York',
|
|
'Texas',
|
|
'Washington',
|
|
'Common Core State Standards',
|
|
'Alberta Standards',
|
|
'Ontario Curriculum',
|
|
'Australian Curriculum (ACARA) v8',
|
|
'New South Wales',
|
|
'NCSSFL-ACTFL CAN-DO STATEMENTS',
|
|
'WIDA Consortium (2020)',
|
|
'5th Grade Import ECS-2732',
|
|
'Imported Framework Updated',
|
|
'NewTicket',
|
|
'ECS-2933 Testing On Prod',
|
|
'Widget Test',
|
|
'ecs31444',
|
|
'California Mathematics 1997',
|
|
'Georgia Archived Language Arts QA',
|
|
'Georgia Current Language Arts QA',
|
|
'Georgia Future Language Arts QA',
|
|
'create group test',
|
|
'IMport Test',
|
|
'Georgia WL Import'
|
|
];
|
|
|
|
//Length validation
|
|
if (actualOptions.length !== expectedOptions.length) {
|
|
errors.push(
|
|
`Expected option count ${expectedOptions.length}; Actual ${actualOptions.length}`
|
|
);
|
|
}
|
|
|
|
//Value-by-value validation
|
|
expectedOptions.forEach((expected, i) => {
|
|
if (actualOptions[i] !== expected) {
|
|
errors.push(
|
|
`Index ${i}: Expected "${expected}", Actual "${actualOptions[i]}"`
|
|
);
|
|
}
|
|
});
|
|
|
|
//Select "Washington" from dropdown
|
|
await driver.findElement(By.css('.show > li:nth-child(12) input')).click();
|
|
await driver.sleep(2000);
|
|
|
|
//Select "Common Core State Standards" from dropdown
|
|
await driver.findElement(By.css('.show > li:nth-child(14) input')).click();
|
|
await driver.sleep(2000);
|
|
|
|
//Select "California Mathematics 1997" from dropdown
|
|
await driver.findElement(By.css('.show > li:nth-child(34) input')).click();
|
|
await driver.sleep(2000);
|
|
|
|
console.log('----->| NEXT ACTION: Selected Related Standards: Washington, Common Core State Standards, California Mathematics 1997');
|
|
|
|
//Click away to close dropdown using executeScript to bypass interception
|
|
await driver.executeScript(`
|
|
document.querySelector('.col-auto .multiselect-selected-text').click();
|
|
`);
|
|
await driver.sleep(2000);
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Selected Related Standards dropdown value
|
|
{
|
|
description: 'Validate Show Correlations From dropdown value',
|
|
action: async () => {
|
|
const multipleChecks = 'Show Correlations From dropdown value';
|
|
const selectedOption = await driver.findElement(By.css('.col-auto .multiselect-selected-text'));
|
|
|
|
//Get text, font, size, and color
|
|
const elementText = await selectedOption.getText('');
|
|
const elementFont = await selectedOption.getCssValue('font-family');
|
|
const elementSize = await selectedOption.getCssValue('font-size');
|
|
const elementColor = await selectedOption.getCssValue('color');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//text
|
|
if (elementText === 'Washington , Common Core State Standards , California Mathematics 1997') {
|
|
console.log("Passed: Selected Content Sets dropdown options matched as expected");
|
|
} else {
|
|
errors.push(`Expected option: "Washington , Common Core State Standards , California Mathematics 1997"; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//font
|
|
if (elementFont === 'Poppins, sans-serif') {
|
|
console.log('Passed: Selected Content Sets dropdown text font-family matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Selected Content Sets dropdown text font-family "DM Serif Display, serif"; Actual: ${elementFont}`);
|
|
}
|
|
|
|
//size
|
|
if (elementSize === '16px') {
|
|
console.log('Passed: Selected Content Sets dropdown text font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Selected Content Sets dropdown text font-size "16px"; Actual: "${elementSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementColor === 'rgba(33, 37, 41, 1)') {
|
|
console.log('Passed: Selected Content Sets dropdown text color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Selected Content Sets dropdown text color "rgba(33, 37, 41, 1)"; Actual: "${elementColor}"`);
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//based on
|
|
{
|
|
description: 'Validate based on label text, font, size, and color',
|
|
action: async () => {
|
|
const multipleChecks = 'based on label';
|
|
const element = await driver.findElement(By.css('.col-auto:nth-child(2)'));
|
|
|
|
//Get text, font, size, and color
|
|
const elementText = await element.getText();
|
|
const elementFont = await element.getCssValue('font-family');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
const elementColor = await element.getCssValue('color');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//text
|
|
if (elementText === 'based on') {
|
|
console.log("Passed: based on label text matched as expected");
|
|
} else {
|
|
errors.push(`Expected: "based on" label text; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//font
|
|
if (elementFont === 'Poppins, sans-serif') {
|
|
console.log('Passed: based on label font-family matched as expected');
|
|
} else {
|
|
errors.push(`Expected: based on label font-family "DM Serif Display, serif"; Actual: ${elementFont}`);
|
|
}
|
|
|
|
//size
|
|
if (elementSize === '13px') {
|
|
console.log('Passed: based on label text font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: based on label text font-size "13px"; Actual: "${elementSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementColor === 'rgba(40, 39, 90, 1)') {
|
|
console.log('Passed: based on label text color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: based on label text color "rgba(40, 39, 90, 1)"; Actual: "${elementColor}"`);
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//best match dropdown
|
|
{
|
|
description: 'Validate best match dropdown list and value',
|
|
action: async () => {
|
|
const multipleChecks = 'best match Dropdown List';
|
|
const select = await driver.findElement(By.css('.custom-select'));
|
|
|
|
//Get text, font, size, and color
|
|
const selectedOption = await select.findElement(By.css('option:checked'));
|
|
const elementText = await selectedOption.getText();
|
|
const elementFont = await selectedOption.getCssValue('font-family');
|
|
const elementSize = await selectedOption.getCssValue('font-size');
|
|
const elementColor = await selectedOption.getCssValue('color');
|
|
|
|
//text
|
|
if (elementText === 'best match') {
|
|
console.log("Passed: best match default option matched as expected");
|
|
} else {
|
|
errors.push(`Expected option: "best match"; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//font
|
|
if (elementFont === 'Poppins, sans-serif') {
|
|
console.log('Passed: best match default text font-family matched as expected');
|
|
} else {
|
|
errors.push(`Expected: best match default text font-family "DM Serif Display, serif"; Actual: ${elementFont}`);
|
|
}
|
|
|
|
//size
|
|
if (elementSize === '13px') {
|
|
console.log('Passed: best match default text font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: best match default text font-size "13px"; Actual: "${elementSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementColor === 'rgba(40, 39, 90, 1)') {
|
|
console.log('Passed: best match default text color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: best match default text color "rgba(40, 39, 90, 1)"; Actual: "${elementColor}"`);
|
|
}
|
|
|
|
const options = await select.findElements(By.css('option'));
|
|
const expectedList = [
|
|
'best match',
|
|
'similar text',
|
|
'like concepts'
|
|
];
|
|
const actual = [];
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
for (const opt of options) {
|
|
const text = (await opt.getText()).trim();
|
|
actual.push(text);
|
|
}
|
|
|
|
if (JSON.stringify(actual) === JSON.stringify(expectedList)) {
|
|
console.log('Passed: best match Dropdown list matched as expected');
|
|
} else {
|
|
errors.push(`Expected: best match Dropdown list: ${JSON.stringify(expectedList)}, Actual: ${JSON.stringify(actual)}`);
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Include Related Standards info icon | SPECIAL CASE {title data-original-title}
|
|
{
|
|
description: 'Validate info icon',
|
|
action: async () => {
|
|
const multipleChecks = 'info icon';
|
|
const errors = [];
|
|
|
|
//Get both text and styles in one executeScript call
|
|
const result = await driver.executeScript(`
|
|
const el = document.querySelector('[data-toggle="tooltip"][data-placement="right"]');
|
|
if (!el) return null;
|
|
const style = window.getComputedStyle(el);
|
|
return {
|
|
tooltipText: el.getAttribute('data-original-title'),
|
|
fontFamily: style.getPropertyValue('font-family'),
|
|
fontSize: style.getPropertyValue('font-size'),
|
|
color: style.getPropertyValue('color'),
|
|
backgroundColor: style.getPropertyValue('background-color')
|
|
};
|
|
`);
|
|
//console.log('----->| DEBUG result:', JSON.stringify(result));
|
|
|
|
//text
|
|
if (result.tooltipText === '"best match" uses a combination of similar text and like concepts') {
|
|
console.log('Passed: Tooltip text matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Tooltip text: '"best match" uses a combination of similar text and like concepts'; Actual: "${result.tooltipText}"`);
|
|
}
|
|
|
|
//font
|
|
if (result.fontFamily === 'Poppins, sans-serif') {
|
|
console.log('Passed: Info icon text font-family matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Info icon font-family "Poppins, sans-serif"; Actual: "${result.fontFamily}"`);
|
|
}
|
|
|
|
//size
|
|
if (result.fontSize === '13px') {
|
|
console.log('Passed: Info icon text font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Info icon font-size "13px"; Actual: "${result.fontSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (result.color === 'rgb(40, 39, 90)') {
|
|
console.log('Passed: Info icon text color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Info icon color rgb(40, 39, 90)"; Actual: "${result.color}"`);
|
|
}
|
|
|
|
//background-color
|
|
if (result.backgroundColor === 'rgba(0, 0, 0, 0)') {
|
|
console.log('Passed: Info icon background-color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Info icon background-color "rgba(0, 0, 0, 0)"; Actual: "${result.backgroundColor}"`);
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//note
|
|
{
|
|
description: 'Validate note text, font, size, and color',
|
|
action: async () => {
|
|
const multipleChecks = 'note label';
|
|
const element = await driver.findElement(By.css('em'));
|
|
|
|
//Get text, font, size, and color
|
|
const elementText = await element.getText();
|
|
const elementFont = await element.getCssValue('font-family');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
const elementColor = await element.getCssValue('color');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//text
|
|
if (elementText === '** note - including related standards may cause increased page load times') {
|
|
console.log("Passed: ** note text matched as expected");
|
|
} else {
|
|
errors.push(`Expected: "** note - including related standards may cause increased page load times" label text; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//font
|
|
if (elementFont === 'Poppins, sans-serif') {
|
|
console.log('Passed: ** note text font-family matched as expected');
|
|
} else {
|
|
errors.push(`Expected: ** note text font-family "DM Serif Display, serif"; Actual: ${elementFont}`);
|
|
}
|
|
|
|
//size
|
|
if (elementSize === '10.4px') {
|
|
console.log('Passed: ** note text font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: **n ote text font-size "10.4px"; Actual: "${elementSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementColor === 'rgba(40, 39, 90, 1)') {
|
|
console.log('Passed: ** note text color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: ** note text color "rgba(40, 39, 90, 1)"; Actual: "${elementColor}"`);
|
|
errors.push(message)
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//NEXT ACTION
|
|
{
|
|
description: 'Click Search button',
|
|
action: async () => {
|
|
await driver.findElement(By.css('#stdsubmit')).click();
|
|
console.log('----->| NEXT ACTION: Clicked Search button');
|
|
|
|
//Wait for page to load completely
|
|
await driver.wait(async () => {
|
|
const readyState = await driver.executeScript('return document.readyState');
|
|
return readyState === 'complete';
|
|
}, 30000, 'Standards search page did not fully load within 30 seconds');
|
|
console.log('Passed: Standards Search Page loaded successfully');
|
|
|
|
//Wait until the modal title is located AND visible
|
|
await driver.wait(async () => {
|
|
try {
|
|
const element = await driver.findElement(By.css('.breadcrumb-item:nth-child(2)'));
|
|
return await element.isDisplayed();
|
|
} catch (e) {
|
|
return false; //Element not ready yet, keep waiting
|
|
}
|
|
}, 20000, 'Standards breadcrumb label did not become visible within 20 seconds');
|
|
|
|
console.log('Passed: Standards breadcrumb label loaded successfully');
|
|
}
|
|
},
|
|
|
|
...myStandardsSearch_AlignedContent(driver),
|
|
|
|
];
|
|
|
|
const logStep = (worksheet, stepDescription, status, stepIndex, timestamp, screenshotPath) => {
|
|
const json_data = XLSX.utils.sheet_to_json(worksheet, { header: 1 });
|
|
json_data.push([stepIndex, stepDescription, status, timestamp, screenshotPath]);
|
|
return XLSX.utils.aoa_to_sheet(json_data);
|
|
};
|
|
|
|
const takeScreenshot = async (driver, stepIndex, stepDescription) => {
|
|
const screenshot = await driver.takeScreenshot();
|
|
|
|
const dir = path.join('screenshots', 'dashboardMyStandardsResults');
|
|
|
|
const screenshotFileName = `step_${stepIndex}_${stepDescription.replace(/\s+/g, '_')}.png`;
|
|
const screenshotPath = path.join(dir, screenshotFileName);
|
|
fs.writeFileSync(screenshotPath, screenshot, 'base64');
|
|
return screenshotPath;
|
|
};
|
|
|
|
const resultsFile = path.join('results', 'dashboardMyStandards.xlsx');
|
|
|
|
const clearOldResults = () => {
|
|
//Remove old screenshots
|
|
const screenshotDir = path.join('screenshots', 'dashboardMyStandards');
|
|
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();
|
|
|
|
//Log a successful step with no screenshot
|
|
worksheet = logStep(
|
|
worksheet,
|
|
step.description,
|
|
'Passed',
|
|
stepIndex,
|
|
timestamp,
|
|
null //No screenshot for passed steps
|
|
);
|
|
|
|
} catch (error) {
|
|
const screenshotPath = await takeScreenshot(
|
|
driver,
|
|
stepIndex,
|
|
`${step.description}_Failed`
|
|
);
|
|
|
|
worksheet = logStep(
|
|
worksheet,
|
|
step.description,
|
|
'Failed',
|
|
stepIndex,
|
|
timestamp,
|
|
screenshotPath
|
|
);
|
|
|
|
console.error(`Step ${stepIndex} FAILED: ${error.message}`);
|
|
failedSteps.push(`Step ${stepIndex}: ${step.description} - ${error.message}`); //Track failed step
|
|
testStatus = 'Failed';
|
|
allStepsPassed = false;
|
|
}
|
|
}
|
|
|
|
if (allStepsPassed) {
|
|
console.log('------------->| THE END |<-------------');
|
|
console.log('PASSED: DASHBOARD - My Standards Widget(dashboardMyStandards); All test steps completed successfully');
|
|
testStatus = 'Passed';
|
|
} else {
|
|
console.log('------------->| THE END |<-------------');
|
|
console.log('FAILED: DASHBOARD - My Standards Widget(dashboardMyStandards); One or more test steps failed');
|
|
console.log('FAILED STEPS:');
|
|
failedSteps.forEach(step => console.error(` ✗ ${step}`));
|
|
testStatus = 'Failed';
|
|
}
|
|
|
|
//Log test end time
|
|
const endTime = new Date().toISOString();
|
|
worksheet = logStep(worksheet, 'Test End', testStatus, '', endTime, '');
|
|
|
|
//Write the updated worksheet back to the workbook and save it
|
|
workbook.Sheets['Sheet1'] = worksheet;
|
|
XLSX.writeFile(workbook, resultsFile);
|
|
} finally {
|
|
await driver.quit();
|
|
}
|
|
})();
|
|
}
|
|
|
|
export default dashboardMyStandards;
|