4851 lines
172 KiB
JavaScript
4851 lines
172 KiB
JavaScript
import { Builder, By, Key, until } from 'selenium-webdriver';
|
|
import fs from 'fs';
|
|
import XLSX from 'xlsx';
|
|
import path from 'path';
|
|
|
|
const ExACT_dashboardMyStandards = (req, res) => {
|
|
res.send('<h2>ExACT Automated Test Script - Dashboard - My Standards Widget(ExACT_dashboardMyStandards): Initiated</h2>');
|
|
(async function example() {
|
|
let driver = await new Builder().forBrowser('chrome').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://stage.edgate.com/exact/login.php') },
|
|
{ description: 'Expand browser', action: async () => await driver.manage().window().maximize() },
|
|
|
|
//LOGIN
|
|
{
|
|
description: 'Login with valid credentials',
|
|
action: async () => {
|
|
|
|
console.log('---------------->| BEGIN |<----------------');
|
|
console.log('---------->| MY STANDARDS WIDGET|<---------');
|
|
|
|
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();
|
|
|
|
//Wait until the element exists in the DOM
|
|
const appliedFiltersLabel = await driver.wait(
|
|
until.elementLocated(By.css('.applied-filter-sec > label')),
|
|
30000
|
|
);
|
|
|
|
//Wait until it becomes visible
|
|
await driver.wait(
|
|
until.elementIsVisible(appliedFiltersLabel),
|
|
30000
|
|
);
|
|
|
|
//Wait for page to load completely
|
|
await driver.wait(async () => {
|
|
const readyState = await driver.executeScript('return document.readyState');
|
|
return readyState === 'complete';
|
|
}, 30000, 'Dashboard - Correlation Dashboard Page did not fully load within 30 seconds');
|
|
console.log('Passed: Dashboard - Correlation Dashboard Page loaded successfully');
|
|
}
|
|
},
|
|
|
|
//Dashboard - Page title, text, and font size
|
|
{
|
|
description: 'Validate Dashboard - National Standards page title text, color, and size',
|
|
action: async () => {
|
|
const element = await driver.findElement(By.css('.e-heading'));
|
|
|
|
//Get text, color, and size
|
|
const elementText = await element.getText();
|
|
const elementColor = await element.getCssValue('color');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//Validate text =
|
|
if (elementText === 'Correlation Dashboard') {
|
|
console.log("Passed: Dashboard - Correlation Dashboard page title matched as expected");
|
|
} else {
|
|
const message = `Expected: Dashboard - "Correlation Dashboard" page title; Actual: "${elementText}"`;
|
|
errors.push(message);
|
|
}
|
|
|
|
//Validate color -navy blue
|
|
if (elementColor === 'rgba(40, 39, 90, 1)') {
|
|
console.log('Passed: Dashboard - Page title text color matched as expected');
|
|
} else {
|
|
const message = `Expected: Dashboard - Page title text color "rgba(40, 39, 90, 1)"; Actual: "${elementColor}"`;
|
|
errors.push(message);
|
|
}
|
|
|
|
//Validate font size
|
|
if (elementSize === '32px') {
|
|
console.log('Passed: Dashboard - Page title text font-size matched as expected');
|
|
} else {
|
|
const message = `Expected: Dashboard - Page title text font-size "32px"; Actual: "${elementSize}"`;
|
|
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('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 element = await driver.findElement(By.css('#mystd-tab'));
|
|
|
|
//Get text, color, and size
|
|
const elementText = await element.getText();
|
|
const elementColor = await element.getCssValue('color');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//Validate text
|
|
if (elementText === 'My Standards') {
|
|
console.log('Passed: Dashboard - Semantic Standards Comparison Widget title matched as expected');
|
|
} else {
|
|
const message = `Expected: Dashboard - "Semantic Standards Comparison"; Actual: "${elementText}"`;
|
|
errors.push(message);
|
|
}
|
|
|
|
//Validate color -navy blue
|
|
if (elementColor === 'rgba(40, 39, 90, 1)') {
|
|
console.log('Passed: Dashboard - Semantic Standards Comparison Widget title text color matched as expected');
|
|
} else {
|
|
const message = `Expected: Dashboard - Semantic Standards Comparison Widget title text color "rgba(40, 39, 90, 1)"; Actual: "${elementColor}"`;
|
|
errors.push(message);
|
|
}
|
|
|
|
//Validate font size
|
|
if (elementSize === '15px') {
|
|
console.log('Passed: Dashboard - Semantic Standards Comparison Widget title text font-size matched as expected');
|
|
} else {
|
|
const message = `Expected: Dashboard - Semantic Standards Comparison Widget title text font-size "15px"; Actual: "${elementSize}"`;
|
|
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('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, text, and font size (dimmed)
|
|
{
|
|
description: 'Validate Dashboard - Other Available Stndards tab title text, color, and size',
|
|
action: async () => {
|
|
const element = await driver.findElement(By.css('#availstd-tab'));
|
|
|
|
//Get text, color, and size
|
|
const elementText = await element.getText();
|
|
const elementColor = await element.getCssValue('color');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//Validate text
|
|
if (elementText === 'Other Available Standards') {
|
|
console.log('Passed: Dashboard - Other Available Standards tab title matched as expected');
|
|
} else {
|
|
const message = `Expected: Dashboard - "Other Available Standards"; Actual: "${elementText}"`;
|
|
errors.push(message);
|
|
}
|
|
|
|
//Validate color -gray (dimmed)
|
|
if (elementColor === 'rgba(182, 186, 181, 1)') {
|
|
console.log('Passed: Dashboard - Other Available Standards tab title text color matched as expected');
|
|
} else {
|
|
const message = `Expected: Dashboard - Other Available Standards tab title text color "rgba(182, 186, 181, 1)"'; Actual: "${elementColor}"`;
|
|
errors.push(message);
|
|
}
|
|
|
|
//Validate font size
|
|
if (elementSize === '15px') {
|
|
console.log('Passed: Dashboard - Other Available Standards tab title text font-size matched as expected');
|
|
} else {
|
|
const message = `Expected: Dashboard - Other Available Standards tab title text font-size "15px"; Actual: "${elementSize}"`;
|
|
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('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 dropdown = await driver.findElement(By.css('#stdparent'));
|
|
const dropdownValue = await dropdown.getAttribute('value');
|
|
const options = await dropdown.findElements(By.css('option'));
|
|
const expectedList = [
|
|
'Adding a New Org to test with',
|
|
'Archived Standards',
|
|
'Australia Standards',
|
|
'Canada Standards',
|
|
'Common Core Standards',
|
|
'Demo Standards',
|
|
'ECS-2732 Testing Frame II',
|
|
'Future Standards',
|
|
'Org To Delete',
|
|
'QA Client Test Frameworks',
|
|
'United States Standards'
|
|
];
|
|
const actual = [];
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
if (dropdownValue === '154828031') {
|
|
console.log("Passed: Dashboard - My Standards dropdown value matched as expected");
|
|
} else {
|
|
const message = `Expected: Dashboard - My Standards dropdown value - "United States Standards"; Actual: "${dropdownValue}"`;
|
|
errors.push(message);
|
|
}
|
|
|
|
for (const opt of options) {
|
|
const text = (await opt.getText()).trim();
|
|
actual.push(text);
|
|
}
|
|
|
|
if (JSON.stringify(actual) === JSON.stringify(expectedList)) {
|
|
console.log('Passed: Dashboard - My Standards Dropdown list matched as expected');
|
|
} else {
|
|
const message = `Expected: Dashboard My Standards Dropdown list: ${JSON.stringify(expectedList)}, Actual: ${JSON.stringify(actual)}`;
|
|
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('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, text, and font size
|
|
{
|
|
description: 'Validate Dashboard - My Standards Organization column title, text, and font size',
|
|
action: async () => {
|
|
const element = await driver.findElement(By.css('.table:nth-child(2) th:nth-child(1)'));
|
|
|
|
//Get text, color, and size
|
|
const elementText = await element.getText();
|
|
const elementColor = await element.getCssValue('color');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//Validate text
|
|
if (elementText === 'Organization') {
|
|
console.log('Passed: Dashboard - My Standards Organization column title matched as expected');
|
|
} else {
|
|
const message = `Expected: Dashboard - My Standards "Organization" column title; Actual: "${elementText}"`;
|
|
errors.push(message);
|
|
}
|
|
|
|
//Validate color -dark gray
|
|
if (elementColor === 'rgba(94, 105, 116, 1)') {
|
|
console.log('Passed: Dashboard - My Standards Organization column title text color matched as expected');
|
|
} else {
|
|
const message = `Expected: Dashboard - My Standards Organization column title text color "rgba(94, 105, 116, 1)"'; Actual: "${elementColor}"`;
|
|
errors.push(message);
|
|
}
|
|
|
|
//Validate font size
|
|
if (elementSize === '14px') {
|
|
console.log('Passed: Dashboard - My Standards Organization column title text font-size matched as expected');
|
|
} else {
|
|
const message = `Expected: Dashboard - My Standards Organization column title text font-size "14px"; Actual: "${elementSize}"`;
|
|
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('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, text, and font size
|
|
{
|
|
description: 'Validate Dashboard - My Standards Export column title, text, and font size',
|
|
action: async () => {
|
|
const element = await driver.findElement(By.css('.table:nth-child(2) > thead .text-center:nth-child(2)'));
|
|
|
|
//Get text, color, and size
|
|
const elementText = await element.getText();
|
|
const elementColor = await element.getCssValue('color');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//Validate text
|
|
if (elementText === 'Export') {
|
|
console.log('Passed: Dashboard - My Standards Export column title matched as expected');
|
|
} else {
|
|
const message = `Expected: Dashboard - My Standards "Export" column title; Actual: "${elementText}"`;
|
|
errors.push(message);
|
|
}
|
|
|
|
//Validate color -dark gray
|
|
if (elementColor === 'rgba(94, 105, 116, 1)') {
|
|
console.log('Passed: Dashboard - My Standards Export column title text color matched as expected');
|
|
} else {
|
|
const message = `Expected: Dashboard - My Standards Export column title text color "rgba(94, 105, 116, 1)"'; Actual: "${elementColor}"`;
|
|
errors.push(message);
|
|
}
|
|
|
|
//Validate font size
|
|
if (elementSize === '14px') {
|
|
console.log('Passed: Dashboard - My Standards Export column title text font-size matched as expected');
|
|
} else {
|
|
const message = `Expected: Dashboard - My Standards Export column title text font-size "14px"; Actual: "${elementSize}"`;
|
|
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('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, text, and font size
|
|
{
|
|
description: 'Validate Dashboard - My Standards Manage column title, text, and font size',
|
|
action: async () => {
|
|
const element = await driver.findElement(By.css('.text-center:nth-child(3)'));
|
|
|
|
//Get text, color, and size
|
|
const elementText = await element.getText();
|
|
const elementColor = await element.getCssValue('color');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//Validate text
|
|
if (elementText === 'Manage') {
|
|
console.log('Passed: Dashboard - My Standards Manage column title matched as expected');
|
|
} else {
|
|
const message = `Expected: Dashboard - My Standards "Manage" column title; Actual: "${elementText}"`;
|
|
errors.push(message);
|
|
}
|
|
|
|
//Validate color -dark gray
|
|
if (elementColor === 'rgba(94, 105, 116, 1)') {
|
|
console.log('Passed: Dashboard - My Standards Manage column title text color matched as expected');
|
|
} else {
|
|
const message = `Expected: Dashboard - My Standards Manage column title text color "rgba(94, 105, 116, 1)"'; Actual: "${elementColor}"`;
|
|
errors.push(message);
|
|
}
|
|
|
|
//Validate font size
|
|
if (elementSize === '14px') {
|
|
console.log('Passed: Dashboard - My Standards Manage column title text font-size matched as expected');
|
|
} else {
|
|
const message = `Expected: Dashboard - My Standards Manage column title text font-size "14px"; Actual: "${elementSize}"`;
|
|
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('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, text, and font size
|
|
{
|
|
description: 'Validate Dashboard - My Standards More Info column title, text, and font size',
|
|
action: async () => {
|
|
const element = await driver.findElement(By.css('.table-sm > thead .text-center:nth-child(4)'));
|
|
|
|
//Get text, color, and size
|
|
const elementText = await element.getText();
|
|
const elementColor = await element.getCssValue('color');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//Validate text
|
|
if (elementText === 'More Info') {
|
|
console.log('Passed: Dashboard - My Standards More Info column title matched as expected');
|
|
} else {
|
|
const message = `Expected: Dashboard - My Standards "More Info" column title; Actual: "${elementText}"`;
|
|
errors.push(message);
|
|
}
|
|
|
|
//Validate color -dark gray
|
|
if (elementColor === 'rgba(94, 105, 116, 1)') {
|
|
console.log('Passed: Dashboard - My Standards More Info column title text color matched as expected');
|
|
} else {
|
|
const message = `Expected: Dashboard - My Standards More Info column title text color "rgba(94, 105, 116, 1)"'; Actual: "${elementColor}"`;
|
|
errors.push(message);
|
|
}
|
|
|
|
//Validate font size
|
|
if (elementSize === '14px') {
|
|
console.log('Passed: Dashboard - My Standards More Info column title text font-size matched as expected');
|
|
} else {
|
|
const message = `Expected: Dashboard - My Standards More Info column title text font-size "14px"; Actual: "${elementSize}"`;
|
|
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('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, text, and font size
|
|
{
|
|
description: 'Validate Dashboard - My Standards View column title, text, and font size',
|
|
action: async () => {
|
|
const element = await driver.findElement(By.css('thead .text-center:nth-child(5)'));
|
|
|
|
//Get text, color, and size
|
|
const elementText = await element.getText();
|
|
const elementColor = await element.getCssValue('color');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//Validate text
|
|
if (elementText === 'View') {
|
|
console.log('Passed: Dashboard - My Standards View column title matched as expected');
|
|
} else {
|
|
const message = `Expected: Dashboard - My Standards "View" column title; Actual: "${elementText}"`;
|
|
errors.push(message);
|
|
}
|
|
|
|
//Validate color -dark gray
|
|
if (elementColor === 'rgba(94, 105, 116, 1)') {
|
|
console.log('Passed: Dashboard - My Standards View column title text color matched as expected');
|
|
} else {
|
|
const message = `Expected: Dashboard - My Standards View column title text color "rgba(94, 105, 116, 1)"'; Actual: "${elementColor}"`;
|
|
errors.push(message);
|
|
}
|
|
|
|
//Validate font size
|
|
if (elementSize === '14px') {
|
|
console.log('Passed: Dashboard - My Standards View column title text font-size matched as expected');
|
|
} else {
|
|
const message = `Expected: Dashboard - My Standards View column title text font-size "14px"; Actual: "${elementSize}"`;
|
|
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('Multiple validation checks did not pass');
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Dashboard - My Standards Organization = Alabama Standards text
|
|
{
|
|
description: 'Validate Dashboard - My Standards Organization = Alabama Standards text',
|
|
action: async () => {
|
|
const elementText = await driver.findElement(By.css('#stdbody > tr:nth-child(1) > td:nth-child(1)')).getText();
|
|
|
|
if (elementText === 'Alabama Standards') {
|
|
console.log("Passed: Dashboard - My Standards Alabama Standadrds text matched as expected");
|
|
} else {
|
|
throw new Error(`Expected: Dashboard - My Standards Alabama Standadrds text "Alabama Standards"; Actual: "${elementText}"`);
|
|
}
|
|
}
|
|
},
|
|
|
|
//Dashboard - My Standards Alabama - Export icon
|
|
{
|
|
description: 'Verify Dashboard - My Standards Alabama - Export icon is present',
|
|
action: async () => {
|
|
const expectedIcon = await driver.wait(until.elementLocated(By.css('#stdbody > tr:nth-child(1) > .text-center:nth-child(2) img')), 5000).catch(() => false);
|
|
|
|
if (!expectedIcon) {
|
|
throw new Error('Expected: Dashboard - My Standards Alabama - Export icon not found');
|
|
}
|
|
console.log('Passed: Dashboard - My Standards Alabama - Export icon is present');
|
|
}
|
|
},
|
|
|
|
//Dashboard - My Standards Alabama - More Info icon and title text
|
|
{
|
|
description: 'Verify Dashboard - My Standards Alabama - More Info icon and title text is present',
|
|
action: async () => {
|
|
const element = await driver.wait(until.elementLocated(By.css('#stdbody > tr:nth-child(1) > td:nth-child(4) > a')), 5000).catch(() => false);
|
|
|
|
//Get title text
|
|
const elementTitleText = await element.getAttribute('title');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
if (!element) {
|
|
throw new Error('Expected: Dashboard - My Standards Alabama - More Info icon not found');
|
|
}
|
|
console.log('Passed: Dashboard - My Standards Alabama - More Info icon is present');
|
|
|
|
//Validate title text
|
|
if (elementTitleText === 'View Detail Information') {
|
|
console.log('Passed: Dashboard - My Standards Alabama - text title matched as expected');
|
|
} else {
|
|
const message = `Expected: Dashboard - My Standards Alabama - "View Detail Information" text title; Actual: "${elementTitleText}"`;
|
|
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('Multiple validation checks did not pass');
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Dashboard - My Standards Alabama - View icon
|
|
{
|
|
description: 'Verify Dashboard - My Standards Alabama - View icon is present',
|
|
action: async () => {
|
|
const expectedIcon = await driver.wait(until.elementLocated(By.css('tr:nth-child(1) > .text-center:nth-child(5) img')), 5000).catch(() => false);
|
|
|
|
if (!expectedIcon) {
|
|
throw new Error('Expected: Dashboard - My Standards Alabama - View icon not found');
|
|
}
|
|
console.log('Passed: Dashboard - My Standards Alabama - View icon is present');
|
|
}
|
|
},
|
|
|
|
//Dashboard - My Standards Organization = Arizona Standards text
|
|
{
|
|
description: 'Validate Dashboard - My Standards Organization = Arizona Standards text',
|
|
action: async () => {
|
|
const elementText = await driver.findElement(By.css('#stdbody > tr:nth-child(2) > td:nth-child(1)')).getText();
|
|
|
|
if (elementText === 'Arizona Standards') {
|
|
console.log("Passed: Dashboard - My Standards Arizona Standadrds text matched as expected");
|
|
} else {
|
|
throw new Error(`Expected: Dashboard - My Standards Arizona Standadrds text "Arizona Standards"; Actual: "${elementText}"`);
|
|
}
|
|
}
|
|
},
|
|
|
|
//Dashboard - My Standards Arizona - Export icon
|
|
{
|
|
description: 'Verify Dashboard - My Standards Arizona - Export icon is present',
|
|
action: async () => {
|
|
const expectedIcon = await driver.wait(until.elementLocated(By.css('#stdbody > tr:nth-child(2) > .text-center:nth-child(2) img')), 5000).catch(() => false);
|
|
|
|
if (!expectedIcon) {
|
|
throw new Error('Expected: Dashboard - My Standards Arizona - Export icon not found');
|
|
}
|
|
console.log('Passed: Dashboard - My Standards Arizona - Export icon is present');
|
|
}
|
|
},
|
|
|
|
//Dashboard - My Standards Arizona - More Info icon and title text
|
|
{
|
|
description: 'Verify Dashboard - My Standards Arizona - More Info icon and title text is present',
|
|
action: async () => {
|
|
const element = await driver.wait(until.elementLocated(By.css('#stdbody > tr:nth-child(2) > td:nth-child(4) > a')), 5000).catch(() => false);
|
|
|
|
//Get title text
|
|
const elementTitleText = await element.getAttribute('title');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
if (!element) {
|
|
throw new Error('Expected: Dashboard - My Standards Arizona - More Info icon not found');
|
|
}
|
|
console.log('Passed: Dashboard - My Standards Arizona - More Info icon is present');
|
|
|
|
//Validate title text
|
|
if (elementTitleText === 'View Detail Information') {
|
|
console.log('Passed: Dashboard - My Standards Arizona - text title matched as expected');
|
|
} else {
|
|
const message = `Expected: Dashboard - My Standards Arizona - "View Detail Information" text title; Actual: "${elementTitleText}"`;
|
|
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('Multiple validation checks did not pass');
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Dashboard - My Standards Arizona - View icon
|
|
{
|
|
description: 'Verify Dashboard - My Standards Arizona - View icon is present',
|
|
action: async () => {
|
|
const expectedIcon = await driver.wait(until.elementLocated(By.css('tr:nth-child(2) > .text-center:nth-child(5) img')), 5000).catch(() => false);
|
|
|
|
if (!expectedIcon) {
|
|
throw new Error('Expected: Dashboard - My Standards Arizona - View icon not found');
|
|
}
|
|
console.log('Passed: Dashboard - My Standards Arizona - View icon is present');
|
|
}
|
|
},
|
|
|
|
//Dashboard - My Standards Organization = California Standards text
|
|
{
|
|
description: 'Validate Dashboard - My Standards Organization = California Standards text',
|
|
action: async () => {
|
|
const elementText = await driver.findElement(By.css('#stdbody > tr:nth-child(3) > td:nth-child(1)')).getText();
|
|
|
|
if (elementText === 'California Standards') {
|
|
console.log("Passed: Dashboard - My Standards California Standadrds text matched as expected");
|
|
} else {
|
|
throw new Error(`Expected: Dashboard - My Standards California Standadrds text "California Standards"; Actual: "${elementText}"`);
|
|
}
|
|
}
|
|
},
|
|
|
|
//Dashboard - My Standards California - Export icon
|
|
{
|
|
description: 'Verify Dashboard - My Standards California - Export icon is present',
|
|
action: async () => {
|
|
const expectedIcon = await driver.wait(until.elementLocated(By.css('#stdbody > tr:nth-child(3) > .text-center:nth-child(2) img')), 5000).catch(() => false);
|
|
|
|
if (!expectedIcon) {
|
|
throw new Error('Expected: Dashboard - My Standards California - Export icon not found');
|
|
}
|
|
console.log('Passed: Dashboard - My Standards California - Export icon is present');
|
|
}
|
|
},
|
|
|
|
//Dashboard - My Standards California - More Info icon and title text
|
|
{
|
|
description: 'Verify Dashboard - My Standards California - More Info icon and title text is present',
|
|
action: async () => {
|
|
const element = await driver.wait(until.elementLocated(By.css('#stdbody > tr:nth-child(3) > td:nth-child(4) > a')), 5000).catch(() => false);
|
|
|
|
//Get title text
|
|
const elementTitleText = await element.getAttribute('title');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
if (!element) {
|
|
throw new Error('Expected: Dashboard - My Standards California - More Info icon not found');
|
|
}
|
|
console.log('Passed: Dashboard - My Standards California - More Info icon is present');
|
|
|
|
//Validate title text
|
|
if (elementTitleText === 'View Detail Information') {
|
|
console.log('Passed: Dashboard - My Standards California - text title matched as expected');
|
|
} else {
|
|
const message = `Expected: Dashboard - My Standards California - "View Detail Information" text title; Actual: "${elementTitleText}"`;
|
|
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('Multiple validation checks did not pass');
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Dashboard - My Standards California - View icon
|
|
{
|
|
description: 'Verify Dashboard - My Standards California - View icon is present',
|
|
action: async () => {
|
|
const expectedIcon = await driver.wait(until.elementLocated(By.css('tr:nth-child(3) > .text-center:nth-child(5) img')), 5000).catch(() => false);
|
|
|
|
if (!expectedIcon) {
|
|
throw new Error('Expected: Dashboard - My Standards California - View icon not found');
|
|
}
|
|
console.log('Passed: Dashboard - My Standards California - View icon is present');
|
|
}
|
|
},
|
|
|
|
//Dashboard - My Standards Organization = Florida Standards text
|
|
{
|
|
description: 'Validate Dashboard - My Standards Organization = Florida Standards text',
|
|
action: async () => {
|
|
const elementText = await driver.findElement(By.css('#stdbody > tr:nth-child(4) > td:nth-child(1)')).getText();
|
|
|
|
if (elementText === 'Florida Standards') {
|
|
console.log("Passed: Dashboard - My Standards Florida Standadrds text matched as expected");
|
|
} else {
|
|
throw new Error(`Expected: Dashboard - My Standards Florida Standadrds text "Florida Standards"; Actual: "${elementText}"`);
|
|
}
|
|
}
|
|
},
|
|
|
|
//Dashboard - My Standards Florida - Export icon
|
|
{
|
|
description: 'Verify Dashboard - My Standards Florida - Export icon is present',
|
|
action: async () => {
|
|
const expectedIcon = await driver.wait(until.elementLocated(By.css('#stdbody > tr:nth-child(4) > .text-center:nth-child(2) img')), 5000).catch(() => false);
|
|
|
|
if (!expectedIcon) {
|
|
throw new Error('Expected: Dashboard - My Standards Florida - Export icon not found');
|
|
}
|
|
console.log('Passed: Dashboard - My Standards Florida - Export icon is present');
|
|
}
|
|
},
|
|
|
|
//Dashboard - My Standards Florida - More Info icon and title text
|
|
{
|
|
description: 'Verify Dashboard - My Standards Florida - More Info icon and title text is present',
|
|
action: async () => {
|
|
const element = await driver.wait(until.elementLocated(By.css('#stdbody > tr:nth-child(4) > td:nth-child(4) > a')), 5000).catch(() => false);
|
|
|
|
//Get title text
|
|
const elementTitleText = await element.getAttribute('title');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
if (!element) {
|
|
throw new Error('Expected: Dashboard - My Standards Florida - More Info icon not found');
|
|
}
|
|
console.log('Passed: Dashboard - My Standards Florida - More Info icon is present');
|
|
|
|
//Validate title text
|
|
if (elementTitleText === 'View Detail Information') {
|
|
console.log('Passed: Dashboard - My Standards Florida - text title matched as expected');
|
|
} else {
|
|
const message = `Expected: Dashboard - My Standards Florida - "View Detail Information" text title; Actual: "${elementTitleText}"`;
|
|
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('Multiple validation checks did not pass');
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Dashboard - My Standards Florida - View icon
|
|
{
|
|
description: 'Verify Dashboard - My Standards Florida - View icon is present',
|
|
action: async () => {
|
|
const expectedIcon = await driver.wait(until.elementLocated(By.css('tr:nth-child(4) > .text-center:nth-child(5) img')), 5000).catch(() => false);
|
|
|
|
if (!expectedIcon) {
|
|
throw new Error('Expected: Dashboard - My Standards Florida - View icon not found');
|
|
}
|
|
console.log('Passed: Dashboard - My Standards Florida - View icon is present');
|
|
}
|
|
},
|
|
|
|
//Dashboard - My Standards Organization = New York Standards text
|
|
{
|
|
description: 'Validate Dashboard - My Standards Organization = New York Standards text',
|
|
action: async () => {
|
|
const elementText = await driver.findElement(By.css('#stdbody > tr:nth-child(5) > td:nth-child(1)')).getText();
|
|
|
|
if (elementText === 'New York Standards') {
|
|
console.log("Passed: Dashboard - My Standards New York Standadrds text matched as expected");
|
|
} else {
|
|
throw new Error(`Expected: Dashboard - My Standards "New York Standards"; Actual: "${elementText}"`);
|
|
}
|
|
}
|
|
},
|
|
|
|
//Dashboard - My Standards New York - Export icon
|
|
{
|
|
description: 'Verify Dashboard - My Standards New York - Export icon is present',
|
|
action: async () => {
|
|
const expectedIcon = await driver.wait(until.elementLocated(By.css('#stdbody > tr:nth-child(5) > .text-center:nth-child(2) img')), 5000).catch(() => false);
|
|
|
|
if (!expectedIcon) {
|
|
throw new Error('Expected: Dashboard - My Standards New York - Export icon not found');
|
|
}
|
|
console.log('Passed: Dashboard - My Standards New York - Export icon is present');
|
|
}
|
|
},
|
|
|
|
//Dashboard - My Standards New York - More Info icon and title text
|
|
{
|
|
description: 'Verify Dashboard - My Standards New York - More Info icon and title text is present',
|
|
action: async () => {
|
|
const element = await driver.wait(until.elementLocated(By.css('#stdbody > tr:nth-child(5) > td:nth-child(4) > a')), 5000).catch(() => false);
|
|
|
|
//Get title text
|
|
const elementTitleText = await element.getAttribute('title');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
if (!element) {
|
|
throw new Error('Expected: Dashboard - My Standards New York - More Info icon not found');
|
|
}
|
|
console.log('Passed: Dashboard - My Standards New York - More Info icon is present');
|
|
|
|
//Validate title text
|
|
if (elementTitleText === 'View Detail Information') {
|
|
console.log('Passed: Dashboard - My Standards New York - text title matched as expected');
|
|
} else {
|
|
const message = `Expected: Dashboard - My Standards New York - "View Detail Information" text title; Actual: "${elementTitleText}"`;
|
|
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('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 - View icon
|
|
{
|
|
description: 'Verify Dashboard - My Standards New York - View icon is present',
|
|
action: async () => {
|
|
const expectedIcon = await driver.wait(until.elementLocated(By.css('tr:nth-child(5) > .text-center:nth-child(5) img')), 5000).catch(() => false);
|
|
|
|
if (!expectedIcon) {
|
|
throw new Error('Expected: Dashboard - My Standards New York - View icon not found');
|
|
}
|
|
console.log('Passed: Dashboard - My Standards New York - View icon is present');
|
|
}
|
|
},
|
|
|
|
//Dashboard - My Standards Organization = North Carolina Standards text
|
|
{
|
|
description: 'Validate Dashboard - My Standards Organization = North Carolina Standards text',
|
|
action: async () => {
|
|
const elementText = await driver.findElement(By.css('#stdbody > tr:nth-child(6) > td:nth-child(1)')).getText();
|
|
|
|
if (elementText === 'North Carolina Standards') {
|
|
console.log("Passed: Dashboard - My Standards North Carolina Standadrds text matched as expected");
|
|
} else {
|
|
throw new Error(`Expected: Dashboard - My Standards "North Carolina Standards"; Actual: "${elementText}"`);
|
|
}
|
|
}
|
|
},
|
|
|
|
//Dashboard - My Standards North Carolina - Export icon
|
|
{
|
|
description: 'Verify Dashboard - My Standards North Carolina - Export icon is present',
|
|
action: async () => {
|
|
const expectedIcon = await driver.wait(until.elementLocated(By.css('#stdbody > tr:nth-child(6) > .text-center:nth-child(2) img')), 5000).catch(() => false);
|
|
|
|
if (!expectedIcon) {
|
|
throw new Error('Expected: Dashboard - My Standards North Carolina - Export icon not found');
|
|
}
|
|
console.log('Passed: Dashboard - My Standards North Carolina - Export icon is present');
|
|
}
|
|
},
|
|
|
|
//Dashboard - My Standards North Carolina - More Info icon and title text
|
|
{
|
|
description: 'Verify Dashboard - My Standards North Carolina - More Info icon and title text is present',
|
|
action: async () => {
|
|
const element = await driver.wait(until.elementLocated(By.css('#stdbody > tr:nth-child(6) > td:nth-child(4) > a')), 5000).catch(() => false);
|
|
|
|
//Get title text
|
|
const elementTitleText = await element.getAttribute('title');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
if (!element) {
|
|
throw new Error('Expected: Dashboard - My Standards North Carolina - More Info icon not found');
|
|
}
|
|
console.log('Passed: Dashboard - My Standards North Carolina - More Info icon is present');
|
|
|
|
//Validate title text
|
|
if (elementTitleText === 'View Detail Information') {
|
|
console.log('Passed: Dashboard - My Standards North Carolina - text title matched as expected');
|
|
} else {
|
|
const message = `Expected: Dashboard - My Standards North Carolina - "View Detail Information" text title; Actual: "${elementTitleText}"`;
|
|
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('Multiple validation checks did not pass');
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Dashboard - My Standards North Carolina - View icon
|
|
{
|
|
description: 'Verify Dashboard - My Standards North Carolina - View icon is present',
|
|
action: async () => {
|
|
const expectedIcon = await driver.wait(until.elementLocated(By.css('tr:nth-child(6) > .text-center:nth-child(5) img')), 5000).catch(() => false);
|
|
|
|
if (!expectedIcon) {
|
|
throw new Error('Expected: Dashboard - My Standards North Carolina - View icon not found');
|
|
}
|
|
console.log('Passed: Dashboard - My Standards North Carolina - View icon is present');
|
|
}
|
|
},
|
|
|
|
//Dashboard - My Standards Organization = South Carolina Standards text
|
|
{
|
|
description: 'Validate Dashboard - My Standards Organization = South Carolina Standards text',
|
|
action: async () => {
|
|
const elementText = await driver.findElement(By.css('#stdbody > tr:nth-child(7) > td:nth-child(1)')).getText();
|
|
|
|
if (elementText === 'South Carolina Standards') {
|
|
console.log("Passed: Dashboard - My Standards South Carolina Standadrds text matched as expected");
|
|
} else {
|
|
throw new Error(`Expected: Dashboard - My Standards "South Carolina Standards"; Actual: "${elementText}"`);
|
|
}
|
|
}
|
|
},
|
|
|
|
//Dashboard - My Standards South Carolina - Export icon
|
|
{
|
|
description: 'Verify Dashboard - My Standards South Carolina - Export icon is present',
|
|
action: async () => {
|
|
const expectedIcon = await driver.wait(until.elementLocated(By.css('#stdbody > tr:nth-child(7) > .text-center:nth-child(2) img')), 5000).catch(() => false);
|
|
|
|
if (!expectedIcon) {
|
|
throw new Error('Expected: Dashboard - My Standards South Carolina - Export icon not found');
|
|
}
|
|
console.log('Passed: Dashboard - My Standards South Carolina - Export icon is present');
|
|
}
|
|
},
|
|
|
|
//Dashboard - My Standards South Carolina - More Info icon and title text
|
|
{
|
|
description: 'Verify Dashboard - My Standards South Carolina - More Info icon and title text is present',
|
|
action: async () => {
|
|
const element = await driver.wait(until.elementLocated(By.css('#stdbody > tr:nth-child(7) > td:nth-child(4) > a')), 5000).catch(() => false);
|
|
|
|
//Get title text
|
|
const elementTitleText = await element.getAttribute('title');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
if (!element) {
|
|
throw new Error('Expected: Dashboard - My Standards South Carolina - More Info icon not found');
|
|
}
|
|
console.log('Passed: Dashboard - My Standards South Carolina - More Info icon is present');
|
|
|
|
//Validate title text
|
|
if (elementTitleText === 'View Detail Information') {
|
|
console.log('Passed: Dashboard - My Standards South Carolina - text title matched as expected');
|
|
} else {
|
|
const message = `Expected: Dashboard - My Standards South Carolina - "View Detail Information" text title; Actual: "${elementTitleText}"`;
|
|
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('Multiple validation checks did not pass');
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Dashboard - My Standards South Carolina - View icon
|
|
{
|
|
description: 'Verify Dashboard - My Standards South Carolina - View icon is present',
|
|
action: async () => {
|
|
const expectedIcon = await driver.wait(until.elementLocated(By.css('tr:nth-child(7) > .text-center:nth-child(5) img')), 5000).catch(() => false);
|
|
|
|
if (!expectedIcon) {
|
|
throw new Error('Expected: Dashboard - My Standards South Carolina - View icon not found');
|
|
}
|
|
console.log('Passed: Dashboard - My Standards South Carolina - View icon is present');
|
|
}
|
|
},
|
|
|
|
//Dashboard - My Standards Organization = Texas TEKS Standards text
|
|
{
|
|
description: 'Validate Dashboard - My Standards Organization = Texas TEKS Standards text',
|
|
action: async () => {
|
|
const elementText = await driver.findElement(By.css('#stdbody > tr:nth-child(8) > td:nth-child(1)')).getText();
|
|
|
|
if (elementText === 'Texas TEKS Standards') {
|
|
console.log("Passed: Dashboard - My Standards Texas TEKS Standadrds text matched as expected");
|
|
} else {
|
|
throw new Error(`Expected: Dashboard - My Standards "Texas TEKS Standards"; Actual: "${elementText}"`);
|
|
}
|
|
}
|
|
},
|
|
|
|
//Dashboard - My Standards Texas TEKS - Export icon
|
|
{
|
|
description: 'Verify Dashboard - My Standards Texas TEKS - Export icon is present',
|
|
action: async () => {
|
|
const expectedIcon = await driver.wait(until.elementLocated(By.css('#stdbody > tr:nth-child(8) > .text-center:nth-child(2) img')), 5000).catch(() => false);
|
|
|
|
if (!expectedIcon) {
|
|
throw new Error('Expected: Dashboard - My Standards Texas TEKS - Export icon not found');
|
|
}
|
|
console.log('Passed: Dashboard - My Standards Texas TEKS - Export icon is present');
|
|
}
|
|
},
|
|
|
|
//Dashboard - My Standards Texas TEKS - More Info icon and title text
|
|
{
|
|
description: 'Verify Dashboard - My Standards Texas TEKS - More Info icon and title text is present',
|
|
action: async () => {
|
|
const element = await driver.wait(until.elementLocated(By.css('#stdbody > tr:nth-child(8) > td:nth-child(4) > a')), 5000).catch(() => false);
|
|
|
|
//Get title text
|
|
const elementTitleText = await element.getAttribute('title');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
if (!element) {
|
|
throw new Error('Expected: Dashboard - My Standards Texas TEKS - More Info icon not found');
|
|
}
|
|
console.log('Passed: Dashboard - My Standards Texas TEKS - More Info icon is present');
|
|
|
|
//Validate title text
|
|
if (elementTitleText === 'View Detail Information') {
|
|
console.log('Passed: Dashboard - My Standards Texas TEKS - text title matched as expected');
|
|
} else {
|
|
const message = `Expected: Dashboard - My Standards Texas TEKS - "View Detail Information" text title; Actual: "${elementTitleText}"`;
|
|
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('Multiple validation checks did not pass');
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Dashboard - My Standards Texas TEKS - View icon
|
|
{
|
|
description: 'Verify Dashboard - My Standards Texas TEKS - View icon is present',
|
|
action: async () => {
|
|
const expectedIcon = await driver.wait(until.elementLocated(By.css('tr:nth-child(8) > .text-center:nth-child(5) img')), 5000).catch(() => false);
|
|
|
|
if (!expectedIcon) {
|
|
throw new Error('Expected: Dashboard - My Standards Texas TEKS - View icon not found');
|
|
}
|
|
console.log('Passed: Dashboard - My Standards Texas TEKS - View icon is present');
|
|
}
|
|
},
|
|
|
|
//Dashboard - My Standards Organization = Washington Standards text
|
|
{
|
|
description: 'Validate Dashboard - My Standards Organization = Washington Standards text',
|
|
action: async () => {
|
|
const elementText = await driver.findElement(By.css('#stdbody > tr:nth-child(9) > td:nth-child(1)')).getText();
|
|
|
|
if (elementText === 'Washington Standards') {
|
|
console.log("Passed: Dashboard - My Standards Washington Standadrds text matched as expected");
|
|
} else {
|
|
throw new Error(`Expected: Dashboard - My Standards "Washington Standards"; Actual: "${elementText}"`);
|
|
}
|
|
}
|
|
},
|
|
|
|
//Dashboard - My Standards Washington - Export icon
|
|
{
|
|
description: 'Verify Dashboard - My Standards Washington - Export icon is present',
|
|
action: async () => {
|
|
const expectedIcon = await driver.wait(until.elementLocated(By.css('#stdbody > tr:nth-child(9) > .text-center:nth-child(2) img')), 5000).catch(() => false);
|
|
|
|
if (!expectedIcon) {
|
|
throw new Error('Expected: Dashboard - My Standards Washington - Export icon not found');
|
|
}
|
|
console.log('Passed: Dashboard - My Standards Washington - Export icon is present');
|
|
}
|
|
},
|
|
|
|
//Dashboard - My Standards Washington - More Info icon and title text
|
|
{
|
|
description: 'Verify Dashboard - My Standards Washington - More Info icon and title text is present',
|
|
action: async () => {
|
|
const element = await driver.wait(until.elementLocated(By.css('#stdbody > tr:nth-child(9) > td:nth-child(4) > a')), 5000).catch(() => false);
|
|
|
|
//Get title text
|
|
const elementTitleText = await element.getAttribute('title');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
if (!element) {
|
|
throw new Error('Expected: Dashboard - My Standards Washington - More Info icon not found');
|
|
}
|
|
console.log('Passed: Dashboard - My Standards Washington - More Info icon is present');
|
|
|
|
//Validate title text
|
|
if (elementTitleText === 'View Detail Information') {
|
|
console.log('Passed: Dashboard - My Standards Washington - text title matched as expected');
|
|
} else {
|
|
const message = `Expected: Dashboard - My Standards Washington - "View Detail Information" text title; Actual: "${elementTitleText}"`;
|
|
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('Multiple validation checks did not pass');
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Dashboard - My Standards Washington - View icon
|
|
{
|
|
description: 'Verify Dashboard - My Standards Washington - View icon is present',
|
|
action: async () => {
|
|
const expectedIcon = await driver.wait(until.elementLocated(By.css('tr:nth-child(9) > .text-center:nth-child(5) img')), 5000).catch(() => false);
|
|
|
|
if (!expectedIcon) {
|
|
throw new Error('Expected: Dashboard - My Standards Washington - View icon not found');
|
|
}
|
|
console.log('Passed: Dashboard - My Standards Washington - View icon is present');
|
|
}
|
|
},
|
|
|
|
/*NEXT ACTION - Click Other Available Standards tab
|
|
{
|
|
description: 'Dashboard - Click Other Available Standards tab',
|
|
action: async () => {
|
|
console.log('----->| NEXT ACTION: Clicked Other Available Standards tab');
|
|
await driver.findElement(By.css('#availstd-tab')).click();
|
|
await driver.sleep(2000);
|
|
}
|
|
},
|
|
|
|
//Dashboard - My Standards Widget title (dimmed)
|
|
{
|
|
description: 'Validate Dashboard Semantic Standards Comparison Widget title text, color, and size',
|
|
action: async () => {
|
|
const element = await driver.findElement(By.css('#mystd-tab'));
|
|
|
|
//Get text, color, and size
|
|
const elementText = await element.getText();
|
|
const elementColor = await element.getCssValue('color');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//Validate text
|
|
if (elementText === 'My Standards') {
|
|
console.log('Passed: Dashboard - Semantic Standards Comparison Widget title matched as expected');
|
|
} else {
|
|
const message = `Expected: Dashboard - "Semantic Standards Comparison"; Actual: "${elementText}"`;
|
|
errors.push(message);
|
|
}
|
|
|
|
//Validate color -gray (dimmed)
|
|
if (elementColor === 'rgba(182, 186, 181, 1)') {
|
|
console.log('Passed: Dashboard - Semantic Standards Comparison Widget title text color matched as expected');
|
|
} else {
|
|
const message = `Expected: Dashboard - Semantic Standards Comparison Widget title text color "rgba(182, 186, 181, 1)"; Actual: "${elementColor}"`;
|
|
errors.push(message);
|
|
}
|
|
|
|
//Validate font size
|
|
if (elementSize === '15px') {
|
|
console.log('Passed: Dashboard - Semantic Standards Comparison Widget title text font-size matched as expected');
|
|
} else {
|
|
const message = `Expected: Dashboard - Semantic Standards Comparison Widget title text font-size "15px"; Actual: "${elementSize}"`;
|
|
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('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, text, and font size (active)
|
|
{
|
|
description: 'Validate Dashboard - Other Available Stndards tab title text, color, and size',
|
|
action: async () => {
|
|
const element = await driver.findElement(By.css('#availstd-tab'));
|
|
|
|
//Get text, color, and size
|
|
const elementText = await element.getText();
|
|
const elementColor = await element.getCssValue('color');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//Validate text
|
|
if (elementText === 'Other Available Standards') {
|
|
console.log('Passed: Dashboard - Other Available Standards tab title matched as expected');
|
|
} else {
|
|
const message = `Expected: Dashboard - "Other Available Standards"; Actual: "${elementText}"`;
|
|
errors.push(message);
|
|
}
|
|
|
|
//Validate color -navy blue
|
|
if (elementColor === 'rgba(40, 39, 90, 1)') {
|
|
console.log('Passed: Dashboard - Other Available Standards tab title text color matched as expected');
|
|
} else {
|
|
const message = `Expected: Dashboard - Other Available Standards tab title text color "rgba(40, 39, 90, 1)"'; Actual: "${elementColor}"`;
|
|
errors.push(message);
|
|
}
|
|
|
|
//Validate font size
|
|
if (elementSize === '15px') {
|
|
console.log('Passed: Dashboard - Other Available Standards tab title text font-size matched as expected');
|
|
} else {
|
|
const message = `Expected: Dashboard - Other Available Standards tab title text font-size "15px"; Actual: "${elementSize}"`;
|
|
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('Multiple validation checks did not pass');
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Dashboard - Other Available Standards description text
|
|
{
|
|
description: 'Validate Dashboard - Other Available Standards description text',
|
|
action: async () => {
|
|
const elementText = await driver.findElement(By.css('p:nth-child(1)')).getText();
|
|
|
|
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 {
|
|
throw new Error(`Expected: Dashboard - Other Available Standards description text "The following standards are also available to clients. If you would like access to any of these standards sets, please Contact Us."; Actual: "${elementText}"`);
|
|
}
|
|
}
|
|
},
|
|
|
|
//Dashboard - Other Available Standards dropdown
|
|
{
|
|
description: 'Validate Dashboard - Other Available Standards dropdown list and value',
|
|
action: async () => {
|
|
const dropdown = await driver.findElement(By.css('#defstdparent'));
|
|
const dropdownValue = await dropdown.getAttribute('value');
|
|
const options = await dropdown.findElements(By.css('option'));
|
|
const expectedList = [
|
|
'Additional U.S. Standards',
|
|
'Australia Standards',
|
|
'Canada Standards',
|
|
'England Standards',
|
|
'National Standards',
|
|
'Supplemental Standards',
|
|
'United States Standards'
|
|
];
|
|
const actual = [];
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
if (dropdownValue === '154828031') {
|
|
console.log("Passed: Dashboard - Other Available Standards dropdown value matched as expected");
|
|
} else {
|
|
const message = `Expected: Dashboard - Other Available Standards dropdown value - "United States Standards"; Actual: "${dropdownValue}"`;
|
|
errors.push(message);
|
|
}
|
|
|
|
for (const opt of options) {
|
|
const text = (await opt.getText()).trim();
|
|
actual.push(text);
|
|
}
|
|
|
|
if (JSON.stringify(actual) === JSON.stringify(expectedList)) {
|
|
console.log('Passed: Dashboard - Other Available Standards Dropdown list matched as expected');
|
|
} else {
|
|
const message = `Expected: Dashboard - Other Available Standards Dropdown list: ${JSON.stringify(expectedList)}, Actual: ${JSON.stringify(actual)}`;
|
|
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('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, text, and font size
|
|
{
|
|
description: 'Validate Dashboard - Other Available Standards Organization column title, text, and font size',
|
|
action: async () => {
|
|
const element = await driver.findElement(By.css('.table:nth-child(3) th:nth-child(1)'));
|
|
|
|
//Get text, color, and size
|
|
const elementText = await element.getText();
|
|
const elementColor = await element.getCssValue('color');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//Validate text
|
|
if (elementText === 'Organization') {
|
|
console.log('Passed: Dashboard - Other Available Standards Organization column title matched as expected');
|
|
} else {
|
|
const message = `Expected: Dashboard - Other Available Standards "Organization" column title; Actual: "${elementText}"`;
|
|
errors.push(message);
|
|
}
|
|
|
|
//Validate color -dark gray
|
|
if (elementColor === 'rgba(94, 105, 116, 1)') {
|
|
console.log('Passed: Dashboard - Other Available Standards Organization column title text color matched as expected');
|
|
} else {
|
|
const message = `Expected: Dashboard - Other Available Standards Organization column title text color "rgba(94, 105, 116, 1)"'; Actual: "${elementColor}"`;
|
|
errors.push(message);
|
|
}
|
|
|
|
//Validate font size
|
|
if (elementSize === '14px') {
|
|
console.log('Passed: Dashboard - Other Available Standards Organization column title text font-size matched as expected');
|
|
} else {
|
|
const message = `Expected: Dashboard - Other Available Standards Organization column title text font-size "14px"; Actual: "${elementSize}"`;
|
|
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('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, text, and font size
|
|
{
|
|
description: 'Validate Dashboard - Other Available Standards More Info column title, text, and font size',
|
|
action: async () => {
|
|
const element = await driver.findElement(By.css('.table:nth-child(3) > thead .text-center'));
|
|
|
|
//Get text, color, and size
|
|
const elementText = await element.getText();
|
|
const elementColor = await element.getCssValue('color');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//Validate text
|
|
if (elementText === 'More Info') {
|
|
console.log('Passed: Dashboard - Other Available Standards More Info column title matched as expected');
|
|
} else {
|
|
const message = `Expected: Dashboard - Other Available Standards "More Info" column title; Actual: "${elementText}"`;
|
|
errors.push(message);
|
|
}
|
|
|
|
//Validate color -dark gray
|
|
if (elementColor === 'rgba(94, 105, 116, 1)') {
|
|
console.log('Passed: Dashboard - Other Available Standards More Info column title text color matched as expected');
|
|
} else {
|
|
const message = `Expected: Dashboard - Other Available Standards More Info column title text color "rgba(94, 105, 116, 1)"'; Actual: "${elementColor}"`;
|
|
errors.push(message);
|
|
}
|
|
|
|
//Validate font size
|
|
if (elementSize === '14px') {
|
|
console.log('Passed: Dashboard - Other Available Standards More Info column title text font-size matched as expected');
|
|
} else {
|
|
const message = `Expected: Dashboard - Other Available Standards More Info column title text font-size "14px"; Actual: "${elementSize}"`;
|
|
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('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 Standards text
|
|
{
|
|
description: 'Validate Dashboard - Other Available Standards - Alaska Standards text',
|
|
action: async () => {
|
|
const elementText = await driver.findElement(By.css('#defstdbody > tr:nth-child(1) > td:nth-child(1)')).getText();
|
|
|
|
if (elementText === 'Alaska Standards') {
|
|
console.log("Passed: Dashboard - Other Available Standards - Alaska Standards text matched as expected");
|
|
} else {
|
|
throw new Error(`Expected: Dashboard - Other Available Standards - "Alaska Standards"; Actual: "${elementText}"`);
|
|
}
|
|
}
|
|
},
|
|
|
|
//Dashboard - Other Available Standards - Alaska Standards More Info icon
|
|
{
|
|
description: 'Verify Dashboard - Other Available Standards - Alaska Standards icon is present',
|
|
action: async () => {
|
|
const expectedIcon = await driver.wait(until.elementLocated(By.css('#defstdbody > tr:nth-child(1) img')), 5000).catch(() => false);
|
|
|
|
if (!expectedIcon) {
|
|
throw new Error('Expected: Dashboard - Other Available Standards - Alaska Standards More Info icon not found');
|
|
}
|
|
console.log('Passed: Dashboard - Other Available Standards - Alaska Standards More Info icon is present');
|
|
}
|
|
},
|
|
|
|
//Dashboard - Other Available Standards - Arkansas Standards text
|
|
{
|
|
description: 'Validate Dashboard - Other Available Standards - Arkansas Standards text',
|
|
action: async () => {
|
|
const elementText = await driver.findElement(By.css('#defstdbody > tr:nth-child(2) > td:nth-child(1)')).getText();
|
|
|
|
if (elementText === 'Arkansas Standards') {
|
|
console.log("Passed: Dashboard - Other Available Standards - Arkansas Standards text matched as expected");
|
|
} else {
|
|
throw new Error(`Expected: Dashboard - Other Available Standards - "Arkansas Standards"; Actual: "${elementText}"`);
|
|
}
|
|
}
|
|
},
|
|
|
|
//Dashboard - Other Available Standards - Arkansas Standards More Info icon
|
|
{
|
|
description: 'Verify Dashboard - Other Available Standards - Arkansas Standards icon is present',
|
|
action: async () => {
|
|
const expectedIcon = await driver.wait(until.elementLocated(By.css('#defstdbody > tr:nth-child(2) img')), 5000).catch(() => false);
|
|
|
|
if (!expectedIcon) {
|
|
throw new Error('Expected: Dashboard - Other Available Standards - Arkansas Standards More Info icon not found');
|
|
}
|
|
console.log('Passed: Dashboard - Other Available Standards - Arkansas Standards More Info icon is present');
|
|
}
|
|
},
|
|
|
|
//Dashboard - Other Available Standards - Colorado Standards text
|
|
{
|
|
description: 'Validate Dashboard - Other Available Standards - Colorado Standards text',
|
|
action: async () => {
|
|
const elementText = await driver.findElement(By.css('#defstdbody > tr:nth-child(3) > td:nth-child(1)')).getText();
|
|
|
|
if (elementText === 'Colorado Standards') {
|
|
console.log("Passed: Dashboard - Other Available Standards - Colorado Standards text matched as expected");
|
|
} else {
|
|
throw new Error(`Expected: Dashboard - Other Available Standards - "Colorado Standards"; Actual: "${elementText}"`);
|
|
}
|
|
}
|
|
},
|
|
|
|
//Dashboard - Other Available Standards - Colorado Standards More Info icon
|
|
{
|
|
description: 'Verify Dashboard - Other Available Standards - Colorado Standards icon is present',
|
|
action: async () => {
|
|
const expectedIcon = await driver.wait(until.elementLocated(By.css('#defstdbody > tr:nth-child(3) img')), 5000).catch(() => false);
|
|
|
|
if (!expectedIcon) {
|
|
throw new Error('Expected: Dashboard - Other Available Standards - Colorado Standards More Info icon not found');
|
|
}
|
|
console.log('Passed: Dashboard - Other Available Standards - Colorado Standards More Info icon is present');
|
|
}
|
|
},
|
|
|
|
//Dashboard - Other Available Standards - Connecticut Standards text
|
|
{
|
|
description: 'Validate Dashboard - Other Available Standards - Connecticut Standards text',
|
|
action: async () => {
|
|
const elementText = await driver.findElement(By.css('#defstdbody > tr:nth-child(4) > td:nth-child(1)')).getText();
|
|
|
|
if (elementText === 'Connecticut Standards') {
|
|
console.log("Passed: Dashboard - Other Available Standards - Connecticut Standards text matched as expected");
|
|
} else {
|
|
throw new Error(`Expected: Dashboard - Other Available Standards - "Connecticut Standards"; Actual: "${elementText}"`);
|
|
}
|
|
}
|
|
},
|
|
|
|
//Dashboard - Other Available Standards - Connecticut Standards More Info icon
|
|
{
|
|
description: 'Verify Dashboard - Other Available Standards - Connecticut Standards icon is present',
|
|
action: async () => {
|
|
const expectedIcon = await driver.wait(until.elementLocated(By.css('#defstdbody > tr:nth-child(4) img')), 5000).catch(() => false);
|
|
|
|
if (!expectedIcon) {
|
|
throw new Error('Expected: Dashboard - Other Available Standards - Connecticut Standards More Info icon not found');
|
|
}
|
|
console.log('Passed: Dashboard - Other Available Standards - Connecticut Standards More Info icon is present');
|
|
}
|
|
},
|
|
|
|
//Dashboard - Other Available Standards - Delaware Standards text
|
|
{
|
|
description: 'Validate Dashboard - Other Available Standards - Delaware Standards text',
|
|
action: async () => {
|
|
const elementText = await driver.findElement(By.css('#defstdbody > tr:nth-child(5) > td:nth-child(1)')).getText();
|
|
|
|
if (elementText === 'Delaware Standards') {
|
|
console.log("Passed: Dashboard - Other Available Standards - Delaware Standards text matched as expected");
|
|
} else {
|
|
throw new Error(`Expected: Dashboard - Other Available Standards - "Delaware Standards"; Actual: "${elementText}"`);
|
|
}
|
|
}
|
|
},
|
|
|
|
//Dashboard - Other Available Standards - Delaware Standards More Info icon
|
|
{
|
|
description: 'Verify Dashboard - Other Available Standards - Delaware Standards icon is present',
|
|
action: async () => {
|
|
const expectedIcon = await driver.wait(until.elementLocated(By.css('#defstdbody > tr:nth-child(5) img')), 5000).catch(() => false);
|
|
|
|
if (!expectedIcon) {
|
|
throw new Error('Expected: Dashboard - Other Available Standards - Delaware Standards More Info icon not found');
|
|
}
|
|
console.log('Passed: Dashboard - Other Available Standards - Delaware Standards More Info icon is present');
|
|
}
|
|
},
|
|
|
|
//NEXT ACTION - Click MyStandards tab
|
|
{
|
|
description: 'Dashboard - Click My Standards tab',
|
|
action: async () => {
|
|
console.log('----->| NEXT ACTION: Clicked My Standards tab');
|
|
await driver.findElement(By.css('#mystd-tab')).click();
|
|
await driver.sleep(2000);
|
|
}
|
|
},
|
|
|
|
//Dashboard - My Standards Widget title (active)
|
|
{
|
|
description: 'Validate Dashboard Semantic Standards Comparison Widget title text, color, and size',
|
|
action: async () => {
|
|
const element = await driver.findElement(By.css('#mystd-tab'));
|
|
|
|
//Get text, color, and size
|
|
const elementText = await element.getText();
|
|
const elementColor = await element.getCssValue('color');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//Validate text
|
|
if (elementText === 'My Standards') {
|
|
console.log('Passed: Dashboard - Semantic Standards Comparison Widget title matched as expected');
|
|
} else {
|
|
const message = `Expected: Dashboard - "Semantic Standards Comparison"; Actual: "${elementText}"`;
|
|
errors.push(message);
|
|
}
|
|
|
|
//Validate color -navy blue
|
|
if (elementColor === 'rgba(40, 39, 90, 1)') {
|
|
console.log('Passed: Dashboard - Semantic Standards Comparison Widget title text color matched as expected');
|
|
} else {
|
|
const message = `Expected: Dashboard - Semantic Standards Comparison Widget title text color "rgba(40, 39, 90, 1)"; Actual: "${elementColor}"`;
|
|
errors.push(message);
|
|
}
|
|
|
|
//Validate font size
|
|
if (elementSize === '15px') {
|
|
console.log('Passed: Dashboard - Semantic Standards Comparison Widget title text font-size matched as expected');
|
|
} else {
|
|
const message = `Expected: Dashboard - Semantic Standards Comparison Widget title text font-size "15px"; Actual: "${elementSize}"`;
|
|
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('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, text, and font size (dimmed)
|
|
{
|
|
description: 'Validate Dashboard - Other Available Stndards tab title text, color, and size',
|
|
action: async () => {
|
|
const element = await driver.findElement(By.css('#availstd-tab'));
|
|
|
|
//Get text, color, and size
|
|
const elementText = await element.getText();
|
|
const elementColor = await element.getCssValue('color');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//Validate text
|
|
if (elementText === 'Other Available Standards') {
|
|
console.log('Passed: Dashboard - Other Available Standards tab title matched as expected');
|
|
} else {
|
|
const message = `Expected: Dashboard - "Other Available Standards"; Actual: "${elementText}"`;
|
|
errors.push(message);
|
|
}
|
|
|
|
//Validate color -gray (dimmed)
|
|
if (elementColor === 'rgba(182, 186, 181, 1)') {
|
|
console.log('Passed: Dashboard - Other Available Standards tab title text color matched as expected');
|
|
} else {
|
|
const message = `Expected: Dashboard - Other Available Standards tab title text color "rgba(182, 186, 181, 1)"'; Actual: "${elementColor}"`;
|
|
errors.push(message);
|
|
}
|
|
|
|
//Validate font size
|
|
if (elementSize === '15px') {
|
|
console.log('Passed: Dashboard - Other Available Standards tab title text font-size matched as expected');
|
|
} else {
|
|
const message = `Expected: Dashboard - Other Available Standards tab title text font-size "15px"; Actual: "${elementSize}"`;
|
|
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('Multiple validation checks did not pass');
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//NEXT ACTION - Click Alabama Export icon
|
|
{
|
|
description: 'Dashboard - Click Alabama Export icon',
|
|
action: async () => {
|
|
console.log('----->| NEXT ACTION: Clicked Alabama Export icon');
|
|
await driver.findElement(By.css('#stdbody > tr:nth-child(1) > .text-center:nth-child(2) img')).click();
|
|
}
|
|
},
|
|
|
|
//Wait for element
|
|
{
|
|
description: 'Wait for DIV to be visible',
|
|
action: async () => {
|
|
|
|
//Wait until the element exists in the DOM
|
|
const elementVisible = await driver.wait(
|
|
until.elementLocated(By.css('.modal-lg .modal-title')),
|
|
20000
|
|
);
|
|
|
|
//Wait until it becomes visible
|
|
await driver.wait(
|
|
until.elementIsVisible(elementVisible),
|
|
20000
|
|
);
|
|
await driver.sleep(2000);
|
|
}
|
|
},
|
|
|
|
//DIV - Export Standards title, text, and font size
|
|
{
|
|
description: 'Validate DIV - Export Standards title text, color, and size',
|
|
action: async () => {
|
|
const element = await driver.findElement(By.css('.modal-lg .modal-title'));
|
|
|
|
//Get text, color, and size
|
|
const elementText = await element.getText();
|
|
const elementColor = await element.getCssValue('color');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//Validate text
|
|
if (elementText === 'Export Standards') {
|
|
console.log('Passed: DIV - Export Standards title matched as expected');
|
|
} else {
|
|
const message = `Expected: DIV - "Export Standards"; Actual: "${elementText}"`;
|
|
errors.push(message);
|
|
}
|
|
|
|
//Validate color -navy blue
|
|
if (elementColor === 'rgba(40, 39, 90, 1)') {
|
|
console.log('Passed: DIV - Export Standards title text color matched as expected');
|
|
} else {
|
|
const message = `Expected: DIV - Export Standards title text color "rgba(40, 39, 90, 1)"'; Actual: "${elementColor}"`;
|
|
errors.push(message);
|
|
}
|
|
|
|
//Validate font size
|
|
if (elementSize === '18px') {
|
|
console.log('Passed: DIV - Export Standards title text font-size matched as expected');
|
|
} else {
|
|
const message = `Expected: DIV - Export Standards title text font-size "18px"; Actual: "${elementSize}"`;
|
|
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('Multiple validation checks did not pass');
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//DIV - Alabama Standards sub-title, text, and font size
|
|
{
|
|
description: 'Validate DIV - Alabama Standards sub-title text, color, and size',
|
|
action: async () => {
|
|
const element = await driver.findElement(By.css('p > b'));
|
|
|
|
//Get text, color, and size
|
|
const elementText = await element.getText();
|
|
const elementColor = await element.getCssValue('color');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//Validate text
|
|
if (elementText === 'Alabama Standards') {
|
|
console.log('Passed: DIV - Alabama Standards sub-title matched as expected');
|
|
} else {
|
|
const message = `Expected: DIV - sub-title "Alabama Standards"; Actual: "${elementText}"`;
|
|
errors.push(message);
|
|
}
|
|
|
|
//Validate color -navy blue
|
|
if (elementColor === 'rgba(40, 39, 90, 1)') {
|
|
console.log('Passed: DIV - Alabama Standards sub-title text color matched as expected');
|
|
} else {
|
|
const message = `Expected: DIV - Alabama Standards sub-title text color "rgba(40, 39, 90, 1)"'; Actual: "${elementColor}"`;
|
|
errors.push(message);
|
|
}
|
|
|
|
//Validate font size
|
|
if (elementSize === '13px') {
|
|
console.log('Passed: DIV - Alabama Standards sub-title text font-size matched as expected');
|
|
} else {
|
|
const message = `Expected: DIV - Alabama Standards sub-title text font-size "13px"; Actual: "${elementSize}"`;
|
|
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('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, text, and font size
|
|
{
|
|
description: 'Validate DIV - Alabama Standards Subject label text, color, and size',
|
|
action: async () => {
|
|
const element = await driver.findElement(By.css('.form-row:nth-child(2) > .form-group:nth-child(1) > label'));
|
|
|
|
//Get text, color, and size
|
|
const elementText = await element.getText();
|
|
const elementColor = await element.getCssValue('color');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//Validate text
|
|
if (elementText === 'Subject') {
|
|
console.log('Passed: DIV - Alabama Standards Subject label matched as expected');
|
|
} else {
|
|
const message = `Expected: DIV - "Subject" label; Actual: "${elementText}"`;
|
|
errors.push(message);
|
|
}
|
|
|
|
//Validate color -navy blue
|
|
if (elementColor === 'rgba(40, 39, 90, 1)') {
|
|
console.log('Passed: DIV - Alabama Standards Subject label text color matched as expected');
|
|
} else {
|
|
const message = `Expected: DIV - Alabama Standards Subject label text color "rgba(40, 39, 90, 1)"'; Actual: "${elementColor}"`;
|
|
errors.push(message);
|
|
}
|
|
|
|
//Validate font size
|
|
if (elementSize === '15px') {
|
|
console.log('Passed: DIV - Alabama Standards Subject label text font-size matched as expected');
|
|
} else {
|
|
const message = `Expected: DIV - Alabama Standards Subject label text font-size "15px"; Actual: "${elementSize}"`;
|
|
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('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 select = await driver.findElement(By.css('#exsubject'));
|
|
|
|
// Get the selected option text
|
|
const selectedOption = await select.findElement(By.css('option:checked'));
|
|
const selectedText = await selectedOption.getText();
|
|
|
|
if (selectedText === 'Choose a subject') {
|
|
console.log('Passed: DIV - Subject Choose a subject default value matched as expected');
|
|
} else {
|
|
throw new Error(`Expected DIV - Subject "Choose a subject"; Actual: "${selectedText}"`);
|
|
}
|
|
|
|
const options = await select.findElements(By.css('option'));
|
|
const expectedList = [
|
|
'Choose a subject',
|
|
'Language Arts',
|
|
'Mathematics',
|
|
'Science',
|
|
'Social Studies',
|
|
'World Languages'
|
|
];
|
|
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: DIV - Subject Dropdown list matched as expected');
|
|
} else {
|
|
const message = `Expected: DIV - Subject Dropdown list: ${JSON.stringify(expectedList)}, Actual: ${JSON.stringify(actual)}`;
|
|
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('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, text, and font size
|
|
{
|
|
description: 'Validate DIV - Alabama Standards Format label text, color, and size',
|
|
action: async () => {
|
|
const element = await driver.findElement(By.css('.form-row:nth-child(2) > .form-group:nth-child(2) > label'));
|
|
|
|
//Get text, color, and size
|
|
const elementText = await element.getText();
|
|
const elementColor = await element.getCssValue('color');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//Validate text
|
|
if (elementText === 'Format') {
|
|
console.log('Passed: DIV - Alabama Standards Format label matched as expected');
|
|
} else {
|
|
const message = `Expected: DIV - "Format" label; Actual: "${elementText}"`;
|
|
errors.push(message);
|
|
}
|
|
|
|
//Validate color -navy blue
|
|
if (elementColor === 'rgba(40, 39, 90, 1)') {
|
|
console.log('Passed: DIV - Alabama Standards Format label text color matched as expected');
|
|
} else {
|
|
const message = `Expected: DIV - Alabama Standards Format label text color "rgba(40, 39, 90, 1)"'; Actual: "${elementColor}"`;
|
|
errors.push(message);
|
|
}
|
|
|
|
//Validate font size
|
|
if (elementSize === '15px') {
|
|
console.log('Passed: DIV - Alabama Standards Format label text font-size matched as expected');
|
|
} else {
|
|
const message = `Expected: DIV - Alabama Standards Format label text font-size "15px"; Actual: "${elementSize}"`;
|
|
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('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 dropdown = await driver.findElement(By.css('#exformat'));
|
|
const dropdownValue = await dropdown.getAttribute('value');
|
|
const options = await dropdown.findElements(By.css('option'));
|
|
const expectedList = [
|
|
'CSV',
|
|
'JSON'
|
|
];
|
|
const actual = [];
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
if (dropdownValue === 'csv') {
|
|
console.log("Passed: DIV - Format dropdown value matched as expected");
|
|
} else {
|
|
const message = `Expected: DIV - Format dropdown value - "CSV"; Actual: "${dropdownValue}"`;
|
|
errors.push(message);
|
|
}
|
|
|
|
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 {
|
|
const message = `Expected: DIV - Format Dropdown list: ${JSON.stringify(expectedList)}, Actual: ${JSON.stringify(actual)}`;
|
|
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('Multiple validation checks did not pass');
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//DIV - Alabama Standards Grades label, text, and font size
|
|
{
|
|
description: 'Validate DIV - Alabama Standards Grades label text, color, and size',
|
|
action: async () => {
|
|
const element = await driver.findElement(By.css('.col-md-12:nth-child(1) > label'));
|
|
|
|
//Get text, color, and size
|
|
const elementText = await element.getText();
|
|
const elementColor = await element.getCssValue('color');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//Validate text
|
|
if (elementText === 'Grades') {
|
|
console.log('Passed: DIV - Alabama Standards Grades label matched as expected');
|
|
} else {
|
|
const message = `Expected: DIV - "Grades" label; Actual: "${elementText}"`;
|
|
errors.push(message);
|
|
}
|
|
|
|
//Validate color -navy blue
|
|
if (elementColor === 'rgba(40, 39, 90, 1)') {
|
|
console.log('Passed: DIV - Alabama Standards Grades label text color matched as expected');
|
|
} else {
|
|
const message = `Expected: DIV - Alabama Standards Grades label text color "rgba(40, 39, 90, 1)"'; Actual: "${elementColor}"`;
|
|
errors.push(message);
|
|
}
|
|
|
|
//Validate font size
|
|
if (elementSize === '15px') {
|
|
console.log('Passed: DIV - Alabama Standards Grades label text font-size matched as expected');
|
|
} else {
|
|
const message = `Expected: DIV - Alabama Standards Grades label text font-size "15px"; Actual: "${elementSize}"`;
|
|
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('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 dropdown = await driver.findElement(By.css('#exgrades'));
|
|
const dropdownValue = await dropdown.getText();
|
|
const options = await dropdown.findElements(By.css('option'));
|
|
const expectedList = [
|
|
'Please select a subject first'
|
|
];
|
|
const actual = [];
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
if (dropdownValue === 'Please select a subject first') {
|
|
console.log("Passed: DIV - Grades dropdown value matched as expected");
|
|
} else {
|
|
const message = `Expected: DIV - Grades dropdown value - "Please select a subject first"; Actual: "${dropdownValue}"`;
|
|
errors.push(message);
|
|
}
|
|
|
|
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 {
|
|
const message = `Expected: DIV - Grades Dropdown list: ${JSON.stringify(expectedList)}, Actual: ${JSON.stringify(actual)}`;
|
|
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('Multiple validation checks did not pass');
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//DIV - Download button validation
|
|
{
|
|
description: 'Validate DIV - Download button icon, text, and color',
|
|
action: async () => {
|
|
const icon = await driver.findElement(By.css('#exsubmit > .fa'));
|
|
const element = await driver.findElement(By.css('#exsubmit'));
|
|
|
|
//Get text, color, and icon
|
|
const elementText = await element.getText();
|
|
const elementColor = await element.getCssValue('background-color');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//Validate button icon is present
|
|
if (icon) {
|
|
console.log('Passed: DIV - Download button icon is present');
|
|
} else {
|
|
const message = 'Expected: DIV - Download button icon not found';
|
|
errors.push(message);
|
|
}
|
|
|
|
//Validate text
|
|
if (elementText === 'Download') {
|
|
console.log('Passed: DIV - Get Download button text matched as expected');
|
|
} else {
|
|
const message = `Expected: DIV - "Download" button text; Actual: "${elementText}"`;
|
|
errors.push(message);
|
|
}
|
|
|
|
//Validate color -green
|
|
if (elementColor === 'rgba(48, 200, 172, 1)') {
|
|
console.log('Passed: DIV - Download button color matched as expected');
|
|
} else {
|
|
const message = `Expected: DIV - Download button color "rgba(48, 200, 172, 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('Multiple validation checks did not pass');
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//DIV - Close button validation
|
|
{
|
|
description: 'Validate DIV - Close button icon, text, and color',
|
|
action: async () => {
|
|
const element = await driver.findElement(By.css('#modalclose'));
|
|
|
|
//Get text, color, and icon
|
|
const elementText = await element.getText();
|
|
const elementColor = await element.getCssValue('background-color');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//Validate text
|
|
if (elementText === 'Close') {
|
|
console.log('Passed: DIV - Close button text matched as expected');
|
|
} else {
|
|
const message = `Expected: DIV - "Close" button text; Actual: "${elementText}"`;
|
|
errors.push(message);
|
|
}
|
|
|
|
//Validate color -white
|
|
if (elementColor === 'rgba(0, 0, 0, 0)') {
|
|
console.log('Passed: DIV - Close button color matched as expected');
|
|
} else {
|
|
const message = `Expected: DIV - Close button color "rgba(0, 0, 0, 0)"; 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('Multiple validation checks did not pass');
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//NEXT ACTION - Click Download button (validation)
|
|
{
|
|
description: 'DIV - Click DIV Download button',
|
|
action: async () => {
|
|
console.log('----->| NEXT ACTION: Clicked DIV Download button (validation)');
|
|
await driver.findElement(By.css('#exsubmit > .fa')).click();
|
|
await driver.sleep(2000);
|
|
}
|
|
},
|
|
|
|
//DIV - Validation, text, color, and size
|
|
{
|
|
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 elementColor = await element.getCssValue('color');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//Validate text
|
|
if (elementText === 'A subject and at least one grade must be selected.') {
|
|
console.log('Passed: DIV - Validation text matched as expected');
|
|
} else {
|
|
const message = `Expected: DIV - validation text "A subject and at least one grade must be selected."; Actual: "${elementText}"`;
|
|
errors.push(message);
|
|
}
|
|
|
|
//Validate color -red
|
|
if (elementColor === 'rgba(220, 53, 69, 1)') {
|
|
console.log('Passed: DIV - Validation text color matched as expected');
|
|
} else {
|
|
const message = `Expected: DIV - Validation text color "rgba(220, 53, 69, 1)"'; Actual: "${elementColor}"`;
|
|
errors.push(message);
|
|
}
|
|
|
|
//Validate font size
|
|
if (elementSize === '13px') {
|
|
console.log('Passed: DIV - Validation text font-size matched as expected');
|
|
} else {
|
|
const message = `Expected: DIV - Validation text font-size "13px"; Actual: "${elementSize}"`;
|
|
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('Multiple validation checks did not pass');
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//NEXT ACTION - Export Standards DIV - Select subject and grade
|
|
{
|
|
description: 'Validate Export Standards DIV - Select subject and grade',
|
|
action: async () => {
|
|
//Select "Mathematics" from dropdown
|
|
console.log('----->| NEXT ACTION: Selected Subject = Mathematics');
|
|
await driver.findElement(By.css('#exsubject')).click();
|
|
await driver.sleep(2000);
|
|
await driver.findElement(By.css('#exsubject > option:nth-child(3)')).click();
|
|
|
|
//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
|
|
console.log('----->| NEXT ACTION: Clicked X clear icon');
|
|
await clearGradesIcon.click();
|
|
await driver.sleep(2000);
|
|
|
|
console.log('----->| NEXT ACTION: Selected grades: 9, 10, 11, and 12');
|
|
await driver.findElement(By.xpath("//li[contains(text(), '9')]")).click();
|
|
await driver.sleep(2000);
|
|
|
|
await driver.findElement(By.xpath("//li[contains(text(), '10')]")).click();
|
|
await driver.sleep(2000);
|
|
|
|
await driver.findElement(By.xpath("//li[contains(text(), '11')]")).click();
|
|
await driver.sleep(2000);
|
|
|
|
await driver.findElement(By.xpath("//li[contains(text(), '12')]")).click();
|
|
await driver.sleep(2000);
|
|
|
|
//Click away from dropdown list
|
|
await driver.findElement(By.css('#exform > div:nth-child(3) > div > span')).click();
|
|
await driver.sleep(2000);
|
|
|
|
/*Click Download button
|
|
console.log('----->| NEXT ACTION: Clicked Download button');
|
|
await driver.findElement(By.css('#exsubmit')).click();
|
|
await driver.sleep(5000);*/
|
|
/*},
|
|
},
|
|
|
|
//NEXT ACTION - Click Close button
|
|
{
|
|
description: 'DIV - Click DIV Close button',
|
|
action: async () => {
|
|
console.log('----->| NEXT ACTION: Clicked DIV Close button');
|
|
await driver.findElement(By.css('#modalclose')).click();
|
|
await driver.sleep(2000);
|
|
}
|
|
},
|
|
|
|
//NEXT ACTION - Click Arizona More Info icon
|
|
{
|
|
description: 'DIV - Click Arizona More Info icon',
|
|
action: async () => {
|
|
console.log('----->| NEXT ACTION: Clicked Arizona More Info icon');
|
|
await driver.findElement(By.css('#stdbody > tr:nth-child(2) > .text-center:nth-child(4) img')).click();
|
|
await driver.sleep(2000);
|
|
}
|
|
},
|
|
|
|
//Wait for element
|
|
{
|
|
description: 'Wait for DIV to be visible',
|
|
action: async () => {
|
|
|
|
//Wait until the element exists in the DOM
|
|
const elementVisible = await driver.wait(
|
|
until.elementLocated(By.css('.modal-lg .modal-title')),
|
|
20000
|
|
);
|
|
|
|
//Wait until it becomes visible
|
|
await driver.wait(
|
|
until.elementIsVisible(elementVisible),
|
|
20000
|
|
);
|
|
await driver.sleep(2000);
|
|
}
|
|
},
|
|
|
|
//DIV - More Info title, text, and font size
|
|
{
|
|
description: 'Validate DIV - More Info title text, color, and size',
|
|
action: async () => {
|
|
const element = await driver.findElement(By.css('.modal-lg .modal-title'));
|
|
|
|
//Get text, color, and size
|
|
const elementText = await element.getText();
|
|
const elementColor = await element.getCssValue('color');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//Validate text
|
|
if (elementText === `Arizona's College and Career Ready Standards`) {
|
|
console.log(`Passed: DIV - Arizona's College and Career Ready Standards title matched as expected`);
|
|
} else {
|
|
const message = `Expected: DIV - "Arizona's College and Career Ready Standards"; Actual: "${elementText}"`;
|
|
errors.push(message);
|
|
}
|
|
|
|
//Validate color -navy blue
|
|
if (elementColor === 'rgba(40, 39, 90, 1)') {
|
|
console.log(`Passed: DIV - Arizona's College and Career Ready Standards title text color matched as expected`);
|
|
} else {
|
|
const message = `Expected: DIV - Arizona's College and Career Ready Standards title text color "rgba(40, 39, 90, 1)"'; Actual: "${elementColor}"`;
|
|
errors.push(message);
|
|
}
|
|
|
|
//Validate font size
|
|
if (elementSize === '18px') {
|
|
console.log(`Passed: DIV - Arizona's College and Career Ready Standards title text font-size matched as expected`);
|
|
} else {
|
|
const message = `Expected: DIV - Arizona's College and Career Ready Standards title text font-size "18px"; Actual: "${elementSize}"`;
|
|
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('Multiple validation checks did not pass');
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//DIV - More Info Arizona sub-text, and font size
|
|
{
|
|
description: 'Validate DIV - More Info Arizona sub-text, color, and size',
|
|
action: async () => {
|
|
const element = await driver.findElement(By.css('.modal-body > .notenabled'));
|
|
|
|
//Get text, color, and size
|
|
const elementText = await element.getText();
|
|
const elementColor = await element.getCssValue('color');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//Validate 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 {
|
|
const message = `Expected: DIV - sub-text "*Not enabled in Profile. If you would like access to any of these standards sets, please Contact Us."; Actual: "${elementText}"`;
|
|
errors.push(message);
|
|
}
|
|
|
|
//Validate color -gray
|
|
if (elementColor === 'rgba(119, 119, 119, 1)') {
|
|
console.log('Passed: DIV - More Info Arizona sub-text color matched as expected');
|
|
} else {
|
|
const message = `Expected: DIV - More Info Arizona sub-text text color "rgba(119, 119, 119, 1)"'; Actual: "${elementColor}"`;
|
|
errors.push(message);
|
|
}
|
|
|
|
//Validate font size
|
|
if (elementSize === '11.7px') {
|
|
console.log('Passed: DIV - More Info Arizona sub-text text font-size matched as expected');
|
|
} else {
|
|
const message = `Expected: DIV - More Info Arizona sub-text text font-size "11.7px"; Actual: "${elementSize}"`;
|
|
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('Multiple validation checks did not pass');
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//DIV - More Info Arizona Contact Us link text, and font size
|
|
{
|
|
description: 'Validate DIV - More Info Arizona Contact Us link text, color, and size',
|
|
action: async () => {
|
|
const element = await driver.findElement(By.linkText('Contact Us'));
|
|
|
|
//Get text, color, and size
|
|
const elementText = await element.getText();
|
|
const elementColor = await element.getCssValue('color');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//Validate text
|
|
if (elementText === 'Contact Us') {
|
|
console.log('Passed: DIV - More Info Arizona sub-text matched as expected');
|
|
} else {
|
|
const message = `Expected: DIV - More Info Arizona sub-text "Contact Us"; Actual: "${elementText}"`;
|
|
errors.push(message);
|
|
}
|
|
|
|
//Validate color -light green
|
|
if (elementColor === 'rgba(48, 200, 172, 1)') {
|
|
console.log('Passed: DIV - More Info Arizona Contact Us link text color matched as expected');
|
|
} else {
|
|
const message = `Expected: DIV - More Info Arizona Contact Us link text color "rgba(48, 200, 172, 1)"'; Actual: "${elementColor}"`;
|
|
errors.push(message);
|
|
}
|
|
|
|
//Validate font size
|
|
if (elementSize === '11.7px') {
|
|
console.log('Passed: DIV - More Info Arizona Contact Us link text font-size matched as expected');
|
|
} else {
|
|
const message = `Expected: DIV - More Info Arizona Contact Us link text font-size "11.7px"; Actual: "${elementSize}"`;
|
|
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('Multiple validation checks did not pass');
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//DIV - More Info Arizona Subject column title text, and font size
|
|
{
|
|
description: 'Validate DIV - More Info Arizona Subject column title text, color, and size',
|
|
action: async () => {
|
|
const element = await driver.findElement(By.css('#myModal > div > div > div.modal-body > table > thead > tr > th:nth-child(1)'));
|
|
|
|
//Get text, color, and size
|
|
const elementText = await element.getText();
|
|
const elementColor = await element.getCssValue('color');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//Validate text
|
|
if (elementText === 'Subject') {
|
|
console.log('Passed: DIV - More Info Arizona Subject column title text matched as expected');
|
|
} else {
|
|
const message = `Expected: DIV - Arizona column title "Subject"; Actual: "${elementText}"`;
|
|
errors.push(message);
|
|
}
|
|
|
|
//Validate color -gray
|
|
if (elementColor === 'rgba(94, 105, 116, 1)') {
|
|
console.log('Passed: DIV - More Info Arizona Subject column title text color matched as expected');
|
|
} else {
|
|
const message = `Expected: DIV - More Info Arizona Subject column title text color "rgba(94, 105, 116, 1)"'; Actual: "${elementColor}"`;
|
|
errors.push(message);
|
|
}
|
|
|
|
//Validate font size
|
|
if (elementSize === '14px') {
|
|
console.log('Passed: DIV - More Info Arizona Subject column title text font-size matched as expected');
|
|
} else {
|
|
const message = `Expected: DIV - More Info Arizona Subject column title text font-size "14px"; Actual: "${elementSize}"`;
|
|
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('Multiple validation checks did not pass');
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//DIV - More Info Arizona Adopted column title text, and font size
|
|
{
|
|
description: 'Validate DIV - More Info Arizona Adopted column title text, color, and size',
|
|
action: async () => {
|
|
const element = await driver.findElement(By.css('#myModal > div > div > div.modal-body > table > thead > tr > th:nth-child(2)'));
|
|
|
|
//Get text, color, and size
|
|
const elementText = await element.getText();
|
|
const elementColor = await element.getCssValue('color');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//Validate text
|
|
if (elementText === 'Adopted') {
|
|
console.log('Passed: DIV - More Info Arizona Adopted column title text matched as expected');
|
|
} else {
|
|
const message = `Expected: DIV - Arizona column title "Adopted"; Actual: "${elementText}"`;
|
|
errors.push(message);
|
|
}
|
|
|
|
//Validate color -gray
|
|
if (elementColor === 'rgba(94, 105, 116, 1)') {
|
|
console.log('Passed: DIV - More Info Arizona Adopted column title text color matched as expected');
|
|
} else {
|
|
const message = `Expected: DIV - More Info Arizona Adopted column title text color "rgba(94, 105, 116, 1)"'; Actual: "${elementColor}"`;
|
|
errors.push(message);
|
|
}
|
|
|
|
//Validate font size
|
|
if (elementSize === '14px') {
|
|
console.log('Passed: DIV - More Info Arizona Adopted column title text font-size matched as expected');
|
|
} else {
|
|
const message = `Expected: DIV - More Info Arizona Adopted column title text font-size "14px"; Actual: "${elementSize}"`;
|
|
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('Multiple validation checks did not pass');
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//DIV - More Info Arizona Grades column title text, and font size
|
|
{
|
|
description: 'Validate DIV - More Info Arizona Grades column title text, color, and size',
|
|
action: async () => {
|
|
const element = await driver.findElement(By.css('#myModal > div > div > div.modal-body > table > thead > tr > th:nth-child(3)'));
|
|
|
|
//Get text, color, and size
|
|
const elementText = await element.getText();
|
|
const elementColor = await element.getCssValue('color');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//Validate text
|
|
if (elementText === 'Grades') {
|
|
console.log('Passed: DIV - More Info Arizona Grades column title text matched as expected');
|
|
} else {
|
|
const message = `Expected: DIV - Arizona column title "Grades"; Actual: "${elementText}"`;
|
|
errors.push(message);
|
|
}
|
|
|
|
//Validate color -navy blue
|
|
if (elementColor === 'rgba(94, 105, 116, 1)') {
|
|
console.log('Passed: DIV - More Info Arizona Grades column title text color matched as expected');
|
|
} else {
|
|
const message = `Expected: DIV - More Info Arizona Grades column title text color "rgba(94, 105, 116, 1)"'; Actual: "${elementColor}"`;
|
|
errors.push(message);
|
|
}
|
|
|
|
//Validate font size
|
|
if (elementSize === '14px') {
|
|
console.log('Passed: DIV - More Info Arizona Grades column title text font-size matched as expected');
|
|
} else {
|
|
const message = `Expected: DIV - More Info Arizona Grades column title text font-size "14px"; Actual: "${elementSize}"`;
|
|
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('Multiple validation checks did not pass');
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//DIV - More Info Arizona Row 1 label text, color, and font size
|
|
{
|
|
description: 'Validate DIV - More Info Arizona Row 1 label text, color, and font size',
|
|
action: async () => {
|
|
|
|
const checks = [
|
|
//Subject
|
|
{
|
|
selector: '.text-success:nth-child(1) > td:nth-child(1)',
|
|
label: 'Language Arts',
|
|
expected: {
|
|
text: 'Language Arts',
|
|
color: 'rgba(40, 167, 69, 1)',
|
|
size: '14.3px'
|
|
}
|
|
},
|
|
//Adopted
|
|
{
|
|
selector: '.text-success:nth-child(1) > td:nth-child(2)',
|
|
label: '2010, Reading 2003 / Writing 2004',
|
|
expected: {
|
|
text: '2010, Reading 2003 / Writing 2004',
|
|
color: 'rgba(40, 167, 69, 1)',
|
|
size: '14.3px'
|
|
}
|
|
},
|
|
//Grades
|
|
//Pre K* (special color)
|
|
{
|
|
selector: '.text-success:nth-child(1) .notenabled',
|
|
label: 'Pre K*',
|
|
expected: {
|
|
text: 'Pre K*',
|
|
color: 'rgba(119, 119, 119, 1)',
|
|
size: '12.87px'
|
|
}
|
|
},
|
|
//All Grades list
|
|
{
|
|
selector: '.text-success:nth-child(1) > td:nth-child(3)',
|
|
label: 'Grades List',
|
|
expected: {
|
|
text: 'Pre K*, K, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12',
|
|
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 actualColor = await element.getCssValue('color');
|
|
const actualSize = await element.getCssValue('font-size');
|
|
|
|
const errors = [];
|
|
|
|
//Text
|
|
if (actualText === expected.text) {
|
|
console.log(`Passed: DIV - More Info Arizona Row 1 ${label} label text matched as expected`);
|
|
} else {
|
|
errors.push(`Expected: DIV - More Info Arizona Row 1 "${expected.text}"; Actual: "${actualText}"`);
|
|
}
|
|
|
|
//Color
|
|
if (actualColor === expected.color) {
|
|
console.log(`Passed: DIV - More Info Arizona Row 1 ${label} label text color matched as expected`);
|
|
} else {
|
|
errors.push(`Expected: DIV - More Info Arizona Row 1 ${label} label text color "${expected.color}"; Actual: "${actualColor}"`);
|
|
}
|
|
|
|
//Font-size
|
|
if (actualSize === expected.size) {
|
|
console.log(`Passed: DIV - More Info Arizona Row 1 ${label} label text font-size matched as expected`);
|
|
} else {
|
|
errors.push(`Expected: DIV - More Info Arizona Row 1 ${label} label text font-size "${expected.size}"; Actual: "${actualSize}"`);
|
|
}
|
|
|
|
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('Multiple validation checks did not pass');
|
|
throw new Error(allErrors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//DIV - More Info Arizona Row 2 label text, color, and font size
|
|
{
|
|
description: 'Validate DIV - More Info Arizona Row 2 label text, color, and font size',
|
|
action: async () => {
|
|
|
|
const checks = [
|
|
//Subject
|
|
{
|
|
selector: '.text-success:nth-child(2) > td:nth-child(1)',
|
|
label: 'Mathematics',
|
|
expected: {
|
|
text: 'Mathematics',
|
|
color: 'rgba(40, 167, 69, 1)',
|
|
size: '14.3px'
|
|
}
|
|
},
|
|
//Adopted
|
|
{
|
|
selector: '.text-success:nth-child(2) > td:nth-child(2)',
|
|
label: '2008, 2010',
|
|
expected: {
|
|
text: '2008, 2010',
|
|
color: 'rgba(40, 167, 69, 1)',
|
|
size: '14.3px'
|
|
}
|
|
},
|
|
//Grades
|
|
//Pre K* (special color)
|
|
{
|
|
selector: '.text-success:nth-child(2) .notenabled',
|
|
label: 'Pre K*',
|
|
expected: {
|
|
text: 'Pre K*',
|
|
color: 'rgba(119, 119, 119, 1)',
|
|
size: '12.87px'
|
|
}
|
|
},
|
|
//All Grades list
|
|
{
|
|
selector: '.text-success:nth-child(2) > td:nth-child(3)',
|
|
label: 'Grades List',
|
|
expected: {
|
|
text: 'Pre K*, K, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12',
|
|
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 actualColor = await element.getCssValue('color');
|
|
const actualSize = await element.getCssValue('font-size');
|
|
|
|
const errors = [];
|
|
|
|
//Text
|
|
if (actualText === expected.text) {
|
|
console.log(`Passed: DIV - More Info Arizona Row 2 ${label} label text matched as expected`);
|
|
} else {
|
|
errors.push(`Expected: DIV - More Info Arizona Row 2 "${expected.text}"; Actual: "${actualText}"`);
|
|
}
|
|
|
|
//Color
|
|
if (actualColor === expected.color) {
|
|
console.log(`Passed: DIV - More Info Arizona Row 2 ${label} label text color matched as expected`);
|
|
} else {
|
|
errors.push(`Expected: DIV - More Info Arizona Row 2 ${label} label text color "${expected.color}"; Actual: "${actualColor}"`);
|
|
}
|
|
|
|
//Font-size
|
|
if (actualSize === expected.size) {
|
|
console.log(`Passed: DIV - More Info Arizona Row 2 ${label} label text font-size matched as expected`);
|
|
} else {
|
|
errors.push(`Expected: DIV - More Info Arizona Row 2 ${label} label text font-size "${expected.size}"; Actual: "${actualSize}"`);
|
|
}
|
|
|
|
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('Multiple validation checks did not pass');
|
|
throw new Error(allErrors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//DIV - More Info Arizona Row 3 label text, color, and font size
|
|
{
|
|
description: 'Validate DIV - More Info Arizona Row 3 label text, color, and font size',
|
|
action: async () => {
|
|
|
|
const checks = [
|
|
//Subject
|
|
{
|
|
selector: '.text-success:nth-child(3) > td:nth-child(1)',
|
|
label: 'Science',
|
|
expected: {
|
|
text: 'Science',
|
|
color: 'rgba(40, 167, 69, 1)',
|
|
size: '14.3px'
|
|
}
|
|
},
|
|
//Adopted
|
|
{
|
|
selector: '.text-success:nth-child(3) > td:nth-child(2)',
|
|
label: '2004 / Updated 2005',
|
|
expected: {
|
|
text: '2004 / Updated 2005',
|
|
color: 'rgba(40, 167, 69, 1)',
|
|
size: '14.3px'
|
|
}
|
|
},
|
|
//Grades
|
|
//Pre K* (special color)
|
|
{
|
|
selector: '.text-success:nth-child(3) .notenabled',
|
|
label: 'Pre K*',
|
|
expected: {
|
|
text: 'Pre K*',
|
|
color: 'rgba(119, 119, 119, 1)',
|
|
size: '12.87px'
|
|
}
|
|
},
|
|
//All Grades list
|
|
{
|
|
selector: '.text-success:nth-child(3) > td:nth-child(3)',
|
|
label: 'Grades List',
|
|
expected: {
|
|
text: 'Pre K*, K, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12',
|
|
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 actualColor = await element.getCssValue('color');
|
|
const actualSize = await element.getCssValue('font-size');
|
|
|
|
const errors = [];
|
|
|
|
//Text
|
|
if (actualText === expected.text) {
|
|
console.log(`Passed: DIV - More Info Arizona Row 3 ${label} label text matched as expected`);
|
|
} else {
|
|
errors.push(`Expected: DIV - More Info Arizona Row 3 "${expected.text}"; Actual: "${actualText}"`);
|
|
}
|
|
|
|
//Color
|
|
if (actualColor === expected.color) {
|
|
console.log(`Passed: DIV - More Info Arizona Row 3 ${label} label text color matched as expected`);
|
|
} else {
|
|
errors.push(`Expected: DIV - More Info Arizona Row 3 ${label} label text color "${expected.color}"; Actual: "${actualColor}"`);
|
|
}
|
|
|
|
//Font-size
|
|
if (actualSize === expected.size) {
|
|
console.log(`Passed: DIV - More Info Arizona Row 3 ${label} label text font-size matched as expected`);
|
|
} else {
|
|
errors.push(`Expected: DIV - More Info Arizona Row 3 ${label} label text font-size "${expected.size}"; Actual: "${actualSize}"`);
|
|
}
|
|
|
|
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('Multiple validation checks did not pass');
|
|
throw new Error(allErrors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//DIV - More Info Arizona Row 4 label text, color, and font size
|
|
{
|
|
description: 'Validate DIV - More Info Arizona Row 4 label text, color, and font size',
|
|
action: async () => {
|
|
|
|
const checks = [
|
|
//Subject
|
|
{
|
|
selector: '.text-success:nth-child(4) > td:nth-child(1)',
|
|
label: 'Social Studies',
|
|
expected: {
|
|
text: 'Social Studies',
|
|
color: 'rgba(40, 167, 69, 1)',
|
|
size: '14.3px'
|
|
}
|
|
},
|
|
//Adopted
|
|
{
|
|
selector: '.text-success:nth-child(4) > td:nth-child(2)',
|
|
label: '2005 / Updated 2006',
|
|
expected: {
|
|
text: '2005 / Updated 2006',
|
|
color: 'rgba(40, 167, 69, 1)',
|
|
size: '14.3px'
|
|
}
|
|
},
|
|
//Grades
|
|
//Pre K* (special color)
|
|
{
|
|
selector: '.text-success:nth-child(4) .notenabled',
|
|
label: 'Pre K*',
|
|
expected: {
|
|
text: 'Pre K*',
|
|
color: 'rgba(119, 119, 119, 1)',
|
|
size: '12.87px'
|
|
}
|
|
},
|
|
//All Grades list
|
|
{
|
|
selector: '.text-success:nth-child(4) > td:nth-child(3)',
|
|
label: 'Grades List',
|
|
expected: {
|
|
text: 'Pre K*, K, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12',
|
|
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 actualColor = await element.getCssValue('color');
|
|
const actualSize = await element.getCssValue('font-size');
|
|
|
|
const errors = [];
|
|
|
|
//Text
|
|
if (actualText === expected.text) {
|
|
console.log(`Passed: DIV - More Info Arizona Row 4 ${label} label text matched as expected`);
|
|
} else {
|
|
errors.push(`Expected: DIV - More Info Arizona Row 4 "${expected.text}"; Actual: "${actualText}"`);
|
|
}
|
|
|
|
//Color
|
|
if (actualColor === expected.color) {
|
|
console.log(`Passed: DIV - More Info Arizona Row 4 ${label} label text color matched as expected`);
|
|
} else {
|
|
errors.push(`Expected: DIV - More Info Arizona Row 4 ${label} label text color "${expected.color}"; Actual: "${actualColor}"`);
|
|
}
|
|
|
|
//Font-size
|
|
if (actualSize === expected.size) {
|
|
console.log(`Passed: DIV - More Info Arizona Row 4 ${label} label text font-size matched as expected`);
|
|
} else {
|
|
errors.push(`Expected: DIV - More Info Arizona Row 4 ${label} label text font-size "${expected.size}"; Actual: "${actualSize}"`);
|
|
}
|
|
|
|
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('Multiple validation checks did not pass');
|
|
throw new Error(allErrors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//DIV - More Info Arizona Row 5 label text, color, and font size
|
|
{
|
|
description: 'Validate DIV - More Info Arizona Row 5 label text, color, and font size',
|
|
action: async () => {
|
|
|
|
const checks = [
|
|
//Subject
|
|
{
|
|
selector: '.text-success:nth-child(5) > td:nth-child(1)',
|
|
label: 'World Languages',
|
|
expected: {
|
|
text: 'World Languages',
|
|
color: 'rgba(40, 167, 69, 1)',
|
|
size: '14.3px'
|
|
}
|
|
},
|
|
//Adopted
|
|
{
|
|
selector: '.text-success:nth-child(5) > td:nth-child(2)',
|
|
label: '1997',
|
|
expected: {
|
|
text: '1997',
|
|
color: 'rgba(40, 167, 69, 1)',
|
|
size: '14.3px'
|
|
}
|
|
},
|
|
//Grades
|
|
//Pre K* (special color)
|
|
{
|
|
selector: '.text-success:nth-child(5) .notenabled',
|
|
label: 'Pre K*',
|
|
expected: {
|
|
text: 'Pre K*',
|
|
color: 'rgba(119, 119, 119, 1)',
|
|
size: '12.87px'
|
|
}
|
|
},
|
|
//All Grades list
|
|
{
|
|
selector: '.text-success:nth-child(5) > td:nth-child(3)',
|
|
label: 'Grades List',
|
|
expected: {
|
|
text: 'Pre K*, K, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12',
|
|
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 actualColor = await element.getCssValue('color');
|
|
const actualSize = await element.getCssValue('font-size');
|
|
|
|
const errors = [];
|
|
|
|
//Text
|
|
if (actualText === expected.text) {
|
|
console.log(`Passed: DIV - More Info Arizona Row 5 ${label} label text matched as expected`);
|
|
} else {
|
|
errors.push(`Expected: DIV - More Info Arizona Row 5 "${expected.text}"; Actual: "${actualText}"`);
|
|
}
|
|
|
|
//Color
|
|
if (actualColor === expected.color) {
|
|
console.log(`Passed: DIV - More Info Arizona Row 5 ${label} label text color matched as expected`);
|
|
} else {
|
|
errors.push(`Expected: DIV - More Info Arizona Row 5 ${label} label text color "${expected.color}"; Actual: "${actualColor}"`);
|
|
}
|
|
|
|
//Font-size
|
|
if (actualSize === expected.size) {
|
|
console.log(`Passed: DIV - More Info Arizona Row 5 ${label} label text font-size matched as expected`);
|
|
} else {
|
|
errors.push(`Expected: DIV - More Info Arizona Row 5 ${label} label text font-size "${expected.size}"; Actual: "${actualSize}"`);
|
|
}
|
|
|
|
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('Multiple validation checks did not pass');
|
|
throw new Error(allErrors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//DIV - More Info Arizona Row 6 label text, color, and font size
|
|
{
|
|
description: 'Validate DIV - More Info Arizona Row 6 label text, color, and font size',
|
|
action: async () => {
|
|
|
|
const checks = [
|
|
//Subject
|
|
{
|
|
selector: '.notenabled:nth-child(6) > td:nth-child(1)',
|
|
label: 'Arts Education*',
|
|
expected: {
|
|
text: 'Arts Education*',
|
|
color: 'rgba(119, 119, 119, 1)',
|
|
size: '12.87px'
|
|
}
|
|
},
|
|
//Adopted
|
|
{
|
|
selector: '.notenabled:nth-child(6) > td:nth-child(2)',
|
|
label: '2006',
|
|
expected: {
|
|
text: '2006',
|
|
color: 'rgba(119, 119, 119, 1)',
|
|
size: '12.87px'
|
|
}
|
|
},
|
|
//Grades
|
|
//Pre K*
|
|
{
|
|
selector: '.notenabled:nth-child(6) .notenabled',
|
|
label: 'Pre K*',
|
|
expected: {
|
|
text: 'Pre K*',
|
|
color: 'rgba(119, 119, 119, 1)',
|
|
size: '11.583px'
|
|
}
|
|
},
|
|
//All Grades list
|
|
{
|
|
selector: '.notenabled:nth-child(6) > td:nth-child(3)',
|
|
label: 'Grades List',
|
|
expected: {
|
|
text: 'Pre K*, K, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12',
|
|
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 actualColor = await element.getCssValue('color');
|
|
const actualSize = await element.getCssValue('font-size');
|
|
|
|
const errors = [];
|
|
|
|
//Text
|
|
if (actualText === expected.text) {
|
|
console.log(`Passed: DIV - More Info Arizona Row 6 ${label} label text matched as expected`);
|
|
} else {
|
|
errors.push(`Expected: DIV - More Info Arizona Row 6 "${expected.text}"; Actual: "${actualText}"`);
|
|
}
|
|
|
|
//Color
|
|
if (actualColor === expected.color) {
|
|
console.log(`Passed: DIV - More Info Arizona Row 6 ${label} label text color matched as expected`);
|
|
} else {
|
|
errors.push(`Expected: DIV - More Info Arizona Row 6 ${label} label text color "${expected.color}"; Actual: "${actualColor}"`);
|
|
}
|
|
|
|
//Font-size
|
|
if (actualSize === expected.size) {
|
|
console.log(`Passed: DIV - More Info Arizona Row 6 ${label} label text font-size matched as expected`);
|
|
} else {
|
|
errors.push(`Expected: DIV - More Info Arizona Row 6 ${label} label text font-size "${expected.size}"; Actual: "${actualSize}"`);
|
|
}
|
|
|
|
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('Multiple validation checks did not pass');
|
|
throw new Error(allErrors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//DIV - More Info Arizona Row 7 label text, color, and font size
|
|
{
|
|
description: 'Validate DIV - More Info Arizona Row 7 label text, color, and font size',
|
|
action: async () => {
|
|
|
|
const checks = [
|
|
//Subject
|
|
{
|
|
selector: '.notenabled:nth-child(7) > td:nth-child(1)',
|
|
label: 'Early Childhood Education*',
|
|
expected: {
|
|
text: 'Early Childhood Education*',
|
|
color: 'rgba(119, 119, 119, 1)',
|
|
size: '12.87px'
|
|
}
|
|
},
|
|
//Adopted
|
|
{
|
|
selector: '.notenabled:nth-child(7) > td:nth-child(2)',
|
|
label: '2005',
|
|
expected: {
|
|
text: '2005',
|
|
color: 'rgba(119, 119, 119, 1)',
|
|
size: '12.87px'
|
|
}
|
|
},
|
|
//Grades
|
|
{
|
|
selector: '.notenabled:nth-child(7) .notenabled',
|
|
label: 'Ages 3-5*',
|
|
expected: {
|
|
text: 'Ages 3-5*',
|
|
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 actualColor = await element.getCssValue('color');
|
|
const actualSize = await element.getCssValue('font-size');
|
|
|
|
const errors = [];
|
|
|
|
//Text
|
|
if (actualText === expected.text) {
|
|
console.log(`Passed: DIV - More Info Arizona Row 7 ${label} label text matched as expected`);
|
|
} else {
|
|
errors.push(`Expected: DIV - More Info Arizona Row 7 "${expected.text}"; Actual: "${actualText}"`);
|
|
}
|
|
|
|
//Color
|
|
if (actualColor === expected.color) {
|
|
console.log(`Passed: DIV - More Info Arizona Row 7 ${label} label text color matched as expected`);
|
|
} else {
|
|
errors.push(`Expected: DIV - More Info Arizona Row 7 ${label} label text color "${expected.color}"; Actual: "${actualColor}"`);
|
|
}
|
|
|
|
//Font-size
|
|
if (actualSize === expected.size) {
|
|
console.log(`Passed: DIV - More Info Arizona Row 7 ${label} label text font-size matched as expected`);
|
|
} else {
|
|
errors.push(`Expected: DIV - More Info Arizona Row 7 ${label} label text font-size "${expected.size}"; Actual: "${actualSize}"`);
|
|
}
|
|
|
|
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('Multiple validation checks did not pass');
|
|
throw new Error(allErrors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//DIV - More Info Arizona Row 8 label text, color, and font size
|
|
{
|
|
description: 'Validate DIV - More Info Arizona Row 8 label text, color, and font size',
|
|
action: async () => {
|
|
|
|
const checks = [
|
|
//Subject
|
|
{
|
|
selector: '.notenabled:nth-child(8) > td:nth-child(1)',
|
|
label: 'English Language Learners*',
|
|
expected: {
|
|
text: 'English Language Learners*',
|
|
color: 'rgba(119, 119, 119, 1)',
|
|
size: '12.87px'
|
|
}
|
|
},
|
|
//Adopted
|
|
{
|
|
selector: '.notenabled:nth-child(8) > td:nth-child(2)',
|
|
label: '2004',
|
|
expected: {
|
|
text: '2004',
|
|
color: 'rgba(119, 119, 119, 1)',
|
|
size: '12.87px'
|
|
}
|
|
},
|
|
//Grades
|
|
//Pre K*
|
|
{
|
|
selector: '.notenabled:nth-child(8) .notenabled',
|
|
label: 'Pre K*',
|
|
expected: {
|
|
text: 'Pre K*',
|
|
color: 'rgba(119, 119, 119, 1)',
|
|
size: '11.583px'
|
|
}
|
|
},
|
|
//All Grades list
|
|
{
|
|
selector: '.notenabled:nth-child(8) > td:nth-child(3)',
|
|
label: 'Grades List',
|
|
expected: {
|
|
text: 'Pre K*, K, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12',
|
|
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 actualColor = await element.getCssValue('color');
|
|
const actualSize = await element.getCssValue('font-size');
|
|
|
|
const errors = [];
|
|
|
|
//Text
|
|
if (actualText === expected.text) {
|
|
console.log(`Passed: DIV - More Info Arizona Row 8 ${label} label text matched as expected`);
|
|
} else {
|
|
errors.push(`Expected: DIV - More Info Arizona Row 8 "${expected.text}"; Actual: "${actualText}"`);
|
|
}
|
|
|
|
//Color
|
|
if (actualColor === expected.color) {
|
|
console.log(`Passed: DIV - More Info Arizona Row 8 ${label} label text color matched as expected`);
|
|
} else {
|
|
errors.push(`Expected: DIV - More Info Arizona Row 8 ${label} label text color "${expected.color}"; Actual: "${actualColor}"`);
|
|
}
|
|
|
|
//Font-size
|
|
if (actualSize === expected.size) {
|
|
console.log(`Passed: DIV - More Info Arizona Row 8 ${label} label text font-size matched as expected`);
|
|
} else {
|
|
errors.push(`Expected: DIV - More Info Arizona Row 8 ${label} label text font-size "${expected.size}"; Actual: "${actualSize}"`);
|
|
}
|
|
|
|
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('Multiple validation checks did not pass');
|
|
throw new Error(allErrors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//DIV - More Info Arizona Row 9 label text, color, and font size
|
|
{
|
|
description: 'Validate DIV - More Info Arizona Row 9 label text, color, and font size',
|
|
action: async () => {
|
|
|
|
const checks = [
|
|
//Subject
|
|
{
|
|
selector: '.notenabled:nth-child(9) > td:nth-child(1)',
|
|
label: 'Health and PE*',
|
|
expected: {
|
|
text: 'Health and PE*',
|
|
color: 'rgba(119, 119, 119, 1)',
|
|
size: '12.87px'
|
|
}
|
|
},
|
|
//Adopted
|
|
{
|
|
selector: '.notenabled:nth-child(9) > td:nth-child(2)',
|
|
label: '2009',
|
|
expected: {
|
|
text: '2009',
|
|
color: 'rgba(119, 119, 119, 1)',
|
|
size: '12.87px'
|
|
}
|
|
},
|
|
//Grades
|
|
//Pre K*
|
|
{
|
|
selector: '.notenabled:nth-child(9) .notenabled',
|
|
label: 'Pre K*',
|
|
expected: {
|
|
text: 'Pre K*',
|
|
color: 'rgba(119, 119, 119, 1)',
|
|
size: '11.583px'
|
|
}
|
|
},
|
|
//All Grades list
|
|
{
|
|
selector: '.notenabled:nth-child(9) > td:nth-child(3)',
|
|
label: 'Grades List',
|
|
expected: {
|
|
text: 'Pre K*, K, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12',
|
|
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 actualColor = await element.getCssValue('color');
|
|
const actualSize = await element.getCssValue('font-size');
|
|
|
|
const errors = [];
|
|
|
|
//Text
|
|
if (actualText === expected.text) {
|
|
console.log(`Passed: DIV - More Info Arizona Row 9 ${label} label text matched as expected`);
|
|
} else {
|
|
errors.push(`Expected: DIV - More Info Arizona Row 9 "${expected.text}"; Actual: "${actualText}"`);
|
|
}
|
|
|
|
//Color
|
|
if (actualColor === expected.color) {
|
|
console.log(`Passed: DIV - More Info Arizona Row 9 ${label} label text color matched as expected`);
|
|
} else {
|
|
errors.push(`Expected: DIV - More Info Arizona Row 9 ${label} label text color "${expected.color}"; Actual: "${actualColor}"`);
|
|
}
|
|
|
|
//Font-size
|
|
if (actualSize === expected.size) {
|
|
console.log(`Passed: DIV - More Info Arizona Row 9 ${label} label text font-size matched as expected`);
|
|
} else {
|
|
errors.push(`Expected: DIV - More Info Arizona Row 9 ${label} label text font-size "${expected.size}"; Actual: "${actualSize}"`);
|
|
}
|
|
|
|
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('Multiple validation checks did not pass');
|
|
throw new Error(allErrors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//DIV - More Info Arizona Row 10 label text, color, and font size
|
|
{
|
|
description: 'Validate DIV - More Info Arizona Row 10 label text, color, and font size',
|
|
action: async () => {
|
|
|
|
const checks = [
|
|
//Subject
|
|
{
|
|
selector: '.notenabled:nth-child(10) > td:nth-child(1)',
|
|
label: 'Library Media*',
|
|
expected: {
|
|
text: 'Library Media*',
|
|
color: 'rgba(119, 119, 119, 1)',
|
|
size: '12.87px'
|
|
}
|
|
},
|
|
//Grades
|
|
//Pre K*
|
|
{
|
|
selector: '.notenabled:nth-child(10) .notenabled',
|
|
label: 'Pre K*',
|
|
expected: {
|
|
text: 'Pre K*',
|
|
color: 'rgba(119, 119, 119, 1)',
|
|
size: '11.583px'
|
|
}
|
|
},
|
|
//All Grades list
|
|
{
|
|
selector: '.notenabled:nth-child(10) > td:nth-child(3)',
|
|
label: 'Grades List',
|
|
expected: {
|
|
text: 'Pre K*, K, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12',
|
|
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 actualColor = await element.getCssValue('color');
|
|
const actualSize = await element.getCssValue('font-size');
|
|
|
|
const errors = [];
|
|
|
|
//Text
|
|
if (actualText === expected.text) {
|
|
console.log(`Passed: DIV - More Info Arizona Row 10 ${label} label text matched as expected`);
|
|
} else {
|
|
errors.push(`Expected: DIV - More Info Arizona Row 10 "${expected.text}"; Actual: "${actualText}"`);
|
|
}
|
|
|
|
//Color
|
|
if (actualColor === expected.color) {
|
|
console.log(`Passed: DIV - More Info Arizona Row 10 ${label} label text color matched as expected`);
|
|
} else {
|
|
errors.push(`Expected: DIV - More Info Arizona Row 10 ${label} label text color "${expected.color}"; Actual: "${actualColor}"`);
|
|
}
|
|
|
|
//Font-size
|
|
if (actualSize === expected.size) {
|
|
console.log(`Passed: DIV - More Info Arizona Row 10 ${label} label text font-size matched as expected`);
|
|
} else {
|
|
errors.push(`Expected: DIV - More Info Arizona Row 10 ${label} label text font-size "${expected.size}"; Actual: "${actualSize}"`);
|
|
}
|
|
|
|
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('Multiple validation checks did not pass');
|
|
throw new Error(allErrors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//DIV - More Info Arizona Row 11 label text, color, and font size
|
|
{
|
|
description: 'Validate DIV - More Info Arizona Row 11 label text, color, and font size',
|
|
action: async () => {
|
|
|
|
const checks = [
|
|
//Subject
|
|
{
|
|
selector: '.notenabled:nth-child(11) > td:nth-child(1)',
|
|
label: 'Technology Education*',
|
|
expected: {
|
|
text: 'Technology Education*',
|
|
color: 'rgba(119, 119, 119, 1)',
|
|
size: '12.87px'
|
|
}
|
|
},
|
|
//Adopted
|
|
{
|
|
selector: '.notenabled:nth-child(11) > td:nth-child(2)',
|
|
label: '2009',
|
|
expected: {
|
|
text: '2009',
|
|
color: 'rgba(119, 119, 119, 1)',
|
|
size: '12.87px'
|
|
}
|
|
},
|
|
//Grades
|
|
//Pre K*
|
|
{
|
|
selector: '.notenabled:nth-child(11) .notenabled',
|
|
label: 'Pre K*',
|
|
expected: {
|
|
text: 'Pre K*',
|
|
color: 'rgba(119, 119, 119, 1)',
|
|
size: '11.583px'
|
|
}
|
|
},
|
|
//All Grades list
|
|
{
|
|
selector: '.notenabled:nth-child(11) > td:nth-child(3)',
|
|
label: 'Grades List',
|
|
expected: {
|
|
text: 'Pre K*, K, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12',
|
|
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 actualColor = await element.getCssValue('color');
|
|
const actualSize = await element.getCssValue('font-size');
|
|
|
|
const errors = [];
|
|
|
|
//Text
|
|
if (actualText === expected.text) {
|
|
console.log(`Passed: DIV - More Info Arizona Row 11 ${label} label text matched as expected`);
|
|
} else {
|
|
errors.push(`Expected: DIV - More Info Arizona Row 11 "${expected.text}"; Actual: "${actualText}"`);
|
|
}
|
|
|
|
//Color
|
|
if (actualColor === expected.color) {
|
|
console.log(`Passed: DIV - More Info Arizona Row 11 ${label} label text color matched as expected`);
|
|
} else {
|
|
errors.push(`Expected: DIV - More Info Arizona Row 11 ${label} label text color "${expected.color}"; Actual: "${actualColor}"`);
|
|
}
|
|
|
|
//Font-size
|
|
if (actualSize === expected.size) {
|
|
console.log(`Passed: DIV - More Info Arizona Row 11 ${label} label text font-size matched as expected`);
|
|
} else {
|
|
errors.push(`Expected: DIV - More Info Arizona Row 11 ${label} label text font-size "${expected.size}"; Actual: "${actualSize}"`);
|
|
}
|
|
|
|
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('Multiple validation checks did not pass');
|
|
throw new Error(allErrors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//NEXT ACTION - Click DIV X icon
|
|
{
|
|
description: 'DIV - Click DIV X icon',
|
|
action: async () => {
|
|
console.log('----->| NEXT ACTION: Clicked DIV X icon');
|
|
await driver.findElement(By.css('.modal-lg .modal-header span')).click();
|
|
await driver.sleep(2000);
|
|
}
|
|
},*/
|
|
|
|
//NEXT ACTION - Click View icon
|
|
{
|
|
description: 'DIV - Click California View icon',
|
|
action: async () => {
|
|
console.log('----->| NEXT ACTION: Clicked California View icon');
|
|
await driver.findElement(By.css('tr:nth-child(3) > .text-center:nth-child(5) img')).click();
|
|
await driver.sleep(2000);
|
|
}
|
|
},
|
|
|
|
//Wait until the element exists in the DOM
|
|
{
|
|
description: 'Wait for page to load',
|
|
action: async () => {
|
|
const pageTitle = await driver.wait(
|
|
until.elementLocated(By.css('h2')),
|
|
30000
|
|
);
|
|
|
|
//Wait until it becomes visible
|
|
await driver.wait(
|
|
until.elementIsVisible(pageTitle),
|
|
30000
|
|
);
|
|
|
|
//Wait for page to load completely
|
|
await driver.wait(async () => {
|
|
const readyState = await driver.executeScript('return document.readyState');
|
|
return readyState === 'complete';
|
|
}, 30000, 'Browse Page did not fully load within 30 seconds');
|
|
console.log('Passed: Browse Page loaded successfully');
|
|
}
|
|
},
|
|
|
|
//Browse - Page title, text, and font size
|
|
{
|
|
description: 'Validate Browse page title text, color, and size',
|
|
action: async () => {
|
|
const element = await driver.findElement(By.css('h2'));
|
|
|
|
//Get text, color, and size
|
|
const elementText = await element.getText();
|
|
const elementColor = await element.getCssValue('color');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//Validate text =
|
|
if (elementText === 'Browse') {
|
|
console.log("Passed: Browse page title matched as expected");
|
|
} else {
|
|
const message = `Expected: "Browse" page title; Actual: "${elementText}"`;
|
|
errors.push(message);
|
|
}
|
|
|
|
//Validate color -navy blue
|
|
if (elementColor === 'rgba(40, 39, 90, 1)') {
|
|
console.log('Passed: Browse Page title text color matched as expected');
|
|
} else {
|
|
const message = `Expected: Browse Page title text color "rgba(40, 39, 90, 1)"; Actual: "${elementColor}"`;
|
|
errors.push(message);
|
|
}
|
|
|
|
//Validate font size
|
|
if (elementSize === '32px') {
|
|
console.log('Passed: Browse Page title text font-size matched as expected');
|
|
} else {
|
|
const message = `Expected: Browse Page title text font-size "32px"; Actual: "${elementSize}"`;
|
|
errors.push(message);
|
|
}
|
|
|
|
//Throw once at the end (no additional console logs here)
|
|
if (errors.length > 0) {
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Browse - Content tab title, text, and font size (dimmed)
|
|
{
|
|
description: 'Validate Browse - Content tab title text, color, and size',
|
|
action: async () => {
|
|
const element = await driver.findElement(By.css('#content-tab'));
|
|
|
|
//Get text, color, and size
|
|
const elementText = await element.getText();
|
|
const elementColor = await element.getCssValue('background-color');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//Validate text =
|
|
if (elementText === 'Content') {
|
|
console.log("Passed: Browse page - Content tab title matched as expected");
|
|
} else {
|
|
const message = `Expected: "Content" tab title; Actual: "${elementText}"`;
|
|
errors.push(message);
|
|
}
|
|
|
|
//Validate color -clear
|
|
if (elementColor === 'rgba(0, 0, 0, 0)') {
|
|
console.log('Passed: Browse page - Content tab title text color matched as expected');
|
|
} else {
|
|
const message = `Expected: Browse page - Content tab title text color "rgba(0, 0, 0, 0)"; Actual: "${elementColor}"`;
|
|
errors.push(message);
|
|
}
|
|
|
|
//Validate font size
|
|
if (elementSize === '15px') {
|
|
console.log('Passed: Browse page - Content tab title text font-size matched as expected');
|
|
} else {
|
|
const message = `Expected: Browse page - Content tab title text font-size "15px"; Actual: "${elementSize}"`;
|
|
errors.push(message);
|
|
}
|
|
|
|
//Throw once at the end (no additional console logs here)
|
|
if (errors.length > 0) {
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Browse - Standards tab title, text, and font size (active)
|
|
{
|
|
description: 'Validate Browse - Standards tab title text, color, and size',
|
|
action: async () => {
|
|
const element = await driver.findElement(By.css('#std-tab'));
|
|
|
|
//Get text, color, and size
|
|
const elementText = await element.getText();
|
|
const elementColor = await element.getCssValue('background-color');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//Validate text =
|
|
if (elementText === 'Standards') {
|
|
console.log("Passed: Browse page - Standards tab title matched as expected");
|
|
} else {
|
|
const message = `Expected: "Standards" tab title; Actual: "${elementText}"`;
|
|
errors.push(message);
|
|
}
|
|
|
|
//Validate color -navy blue
|
|
if (elementColor === 'rgba(40, 39, 90, 1)') {
|
|
console.log('Passed: Browse page - Standards tab title text color matched as expected');
|
|
} else {
|
|
const message = `Expected: Browse page - Standards tab title text color "rgba(40, 39, 90, 1)"; Actual: "${elementColor}"`;
|
|
errors.push(message);
|
|
}
|
|
|
|
//Validate font size
|
|
if (elementSize === '15px') {
|
|
console.log('Passed: Browse page - Standards tab title text font-size matched as expected');
|
|
} else {
|
|
const message = `Expected: Browse page - Standards tab title text font-size "15px"; Actual: "${elementSize}"`;
|
|
errors.push(message);
|
|
}
|
|
|
|
//Throw once at the end (no additional console logs here)
|
|
if (errors.length > 0) {
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Browse - Concepts tab title, text, and font size (dimmed)
|
|
{
|
|
description: 'Validate Browse - Conceptss tab title text, color, and size',
|
|
action: async () => {
|
|
const element = await driver.findElement(By.css('#concept-tab'));
|
|
|
|
//Get text, color, and size
|
|
const elementText = await element.getText();
|
|
const elementColor = await element.getCssValue('background-color');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//Validate text =
|
|
if (elementText === 'Concepts') {
|
|
console.log("Passed: Browse page - Concepts tab title matched as expected");
|
|
} else {
|
|
const message = `Expected: "Concepts" tab title; Actual: "${elementText}"`;
|
|
errors.push(message);
|
|
}
|
|
|
|
//Validate color -clear
|
|
if (elementColor === 'rgba(0, 0, 0, 0)') {
|
|
console.log('Passed: Browse page - Concepts tab title text color matched as expected');
|
|
} else {
|
|
const message = `Expected: Browse page - Concepts tab title text color "rgba(0, 0, 0, 0)"; Actual: "${elementColor}"`;
|
|
errors.push(message);
|
|
}
|
|
|
|
//Validate font size
|
|
if (elementSize === '15px') {
|
|
console.log('Passed: Browse page - Concepts tab title text font-size matched as expected');
|
|
} else {
|
|
const message = `Expected: Browse page - Concepts tab title text font-size "15px"; Actual: "${elementSize}"`;
|
|
errors.push(message);
|
|
}
|
|
|
|
//Throw once at the end (no additional console logs here)
|
|
if (errors.length > 0) {
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Browse - Browse standards sub-title, text, and font size
|
|
{
|
|
description: 'Validate Browse - Browse standards sub-title text, color, and size',
|
|
action: async () => {
|
|
const element = await driver.findElement(By.css('#std p'));
|
|
|
|
//Get text, color, and size
|
|
const elementText = await element.getText();
|
|
const elementColor = await element.getCssValue('background-color');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//Validate text =
|
|
if (elementText === 'Browse standards') {
|
|
console.log("Passed: Browse page - Browse standards sub-title matched as expected");
|
|
} else {
|
|
const message = `Expected: "Browse standards" sub-title; Actual: "${elementText}"`;
|
|
errors.push(message);
|
|
}
|
|
|
|
//Validate color -navy blue
|
|
if (elementColor === 'rgba(0, 0, 0, 0)') {
|
|
console.log('Passed: Browse page - Browse standards sub-title text color matched as expected');
|
|
} else {
|
|
const message = `Expected: Browse page - Browse standards sub-title text color "rgba(0, 0, 0, 0)"; Actual: "${elementColor}"`;
|
|
errors.push(message);
|
|
}
|
|
|
|
//Validate font size
|
|
if (elementSize === '13px') {
|
|
console.log('Passed: Browse page - Browse standards sub-title text font-size matched as expected');
|
|
} else {
|
|
const message = `Expected: Browse page - Browse standards sub-title text font-size "13px"; Actual: "${elementSize}"`;
|
|
errors.push(message);
|
|
}
|
|
|
|
//Throw once at the end (no additional console logs here)
|
|
if (errors.length > 0) {
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Standards label text
|
|
{
|
|
description: 'Validate Standards label text',
|
|
action: async () => {
|
|
const elementText = await driver.findElement(By.css('.form-group:nth-child(4) > .col-sm-2')).getText();
|
|
if (elementText === 'Standards') {
|
|
console.log('Passed: Standards label text matched as expected');
|
|
} else {
|
|
throw new Error(`Expected: "Standards" label text; Actual: "${elementText}"`);
|
|
}
|
|
}
|
|
},
|
|
|
|
//Standards dropdown
|
|
{
|
|
description: 'Validate Standards dropdown list and value',
|
|
action: async () => {
|
|
const select = await driver.findElement(By.css('#stdselect'));
|
|
|
|
// Get the selected option text
|
|
const selectedOption = await select.findElement(By.css('option:checked'));
|
|
const selectedText = await selectedOption.getText();
|
|
|
|
if (selectedText === 'California Standards') {
|
|
console.log('Passed: California Standards default value matched as expected');
|
|
} else {
|
|
throw new Error(`Expected "California Standards"; Actual: "${selectedText}"`);
|
|
}
|
|
|
|
const options = await select.findElements(By.css('option'));
|
|
const expectedList = [
|
|
'Select standards',
|
|
'Alabama Standards',
|
|
'Arizona Standards',
|
|
'California Standards',
|
|
'Florida Standards',
|
|
'New York Standards',
|
|
'North Carolina Standards',
|
|
'South Carolina Standards',
|
|
'Texas TEKS Standards',
|
|
'Washington Standards',
|
|
'Common Core State Standards',
|
|
'Alberta Standards',
|
|
'Ontario Standards',
|
|
'Australian Curriculum (ACARA) Standards',
|
|
'5th Grade Import ECS-2732',
|
|
'Stats Test Framework',
|
|
'Widget Test',
|
|
'Still Testing ECS-273',
|
|
'New Framework to New Org 2735',
|
|
'New York Language Arts (2011)',
|
|
'New York Language Arts (2017)',
|
|
'Make Sure To Delete',
|
|
'Inquiry Skills'
|
|
];
|
|
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 {
|
|
const message = `Expected: Standards Dropdown list: ${JSON.stringify(expectedList)}, Actual: ${JSON.stringify(actual)}`;
|
|
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('Multiple validation checks did not pass');
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Standards Display label text
|
|
{
|
|
description: 'Validate Standards Display label text',
|
|
action: async () => {
|
|
const elementText = await driver.findElement(By.css('.form-group:nth-child(5) > .col-sm-2')).getText();
|
|
if (elementText === 'Standards Display') {
|
|
console.log('Passed: Standards Display label text matched as expected');
|
|
} else {
|
|
throw new Error(`Expected: "Standards Display" label text; Actual: "${elementText}"`);
|
|
}
|
|
}
|
|
},
|
|
|
|
//All radio option checkbox -active
|
|
{
|
|
description: 'Validate All radio option enabled',
|
|
action: async () => {
|
|
const elementOption = await driver.findElement(By.css('#gap1')).getAttribute('checked');
|
|
if (elementOption === 'true') {
|
|
console.log('Passed: All radio option value matched as expected');
|
|
} else {
|
|
throw new Error(`All radio option value was not selected; Actual: "${elementOption}"`);
|
|
}
|
|
}
|
|
},
|
|
|
|
//All radio handle text
|
|
{
|
|
description: 'Validate All radio handle text',
|
|
action: async () => {
|
|
const elementText = await driver.findElement(By.css('.form-check:nth-child(1) > .form-check-label')).getText();
|
|
if (elementText === 'All') {
|
|
console.log('Passed: All radio handle text matched as expected');
|
|
} else {
|
|
throw new Error(`Expected: "All" radio handle text; Actual: "${elementText}"`);
|
|
}
|
|
}
|
|
},
|
|
|
|
//Correlated Only radio option checkbox
|
|
{
|
|
description: 'Validate Correlated Only radio option enabled',
|
|
action: async () => {
|
|
const elementOption = await driver.findElement(By.css('#gap2')).getAttribute('type');
|
|
if (elementOption === 'radio') {
|
|
console.log('Passed: Correlated Only radio type matched as expected');
|
|
} else {
|
|
throw new Error(`Correlated Only radio type did not match; Actual: "${elementOption}"`);
|
|
}
|
|
}
|
|
},
|
|
|
|
//Correlated Only radio handle text
|
|
{
|
|
description: 'Validate Correlated Only radio handle text',
|
|
action: async () => {
|
|
const elementText = await driver.findElement(By.css('.form-check:nth-child(2) > .form-check-label')).getText();
|
|
if (elementText === 'Correlated Only') {
|
|
console.log('Passed: Correlated Only radio handle text matched as expected');
|
|
} else {
|
|
throw new Error(`Expected: "Correlated Only" radio handle text; Actual: "${elementText}"`);
|
|
}
|
|
}
|
|
},
|
|
|
|
//Uncorrelated Only radio option checkbox
|
|
{
|
|
description: 'Validate Uncorrelated Only radio option enabled',
|
|
action: async () => {
|
|
const elementOption = await driver.findElement(By.css('#gap3')).getAttribute('type');
|
|
if (elementOption === 'radio') {
|
|
console.log('Passed: Uncorrelated Only radio type matched as expected');
|
|
} else {
|
|
throw new Error(`Uncorrelated Only radio type did not match; Actual: "${elementOption}"`);
|
|
}
|
|
}
|
|
},
|
|
|
|
//Uncorrelated Only radio handle text
|
|
{
|
|
description: 'Validate Uncorrelated Only radio handle text',
|
|
action: async () => {
|
|
const elementText = await driver.findElement(By.css('.form-check:nth-child(3) > .form-check-label')).getText();
|
|
if (elementText === 'Uncorrelated Only') {
|
|
console.log('Passed: Uncorrelated Only radio handle text matched as expected');
|
|
} else {
|
|
throw new Error(`Expected: "Uncorrelated Only" radio handle text; Actual: "${elementText}"`);
|
|
}
|
|
}
|
|
},
|
|
|
|
//Subject label text
|
|
{
|
|
description: 'Validate Subject Display label text',
|
|
action: async () => {
|
|
const elementText = await driver.findElement(By.css('.hideSubject > .col-sm-2')).getText();
|
|
if (elementText === 'Subject') {
|
|
console.log('Passed: Subject label text matched as expected');
|
|
} else {
|
|
throw new Error(`Expected: "Subject" label text; Actual: "${elementText}"`);
|
|
}
|
|
}
|
|
},
|
|
|
|
//Subject dropdown
|
|
{
|
|
description: 'Validate Subject dropdown list and value',
|
|
action: async () => {
|
|
const select = await driver.findElement(By.css('#selectSubjects'));
|
|
|
|
// Get the selected option text
|
|
const selectedOption = await select.findElement(By.css('option:checked'));
|
|
const selectedText = await selectedOption.getText();
|
|
|
|
if (selectedText === 'Select a subject') {
|
|
console.log('Passed: Select a subject default value matched as expected');
|
|
} else {
|
|
throw new Error(`Expected Select a subject "Select a subject"; Actual: "${selectedText}"`);
|
|
}
|
|
|
|
const options = await select.findElements(By.css('option'));
|
|
const expectedList = [
|
|
'Select a subject',
|
|
'Language Arts',
|
|
'Mathematics',
|
|
'Science',
|
|
'Social Studies',
|
|
'World Languages'
|
|
];
|
|
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 {
|
|
const message = `Expected: Subject Dropdown list: ${JSON.stringify(expectedList)}, Actual: ${JSON.stringify(actual)}`;
|
|
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('Multiple validation checks did not pass');
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Show Correlations From label text
|
|
{
|
|
description: 'Validate Show Correlations From label text',
|
|
action: async () => {
|
|
const elementText = await driver.findElement(By.css('.form-group:nth-child(8) > .col-sm-2')).getText();
|
|
if (elementText === 'Show Correlations From') {
|
|
console.log('Passed: Show Correlations From label text matched as expected');
|
|
} else {
|
|
throw new Error(`Expected: "Show Correlations From" label text; Actual: "${elementText}"`);
|
|
}
|
|
}
|
|
},
|
|
|
|
//Show Correlations From dropdown
|
|
{
|
|
description: 'Validate Show Correlations From dropdown list and value',
|
|
action: async () => {
|
|
|
|
//Locate and validate selected (collapsed) value
|
|
const dropdownButton = await driver.findElement(
|
|
By.css('button.multiselect.dropdown-toggle')
|
|
);
|
|
|
|
const selectedText = (await dropdownButton.getAttribute('title')).trim();
|
|
|
|
if (selectedText === 'None selected') {
|
|
console.log('Passed: Show Correlations From default value matched as expected');
|
|
} else {
|
|
throw new Error(
|
|
`Expected default value "All Content Sets"; Actual: "${selectedText}"`
|
|
);
|
|
}
|
|
|
|
//Open dropdown
|
|
console.log('----->| NEXT ACTION: Clicked All Content Sets dropdown');
|
|
await driver.findElement(By.css('.col-sm-10 .multiselect-selected-text')).click();
|
|
await driver.sleep(2000);
|
|
|
|
//Wait for dropdown list to become visible
|
|
const dropdownMenu = await driver.wait(
|
|
until.elementLocated(By.css('ul.multiselect-container.dropdown-menu.show')),
|
|
10000
|
|
);
|
|
|
|
await driver.wait(
|
|
until.elementIsVisible(dropdownMenu),
|
|
10000
|
|
);
|
|
|
|
//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',
|
|
'Demo - User Submitted Content',
|
|
'Upload Demo',
|
|
'Exploring - Access',
|
|
'Exploring - PowerPoint',
|
|
'Exploring - Word',
|
|
'Algebra - QA',
|
|
'Biology - QA',
|
|
'English II - QA',
|
|
'Geometry - QA',
|
|
'US History - QA',
|
|
'Import Align - Concept Based',
|
|
'Import Align - Direct Align',
|
|
'Im Creating Content',
|
|
'Math Alignment Import Test',
|
|
'Import testing 3',
|
|
'New Frame Delete Test',
|
|
'ECS-2952 Test'
|
|
];
|
|
|
|
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]}"`
|
|
);
|
|
}
|
|
});
|
|
|
|
//Fail once, list everything
|
|
if (errors.length > 0) {
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
|
|
//Click away to close list
|
|
await driver.findElement(By.css('.mt-2 > .col-sm-10')).click();
|
|
console.log('Passed: Show Correlations From dropdown list matched as expected');
|
|
}
|
|
},
|
|
|
|
//Term Search From label text
|
|
{
|
|
description: 'Validate Term Search From label text',
|
|
action: async () => {
|
|
const elementText = await driver.findElement(By.css('.form-group:nth-child(12) > .col-sm-2')).getText();
|
|
if (elementText === 'Term Search') {
|
|
console.log('Passed: Term Search label text matched as expected');
|
|
} else {
|
|
throw new Error(`Expected: "Term Search" label text; Actual: "${elementText}"`);
|
|
}
|
|
}
|
|
},
|
|
|
|
//Term Search placeholder
|
|
{
|
|
description: 'Validate Term Search placeholder',
|
|
action: async () => {
|
|
const elementValue = await driver.findElement(By.css('#searchTerm')).getAttribute('placeholder');
|
|
if (elementValue === '') {
|
|
console.log('Passed: Term Search "blank" placeholder text, matched as expected');
|
|
} else {
|
|
throw new Error(`Expected: Term Search "blank" placeholder text; Actual: "${elementValue}"`);
|
|
}
|
|
}
|
|
},
|
|
|
|
//Include Related Standards checkbox
|
|
{
|
|
description: 'Validate Include Related Standards checkbox',
|
|
action: async () => {
|
|
const elementOption = await driver.findElement(By.css('#doRel')).getAttribute('type');
|
|
if (elementOption === '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: "${elementOption}"`);
|
|
}
|
|
}
|
|
},
|
|
|
|
//Include Related Standards label text
|
|
{
|
|
description: 'Validate Include Related Standards label text',
|
|
action: async () => {
|
|
const elementText = await driver.findElement(By.css('.col-sm-offset-2 > label')).getText();
|
|
if (elementText === 'Include Related Standards') {
|
|
console.log('Passed: Include Related Standards label text matched as expected');
|
|
} else {
|
|
throw new Error(`Expected: "Include Related Standards" label text; Actual: "${elementText}"`);
|
|
}
|
|
}
|
|
},
|
|
|
|
//Search button
|
|
{
|
|
description: 'Validate Search button icon, text, and color',
|
|
action: async () => {
|
|
const element = await driver.findElement(By.css('#stdsubmit'));
|
|
|
|
//Get text, color, and icon
|
|
const elementText = await element.getAttribute('value');
|
|
const elementColor = await element.getCssValue('background-color');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//Validate text
|
|
if (elementText === 'Search') {
|
|
console.log('Passed: Search button text matched as expected');
|
|
} else {
|
|
const message = `Expected: Button text "Search"; Actual: "${elementText}"`;
|
|
errors.push(message);
|
|
}
|
|
|
|
//Validate color -green
|
|
if (elementColor === 'rgba(48, 200, 172, 1)') {
|
|
console.log('Passed: Search button color matched as expected');
|
|
} else {
|
|
const message = `Expected: Search button color "rgba(48, 200, 172, 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('Multiple validation checks did not pass');
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//NEXT ACTION - Alert DIV -Validation
|
|
{
|
|
description: 'Click search button without selecting any values and validate assert message',
|
|
action: async () => {
|
|
const searchButton = await driver.wait(
|
|
until.elementLocated(By.css('#stdsubmit')),
|
|
5000
|
|
);
|
|
|
|
await searchButton.click();
|
|
console.log('----->| NEXT ACTION: Clicked Search button');
|
|
|
|
const expected = 'You must select a grade';
|
|
let alertText;
|
|
|
|
try {
|
|
const alert = await driver.wait(until.alertIsPresent(), 5000);
|
|
alertText = (await alert.getText()).trim();
|
|
|
|
//close alert before leaving try block
|
|
await alert.accept();
|
|
console.log('----->| NEXT ACTION: Clicked alert OK option');
|
|
} catch (err) {
|
|
throw new Error(`Failed while handling alert: ${err.message}`);
|
|
}
|
|
|
|
if (alertText === expected) {
|
|
console.log('Passed: Alert text matched as expected');
|
|
} else {
|
|
throw new Error(
|
|
`Alert text did not match: \n Expected: "${expected}"\n Actual: "${alertText}"`
|
|
);
|
|
}
|
|
}
|
|
},
|
|
|
|
//NEXT ACTION - Click Include Related Standards checkbox
|
|
{
|
|
description: 'Dashboard - Click Include Related Standards checkbox',
|
|
action: async () => {
|
|
console.log('----->| NEXT ACTION: Clicked Inclued Related Standards checkbox');
|
|
await driver.findElement(By.css('#doRel')).click();
|
|
}
|
|
},
|
|
|
|
//Wait for element
|
|
{
|
|
description: 'Wait for DIV to be visible',
|
|
action: async () => {
|
|
|
|
//Wait until the element exists in the DOM
|
|
const elementVisible = await driver.wait(
|
|
until.elementLocated(By.css('.col-auto .multiselect-selected-text')),
|
|
20000
|
|
);
|
|
|
|
//Wait until it becomes visible
|
|
await driver.wait(
|
|
until.elementIsVisible(elementVisible),
|
|
20000
|
|
);
|
|
await driver.sleep(2000);
|
|
}
|
|
},
|
|
|
|
//None Selected dropdown
|
|
|
|
//based on label text
|
|
{
|
|
description: 'Validate based on label text',
|
|
action: async () => {
|
|
const elementText = await driver.findElement(By.css('.col-auto:nth-child(2)')).getText();
|
|
if (elementText === 'based on') {
|
|
console.log('Passed: based on label text matched as expected');
|
|
} else {
|
|
throw new Error(`Expected: "based on" label text; Actual: "${elementText}"`);
|
|
}
|
|
}
|
|
},
|
|
|
|
//best match dropdown
|
|
|
|
//Question icon
|
|
|
|
//Asterisk text, family font, and font size
|
|
{
|
|
description: 'Validate Asterisk text, family font, and size',
|
|
action: async () => {
|
|
const element = await driver.findElement(By.css('em'));
|
|
|
|
//Get text, color, and size
|
|
const elementText = await element.getText();
|
|
const elementColor = await element.getCssValue('color');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//Validate text =
|
|
if (elementText === '** note - including related standards may cause increased page load times') {
|
|
console.log("Passed: *Note text matched as expected");
|
|
} else {
|
|
const message = `Expected: "** note - including related standards may cause increased page load times"; Actual: "${elementText}"`;
|
|
errors.push(message);
|
|
}
|
|
|
|
//Validate color -navy blue
|
|
if (elementColor === 'rgba(40, 39, 90, 1)') {
|
|
console.log('Passed: Browse page - Browse standards sub-title text color matched as expected');
|
|
} else {
|
|
const message = `Expected: Browse page - Browse standards sub-title text color "rgba(40, 39, 90, 1)"; Actual: "${elementColor}"`;
|
|
errors.push(message);
|
|
}
|
|
|
|
//Validate font size
|
|
if (elementSize === '10.4px') {
|
|
console.log('Passed: Browse page - Browse standards sub-title text font-size matched as expected');
|
|
} else {
|
|
const message = `Expected: Browse page - Browse standards sub-title text font-size "10.4px"; Actual: "${elementSize}"`;
|
|
errors.push(message);
|
|
}
|
|
|
|
//Throw once at the end (no additional console logs here)
|
|
if (errors.length > 0) {
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Alert DIV -Validation
|
|
{
|
|
description: 'Click search button without selecting any values and validate assert message',
|
|
action: async () => {
|
|
const searchButton = await driver.wait(
|
|
until.elementLocated(By.css('#stdsubmit')),
|
|
5000
|
|
);
|
|
|
|
await searchButton.click();
|
|
console.log('----->| NEXT ACTION: Clicked Search button');
|
|
|
|
const expected = 'You must select at least one set of related standards';
|
|
let alertText;
|
|
|
|
try {
|
|
const alert = await driver.wait(until.alertIsPresent(), 5000);
|
|
alertText = (await alert.getText()).trim();
|
|
|
|
//close alert before leaving try block
|
|
await alert.accept();
|
|
console.log('----->| NEXT ACTION: Clicked alert OK option');
|
|
} catch (err) {
|
|
throw new Error(`Failed while handling alert: ${err.message}`);
|
|
}
|
|
|
|
if (alertText === expected) {
|
|
console.log('Passed: Alert text matched as expected');
|
|
} else {
|
|
throw new Error(
|
|
`Alert text did not match: \n Expected: "${expected}"\n Actual: "${alertText}"`
|
|
);
|
|
}
|
|
}
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//LOG OUT
|
|
//NEXT ACTION - Log out
|
|
{
|
|
description: 'Log out of EXACT',
|
|
action: async () => {
|
|
//Profile link
|
|
await driver.findElement(By.css('#navbarDropdown > span')).click();
|
|
await driver.sleep(1000);
|
|
//Log Out
|
|
await driver.findElement(By.linkText('Log Out')).click();
|
|
console.log('----->| NEXT ACTION: Clicked User Profile and Logged out');
|
|
await driver.sleep(1000);
|
|
}
|
|
},
|
|
|
|
//Wait for page to load
|
|
{
|
|
description: 'Wait for page to fully load',
|
|
action: async () => {
|
|
|
|
//Wait until the element exists in the DOM
|
|
const loginButton = await driver.wait(
|
|
until.elementLocated(By.css('.login')),
|
|
20000
|
|
);
|
|
|
|
//Wait until it becomes visible
|
|
await driver.wait(
|
|
until.elementIsVisible(loginButton),
|
|
20000
|
|
);
|
|
|
|
await driver.wait(async () => {
|
|
const readyState = await driver.executeScript('return document.readyState');
|
|
return readyState === 'complete';
|
|
}, 30000, 'ExACT landing page did not fully load within 30 seconds');
|
|
|
|
console.log('----------------->| LOGGED OUT SUCCESSFULLY |<-----------------');
|
|
await driver.sleep(5000);
|
|
}
|
|
},
|
|
];
|
|
|
|
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 clearOldResults = () => {
|
|
//Remove old screenshots
|
|
const screenshotDir = path.join('screenshots', 'dashboardMyStandardsResults');
|
|
if (fs.existsSync(screenshotDir)) {
|
|
fs.rmSync(screenshotDir, { recursive: true, force: true });
|
|
}
|
|
fs.mkdirSync(screenshotDir, { recursive: true });
|
|
|
|
//Remove old Excel file
|
|
if (fs.existsSync('dashboardMyStandardsResultsResults.xlsx')) {
|
|
fs.unlinkSync('dashboardMyStandardsResults.xlsx');
|
|
}
|
|
};
|
|
|
|
try {
|
|
//Initialize workbook and worksheet
|
|
clearOldResults();
|
|
|
|
//Initialize workbook and worksheet
|
|
workbook = XLSX.utils.book_new();
|
|
worksheet = XLSX.utils.aoa_to_sheet([
|
|
['Step Number', 'Step Description', 'Status', 'Timestamp', 'Screenshot']
|
|
]);
|
|
XLSX.utils.book_append_sheet(workbook, worksheet, 'Sheet1');
|
|
|
|
//Log test start time
|
|
worksheet = logStep(worksheet, 'Test Start', 'Started', '', startTime, '');
|
|
|
|
let allStepsPassed = true;
|
|
|
|
for (const step of steps) {
|
|
const stepIndex = steps.indexOf(step) + 1;
|
|
const timestamp = new Date().toISOString();
|
|
|
|
try {
|
|
//Screenshot of failed step
|
|
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) {
|
|
//Only take screenshot if the step fails
|
|
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}`);
|
|
testStatus = 'Failed';
|
|
allStepsPassed = false;
|
|
}
|
|
}
|
|
|
|
//Check if log out was successful
|
|
const loginButton = await driver.wait(until.elementLocated(By.css('.login')), 5000).catch(() => false);
|
|
|
|
if (loginButton && allStepsPassed) {
|
|
console.log('PASSED: My Standards Widget(ExACT_dashboardMyStandards); All test steps completed successfully');
|
|
testStatus = 'Passed';
|
|
} else {
|
|
console.log('FAILED: My Standards Widget(ExACT_dashboardMyStandards); One or more test steps failed');
|
|
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, 'dashboardMyStandardsResults.xlsx');
|
|
} finally {
|
|
await driver.quit();
|
|
}
|
|
})();
|
|
}
|
|
|
|
export default ExACT_dashboardMyStandards;
|