5651 lines
214 KiB
JavaScript
5651 lines
214 KiB
JavaScript
import { Builder, By, Key, until, Select, Browser } from 'selenium-webdriver';
|
|
import { Options as ChromeOptions } from 'selenium-webdriver/chrome.js';
|
|
import fs from 'fs';
|
|
import XLSX from 'xlsx';
|
|
import path from 'path';
|
|
|
|
const correlationsDashboard = (req, res) => {
|
|
res.send('<h2>ExACT Automated Test Script: Correlations Dashboard(correlationsDashboard) | Initiated</h2>');
|
|
(async function example() {
|
|
let driver = await new Builder()
|
|
.forBrowser('chrome')
|
|
.setChromeOptions(
|
|
new ChromeOptions()
|
|
.addArguments('--disable-features=MediaRouter')
|
|
.addArguments('--disable-extensions')
|
|
.addArguments('--disable-background-networking')
|
|
.addArguments('--log-level=3')
|
|
)
|
|
.build();
|
|
let testStatus = 'Failed';
|
|
let workbook;
|
|
let worksheet;
|
|
const startTime = new Date().toISOString();
|
|
|
|
//CONSTANTS
|
|
//My Content Widget
|
|
const myContentItemTotals = '5040 items';
|
|
|
|
const steps = [
|
|
{ description: 'Navigate to ExACT Landing Page', action: async () => await driver.navigate().to('https://correlation.edgate.com/exact/login.php') },
|
|
{ description: 'Expand browser', action: async () => await driver.manage().window().maximize() },
|
|
|
|
//Login
|
|
{
|
|
description: 'Login',
|
|
action: async () => {
|
|
const multipleChecks = 'Log In';
|
|
|
|
console.log('------------->| CORRELATION DASHBOARD |<-------------');
|
|
const errors = [];
|
|
|
|
await driver.findElement(By.css('.form-control:nth-child(2)')).sendKeys('exact_juan');
|
|
await driver.findElement(By.css('.passfield')).sendKeys('Edgate1!');
|
|
await driver.findElement(By.css('.login')).click();
|
|
console.log('----->| NEXT ACTION: Entered credentials and logged in');
|
|
|
|
//Wait for page readyState
|
|
await driver.wait(async () => {
|
|
const readyState = await driver.executeScript('return document.readyState');
|
|
return readyState === 'complete';
|
|
}, 30000, 'ExACT Dashboard did not fully load within 30 seconds');
|
|
|
|
//Wait for the dashboard container to exist in DOM
|
|
await driver.wait(
|
|
until.elementLocated(By.css('.gap-idle-wrap > img')),
|
|
30000,
|
|
'Dashboard image did not appear within 30 seconds'
|
|
);
|
|
|
|
//Wait for it to be visible
|
|
await driver.wait(async () => {
|
|
try {
|
|
const img = await driver.findElement(By.css('.gap-idle-wrap > img'));
|
|
return await img.isDisplayed();
|
|
} catch (e) {
|
|
return false;
|
|
}
|
|
}, 30000, 'Dashboard image did not become visible within 30 seconds');
|
|
|
|
//Wait for any loading spinners to disappear
|
|
await driver.wait(async () => {
|
|
try {
|
|
const spinners = await driver.findElements(By.css('.spinner-border'));
|
|
for (const spinner of spinners) {
|
|
if (await spinner.isDisplayed()) return false;
|
|
}
|
|
return true;
|
|
} catch (e) {
|
|
return true;
|
|
}
|
|
}, 30000, 'Loading spinners did not disappear within 30 seconds');
|
|
|
|
//Wait for the slowest resource to complete
|
|
await driver.wait(async () => {
|
|
const completed = await driver.executeScript(`
|
|
const entries = performance.getEntriesByType('resource');
|
|
return entries.some(entry =>
|
|
entry.name.includes('content_sets.php') &&
|
|
entry.responseEnd > 0
|
|
);
|
|
`);
|
|
return completed;
|
|
}, 30000, 'My Content widget (content_sets.php) did not complete loading within 30 seconds');
|
|
console.log('Passed: My Content widget (content_sets.php) loaded successfully - Dashboard fully loaded');
|
|
|
|
//Final sleep to allow any remaining dynamic content to settle
|
|
await driver.sleep(2000);
|
|
|
|
console.log('Passed: ExACT Dashboard loaded successfully');
|
|
|
|
if (errors.length > 0) {
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//DASHBOARD HEADER
|
|
//ExACT Dashboard Logo
|
|
{
|
|
description: 'ExACT Dashboard Logo',
|
|
action: async () => {
|
|
const multipleChecks = 'ExACT Dashboard Logo';
|
|
|
|
const element = await driver.findElement(By.css('span > img'));
|
|
const expectedSrc = 'https://correlation.edgate.com/exact/images/exact.svg';
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//icon present
|
|
if (await element.isDisplayed()) {
|
|
console.log('Passed: ExACT by edgate logo was displayed as expected');
|
|
} else {
|
|
errors.push('Expected: ExACT by edgate logo was not displayed');
|
|
}
|
|
|
|
//image src
|
|
const actualSrc = await element.getAttribute('src');
|
|
if (actualSrc && actualSrc === expectedSrc) {
|
|
console.log('Passed: ExACT by edgate logo src matched expected');
|
|
} else {
|
|
errors.push(`Expected: ExACT by edgate logo src: "${expectedSrc}"; but found "${actualSrc}"`);
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Navigation show/hide icon
|
|
{
|
|
description: 'Navigation panel show/hide icon',
|
|
action: async () => {
|
|
const multipleChecks = 'Navigation panel show/hide icon';
|
|
|
|
const element = await driver.findElement(By.css('.fa-bars'));
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//icon present
|
|
if (await element.isDisplayed()) {
|
|
console.log('Passed: Navigation panel show/hide icon was displayed as expected');
|
|
} else {
|
|
errors.push('Expected: Navigation panel show/hide icon was not displayed');
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Search textbox
|
|
{
|
|
description: 'Search textbox',
|
|
action: async () => {
|
|
const multipleChecks = 'Search textbox';
|
|
|
|
const element = await driver.findElement(By.css('.searchbar-input'));
|
|
const elementIcon = await driver.findElement(By.css('.searchbar-submit > .fa')).getCssValue('color');
|
|
|
|
//Get text, font, size, and color
|
|
const elementText = await element.getAttribute('placeholder');
|
|
|
|
//Get placeholder styles via executeScript since it's a pseudo-element
|
|
const elementFont = await driver.executeScript(
|
|
`return window.getComputedStyle(arguments[0], '::placeholder').getPropertyValue('font-family')`,
|
|
element
|
|
);
|
|
|
|
const elementSize = await driver.executeScript(
|
|
`return window.getComputedStyle(arguments[0], '::placeholder').getPropertyValue('font-size')`,
|
|
element
|
|
);
|
|
|
|
const elementColor = await driver.executeScript(
|
|
`return window.getComputedStyle(arguments[0], '::placeholder').getPropertyValue('color')`,
|
|
element
|
|
);
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//text
|
|
if (elementText === 'Search...') {
|
|
console.log('Passed: Search textbox placeholder text matched as expected');
|
|
} else {
|
|
errors.push(`Expected: "Search..." placeholder; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//font-family
|
|
if (elementFont === "Poppins, sans-serif") {
|
|
console.log('Passed: Search textbox placeholder text font matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Search textbox placeholder text font "Poppins, sans-serif"; Actual: ${elementFont}`);
|
|
}
|
|
|
|
//font size
|
|
if (elementSize === '13.5px') {
|
|
console.log('Passed: Search textbox placeholder text font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Search textbox placeholder text font-size "13.5px"; Actual: "${elementSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementColor === 'rgb(204, 204, 204)') {
|
|
console.log('Passed: Search textbox placeholder text color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Search textbox placeholder text color: "rgb(204, 204, 204)"; Actual: "${elementColor}"`);
|
|
}
|
|
|
|
//search icon color
|
|
if (elementIcon === 'rgba(255, 255, 255, 1)') {
|
|
console.log('Passed: Search textbox icon color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Search textbox icon color did not match; Actual: "${elementIcon}"`);
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//ExACT Help Icon
|
|
{
|
|
description: 'ExACT Help Icon',
|
|
action: async () => {
|
|
const multipleChecks = 'ExACT Help Icon';
|
|
|
|
const element = await driver.findElement(By.css('.e-help path'));
|
|
const link = await driver.findElement(By.css('.e-help a.user-profile'));
|
|
const expectedHref = 'https://correlation.edgate.com/exact/help.php';
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//icon present
|
|
if (await element.isDisplayed()) {
|
|
console.log('Passed: ExACT Help icon was displayed as expected');
|
|
} else {
|
|
errors.push('Expected: ExACT Help icon was not displayed');
|
|
}
|
|
|
|
//href
|
|
const actualHref = await link.getAttribute('href');
|
|
if (actualHref && actualHref === expectedHref) {
|
|
console.log('Passed: Help icon href matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Help icon href to be "${expectedHref}"; but found "${actualHref}"`);
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Notification bell Icon
|
|
{
|
|
description: 'Notification Bell Icon',
|
|
action: async () => {
|
|
const multipleChecks = 'Notification Bell Icon';
|
|
|
|
const element = await driver.findElement(By.css('#navbarDropdown > svg'));
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//icon present
|
|
if (await element.isDisplayed()) {
|
|
console.log('Passed: Notification bell icon was displayed as expected');
|
|
} else {
|
|
errors.push('Expected: Notification bell icon was not displayed');
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//User profile dropdown
|
|
{
|
|
description: 'User Profile Dropdown',
|
|
action: async () => {
|
|
const multipleChecks = 'User Profile Dropdown';
|
|
|
|
const element = await driver.findElement(By.css('#navbarDropdown > span')).getText();
|
|
const userIcon = await driver.findElement(By.css('.fa-user'));
|
|
const downCarrotIcon = await driver.findElement(By.css('.nav-item:nth-child(1) > #navbarDropdown'));
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//text
|
|
if (element === 'Juan Huerta') {
|
|
console.log('Passed: User profile dropdown text matched as expected');
|
|
} else {
|
|
errors.push(`Expected: "Juan Huerta"; Actual: "${element}"`);
|
|
}
|
|
|
|
//User icon
|
|
if (await userIcon.isDisplayed()) {
|
|
console.log('Passed: User profile dropdown icon was displayed as expected');
|
|
} else {
|
|
errors.push('Expected: User profile dropdown icon was not displayed');
|
|
}
|
|
|
|
//Down carrot icon
|
|
if (await downCarrotIcon.isDisplayed()) {
|
|
console.log('Passed: User profile down carrot icon was displayed as expected');
|
|
} else {
|
|
errors.push('Expected: User profile down carrot icon was not displayed');
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//NAVIGATION PANEL
|
|
//Dashboard
|
|
{
|
|
description: 'Dashboard Navigation title text, size, color, and href',
|
|
action: async () => {
|
|
const multipleChecks = 'Dashboard Navigation title';
|
|
|
|
const elementIcon = await driver.findElement(By.css('.fb-dashboard'));
|
|
const element = await driver.findElement(By.linkText('Dashboard'));
|
|
const expectedHref = 'https://correlation.edgate.com/exact/';
|
|
|
|
//Get text, font, size, and color
|
|
const elementText = await element.getText();
|
|
const elementTextFont = await element.getCssValue('font-family');
|
|
const elementTextSize = await element.getCssValue('font-size');
|
|
const elementTextColor = await element.getCssValue('color');
|
|
const elementBGTextColor = await element.getCssValue('background-color');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//icon
|
|
if (await elementIcon.isDisplayed()) {
|
|
console.log('Passed: Dashboard Navigation icon was displayed as expected');
|
|
} else {
|
|
errors.push('Expected: Dashboard Navigation icon was not displayed');
|
|
}
|
|
|
|
//text
|
|
if (elementText === 'Dashboard') {
|
|
console.log('Passed: Dashboard Navigation title text matched as expected');
|
|
} else {
|
|
errors.push(`Expected: "Dashboard"; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//href
|
|
const actualHref = await element.getAttribute('href');
|
|
if (actualHref && actualHref === expectedHref) {
|
|
console.log('Passed: Dashboard Navigation href matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard Navigation href to be "${expectedHref}"; but found "${actualHref}"`);
|
|
}
|
|
|
|
//font-family
|
|
if (elementTextFont === "Poppins, sans-serif") {
|
|
console.log('Passed: Dashboard Navigation title font matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard Navigation title font "Poppins, sans-serif"; Actual: ${elementTextFont}`);
|
|
}
|
|
|
|
//font size
|
|
if (elementTextSize === '14px') {
|
|
console.log('Passed: Dashboard Navigation title text font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard Navigation title text font-size "14px"; Actual: "${elementTextSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementTextColor === 'rgba(250, 250, 250, 1)') {
|
|
console.log('Passed: Dashboard Navigation title text color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard Navigation title text color: "rgba(250, 250, 250, 1)"; Actual: "${elementTextColor}"`);
|
|
}
|
|
|
|
//background color
|
|
if (elementBGTextColor === 'rgba(48, 200, 172, 1)') {
|
|
console.log('Passed: Dashboard Navigation title background color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard Navigation title background color: "rgba(48, 200, 172, 1)"; Actual: "${elementBGTextColor}"`);
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Frameworks
|
|
{
|
|
description: 'Frameworks Navigation title text, size, color, and href',
|
|
action: async () => {
|
|
const multipleChecks = 'Frameworks Navigation title';
|
|
|
|
const elementIcon = await driver.findElement(By.css('.fb-framework'));
|
|
const element = await driver.findElement(By.linkText('Frameworks'));
|
|
const expectedHref = 'https://correlation.edgate.com/exact/frameworks.php';
|
|
|
|
//Get text, font, size, and color
|
|
const elementText = await element.getText();
|
|
const elementTextFont = await element.getCssValue('font-family');
|
|
const elementTextSize = await element.getCssValue('font-size');
|
|
const elementTextColor = await element.getCssValue('color');
|
|
const elementBGTextColor = await element.getCssValue('background-color');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//icon
|
|
if (await elementIcon.isDisplayed()) {
|
|
console.log(`Passed: Frameworks Navigation icon was displayed as expected`);
|
|
} else {
|
|
errors.push('Expected: Frameworks Navigation icon was not displayed');
|
|
}
|
|
|
|
//text
|
|
if (elementText === 'Frameworks') {
|
|
console.log('Passed: Frameworks Navigation title text matched as expected');
|
|
} else {
|
|
errors.push(`Expected: "Frameworks"; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//href
|
|
const actualHref = await element.getAttribute('href');
|
|
if (actualHref && actualHref === expectedHref) {
|
|
console.log('Passed: Frameworks Navigation href matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Frameworks Navigation href to be "${expectedHref}"; but found "${actualHref}"`);
|
|
}
|
|
|
|
//font-family
|
|
if (elementTextFont === "Poppins, sans-serif") {
|
|
console.log('Passed: Frameworks Navigation title font matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Frameworks Navigation title font "Poppins, sans-serif"; Actual: ${elementTextFont}`);
|
|
}
|
|
|
|
//font size
|
|
if (elementTextSize === '14px') {
|
|
console.log('Passed: Frameworks Navigation title text font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Frameworks Navigation title text font-size "14px"; Actual: "${elementTextSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementTextColor === 'rgba(99, 99, 99, 1)') {
|
|
console.log('Passed: Frameworks Navigation title text color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Frameworks Navigation title text color: "rgba(99, 99, 99, 1)"; Actual: "${elementTextColor}"`);
|
|
}
|
|
|
|
//background color
|
|
if (elementBGTextColor === 'rgba(0, 0, 0, 0)') {
|
|
console.log('Passed: Frameworks Navigation title background color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Frameworks Navigation title background color: "rgba(0, 0, 0, 0)"; Actual: "${elementBGTextColor}"`);
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Align
|
|
{
|
|
description: 'Align Navigation title text, size, color, and href',
|
|
action: async () => {
|
|
const multipleChecks = 'Align Navigation title';
|
|
|
|
const elementIcon = await driver.findElement(By.css('.fb-align'));
|
|
const element = await driver.findElement(By.linkText('Align'));
|
|
const expectedHref = 'https://correlation.edgate.com/exact/browse.php';
|
|
|
|
//Get text, font, size, and color
|
|
const elementText = await element.getText();
|
|
const elementTextFont = await element.getCssValue('font-family');
|
|
const elementTextSize = await element.getCssValue('font-size');
|
|
const elementTextColor = await element.getCssValue('color');
|
|
const elementBGTextColor = await element.getCssValue('background-color');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//icon
|
|
if (await elementIcon.isDisplayed()) {
|
|
console.log(`Passed: Align Navigation icon was displayed as expected`);
|
|
} else {
|
|
errors.push('Expected: Align Navigation icon was not displayed');
|
|
}
|
|
|
|
//text
|
|
if (elementText === 'Align') {
|
|
console.log('Passed: Align Navigation title text matched as expected');
|
|
} else {
|
|
errors.push(`Expected: "Align"; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//href
|
|
const actualHref = await element.getAttribute('href');
|
|
if (actualHref && actualHref === expectedHref) {
|
|
console.log('Passed: Align Navigation href matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Align Navigation href to be "${expectedHref}"; but found "${actualHref}"`);
|
|
}
|
|
|
|
//font-family
|
|
if (elementTextFont === "Poppins, sans-serif") {
|
|
console.log('Passed: Align Navigation title font matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Align Navigation title font "Poppins, sans-serif"; Actual: ${elementTextFont}`);
|
|
}
|
|
|
|
//font size
|
|
if (elementTextSize === '14px') {
|
|
console.log('Passed: Align Navigation title text font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Align Navigation title text font-size "14px"; Actual: "${elementTextSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementTextColor === 'rgba(99, 99, 99, 1)') {
|
|
console.log('Passed: Align Navigation title text color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Align Navigation title text color: "rgba(99, 99, 99, 1)"; Actual: "${elementTextColor}"`);
|
|
}
|
|
|
|
//background color
|
|
if (elementBGTextColor === 'rgba(0, 0, 0, 0)') {
|
|
console.log('Passed: Align Navigation title background color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Align Navigation title background color: "rgba(0, 0, 0, 0)"; Actual: "${elementBGTextColor}"`);
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Upload
|
|
{
|
|
description: 'Upload Navigation title text, size, color, and href',
|
|
action: async () => {
|
|
const multipleChecks = 'Upload Navigation title';
|
|
|
|
const elementIcon = await driver.findElement(By.css('.fb-upload'));
|
|
const element = await driver.findElement(By.linkText('Upload'));
|
|
const expectedHref = 'https://correlation.edgate.com/exact/submit.php';
|
|
|
|
//Get text, font, size, and color
|
|
const elementText = await element.getText();
|
|
const elementTextFont = await element.getCssValue('font-family');
|
|
const elementTextSize = await element.getCssValue('font-size');
|
|
const elementTextColor = await element.getCssValue('color');
|
|
const elementBGTextColor = await element.getCssValue('background-color');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//icon
|
|
if (await elementIcon.isDisplayed()) {
|
|
console.log(`Passed: Upload Navigation icon was displayed as expected`);
|
|
} else {
|
|
errors.push('Expected: Upload Navigation icon was not displayed');
|
|
}
|
|
|
|
//text
|
|
if (elementText === 'Upload') {
|
|
console.log('Passed: Upload Navigation title text matched as expected');
|
|
} else {
|
|
errors.push(`Expected: "Upload"; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//href
|
|
const actualHref = await element.getAttribute('href');
|
|
if (actualHref && actualHref === expectedHref) {
|
|
console.log('Passed: Upload Navigation href matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Upload Navigation href to be "${expectedHref}"; but found "${actualHref}"`);
|
|
}
|
|
|
|
//font-family
|
|
if (elementTextFont === "Poppins, sans-serif") {
|
|
console.log('Passed: Upload Navigation title font matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Upload Navigation title font "Poppins, sans-serif"; Actual: ${elementTextFont}`);
|
|
}
|
|
|
|
//font size
|
|
if (elementTextSize === '14px') {
|
|
console.log('Passed: Upload Navigation title text font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Upload Navigation title text font-size "14px"; Actual: "${elementTextSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementTextColor === 'rgba(99, 99, 99, 1)') {
|
|
console.log('Passed: Upload Navigation title text color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Upload Navigation title text color: "rgba(99, 99, 99, 1)"; Actual: "${elementTextColor}"`);
|
|
}
|
|
|
|
//background color
|
|
if (elementBGTextColor === 'rgba(0, 0, 0, 0)') {
|
|
console.log('Passed: Upload Navigation title background color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Upload Navigation title background color: "rgba(0, 0, 0, 0)"; Actual: "${elementBGTextColor}"`);
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Activity Report
|
|
{
|
|
description: 'Activity Report Navigation title text, size, color, and href',
|
|
action: async () => {
|
|
const multipleChecks = 'Activity Report Navigation title';
|
|
|
|
const elementIcon = await driver.findElement(By.css('.fb-upload'));
|
|
const element = await driver.findElement(By.linkText('Activity Report'));
|
|
const expectedHref = 'https://correlation.edgate.com/exact/activity_reporting.php';
|
|
|
|
//Get text, font, size, and color
|
|
const elementText = await element.getText();
|
|
const elementTextFont = await element.getCssValue('font-family');
|
|
const elementTextSize = await element.getCssValue('font-size');
|
|
const elementTextColor = await element.getCssValue('color');
|
|
const elementBGTextColor = await element.getCssValue('background-color');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//icon
|
|
if (await elementIcon.isDisplayed()) {
|
|
console.log(`Passed: Activity Report Navigation icon was displayed as expected`);
|
|
} else {
|
|
errors.push('Expected: Activity Report Navigation icon was not displayed');
|
|
}
|
|
|
|
//text
|
|
if (elementText === 'Activity Report') {
|
|
console.log('Passed: Activity Report Navigation title text matched as expected');
|
|
} else {
|
|
errors.push(`Expected: "Activity Report"; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//href
|
|
const actualHref = await element.getAttribute('href');
|
|
if (actualHref && actualHref === expectedHref) {
|
|
console.log('Passed: Activity Report Navigation href matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Activity Report Navigation href to be "${expectedHref}"; but found "${actualHref}"`);
|
|
}
|
|
|
|
//font-family
|
|
if (elementTextFont === "Poppins, sans-serif") {
|
|
console.log('Passed: Activity Report Navigation title font matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Activity Report Navigation title font "Poppins, sans-serif"; Actual: ${elementTextFont}`);
|
|
}
|
|
|
|
//font size
|
|
if (elementTextSize === '14px') {
|
|
console.log('Passed: Activity Report Navigation title text font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Activity Report Navigation title text font-size "14px"; Actual: "${elementTextSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementTextColor === 'rgba(99, 99, 99, 1)') {
|
|
console.log('Passed: Activity Report Navigation title text color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Activity Report Navigation title text color: "rgba(99, 99, 99, 1)"; Actual: "${elementTextColor}"`);
|
|
}
|
|
|
|
//background color
|
|
if (elementBGTextColor === 'rgba(0, 0, 0, 0)') {
|
|
console.log('Passed: Activity Report Navigation title background color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Activity Report Navigation title background color: "rgba(0, 0, 0, 0)"; Actual: "${elementBGTextColor}"`);
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Report
|
|
{
|
|
description: 'Report Navigation title text, size, color, and href',
|
|
action: async () => {
|
|
const multipleChecks = 'Report Navigation title';
|
|
|
|
const elementIcon = await driver.findElement(By.css('.fb-upload'));
|
|
const element = await driver.findElement(By.linkText('Report'));
|
|
const expectedHref = 'https://correlation.edgate.com/exact/reports.php';
|
|
|
|
//Get text, font, size, and color
|
|
const elementText = await element.getText();
|
|
const elementTextFont = await element.getCssValue('font-family');
|
|
const elementTextSize = await element.getCssValue('font-size');
|
|
const elementTextColor = await element.getCssValue('color');
|
|
const elementBGTextColor = await element.getCssValue('background-color');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//icon
|
|
if (await elementIcon.isDisplayed()) {
|
|
console.log(`Passed: Report Navigation icon was displayed as expected`);
|
|
} else {
|
|
errors.push('Expected: Report Navigation icon was not displayed');
|
|
}
|
|
|
|
//text
|
|
if (elementText === 'Report') {
|
|
console.log('Passed: Report Navigation title text matched as expected');
|
|
} else {
|
|
errors.push(`Expected: "Report"; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//href
|
|
const actualHref = await element.getAttribute('href');
|
|
if (actualHref && actualHref === expectedHref) {
|
|
console.log('Passed: Report Navigation href matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Report Navigation href to be "${expectedHref}"; but found "${actualHref}"`);
|
|
}
|
|
|
|
//font-family
|
|
if (elementTextFont === "Poppins, sans-serif") {
|
|
console.log('Passed: Report Navigation title font matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Report Navigation title font "Poppins, sans-serif"; Actual: ${elementTextFont}`);
|
|
}
|
|
|
|
//font size
|
|
if (elementTextSize === '14px') {
|
|
console.log('Passed: Report Navigation title text font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Report Navigation title text font-size "14px"; Actual: "${elementTextSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementTextColor === 'rgba(99, 99, 99, 1)') {
|
|
console.log('Passed: Report Navigation title text color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Report Navigation title text color: "rgba(99, 99, 99, 1)"; Actual: "${elementTextColor}"`);
|
|
}
|
|
|
|
//background color
|
|
if (elementBGTextColor === 'rgba(0, 0, 0, 0)') {
|
|
console.log('Passed: Report Navigation title background color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Report Navigation title background color: "rgba(0, 0, 0, 0)"; Actual: "${elementBGTextColor}"`);
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Approve
|
|
{
|
|
description: 'Approve Navigation title text, size, color, and href',
|
|
action: async () => {
|
|
const multipleChecks = 'Approve Navigation title';
|
|
|
|
const elementIcon = await driver.findElement(By.css('.fb-upload'));
|
|
const element = await driver.findElement(By.linkText('Approve'));
|
|
const expectedHref = 'https://correlation.edgate.com/exact/approvecontent.php';
|
|
|
|
//Get text, font, size, and color
|
|
const elementText = await element.getText();
|
|
const elementTextFont = await element.getCssValue('font-family');
|
|
const elementTextSize = await element.getCssValue('font-size');
|
|
const elementTextColor = await element.getCssValue('color');
|
|
const elementBGTextColor = await element.getCssValue('background-color');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//icon
|
|
if (await elementIcon.isDisplayed()) {
|
|
console.log(`Passed: Approve Navigation icon was displayed as expected`);
|
|
} else {
|
|
errors.push('Expected: Approve Navigation icon was not displayed');
|
|
}
|
|
|
|
//text
|
|
if (elementText === 'Approve') {
|
|
console.log('Passed: Approve Navigation title text matched as expected');
|
|
} else {
|
|
errors.push(`Expected: "Approve"; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//href
|
|
const actualHref = await element.getAttribute('href');
|
|
if (actualHref && actualHref === expectedHref) {
|
|
console.log('Passed: Approve Navigation href matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Approve Navigation href to be "${expectedHref}"; but found "${actualHref}"`);
|
|
}
|
|
|
|
//font-family
|
|
if (elementTextFont === "Poppins, sans-serif") {
|
|
console.log('Passed: Approve Navigation title font matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Approve Navigation title font "Poppins, sans-serif"; Actual: ${elementTextFont}`);
|
|
}
|
|
|
|
//font size
|
|
if (elementTextSize === '14px') {
|
|
console.log('Passed: Approve Navigation title text font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Approve Navigation title text font-size "14px"; Actual: "${elementTextSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementTextColor === 'rgba(99, 99, 99, 1)') {
|
|
console.log('Passed: Approve Navigation title text color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Approve Navigation title text color: "rgba(99, 99, 99, 1)"; Actual: "${elementTextColor}"`);
|
|
}
|
|
|
|
//background color
|
|
if (elementBGTextColor === 'rgba(0, 0, 0, 0)') {
|
|
console.log('Passed: Approve Navigation title background color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Approve Navigation title background color: "rgba(0, 0, 0, 0)"; Actual: "${elementBGTextColor}"`);
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//DASHBOARD
|
|
//Dashboard title
|
|
{
|
|
description: 'dashboard title text, size, and color',
|
|
action: async () => {
|
|
const multipleChecks = 'Dashboard title';
|
|
|
|
const element = await driver.findElement(By.css('.e-heading'));
|
|
|
|
//Get text, font, size, and color
|
|
const elementText = await element.getText();
|
|
const elementTextFont = await element.getCssValue('font-family');
|
|
const elementTextSize = await element.getCssValue('font-size');
|
|
const elementTextColor = await element.getCssValue('color');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//text
|
|
if (elementText === 'Correlation Dashboard') {
|
|
console.log('Passed: Dashboard title text matched as expected');
|
|
} else {
|
|
errors.push(`Expected: "Correlation Dashboard"; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//font-family
|
|
if (elementTextFont === `"DM Serif Display", serif`) {
|
|
console.log('Passed: Dashboard title font matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard title font "DM Serif Display, serif"; Actual: ${elementTextFont}`);
|
|
}
|
|
|
|
//font size
|
|
if (elementTextSize === '32px') {
|
|
console.log('Passed: Dashboard title text font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard title text font-size "32px"; Actual: "${elementTextSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementTextColor === 'rgba(40, 39, 90, 1)') {
|
|
console.log('Passed: Dashboard title text color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Dashboard title text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`);
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//MY CONTENT WIDGET
|
|
//My Content Widget title
|
|
{
|
|
description: 'My Content widget title text, color, and size',
|
|
action: async () => {
|
|
const multipleChecks = 'My Content widget title';
|
|
|
|
const element = await driver.findElement(By.css('.h-100 h2:nth-child(2)'));
|
|
|
|
//Get text, font, size, and color
|
|
const elementText = await element.getText();
|
|
const elementTextFont = await element.getCssValue('font-family');
|
|
const elementTextSize = await element.getCssValue('font-size');
|
|
const elementTextColor = await element.getCssValue('color');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//text
|
|
if (elementText === 'My Content') {
|
|
console.log('Passed: My Content widget title text matched as expected');
|
|
} else {
|
|
errors.push(`Expected: "My Content"; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//font-family
|
|
if (elementTextFont === 'Poppins, sans-serif') {
|
|
console.log('Passed: My Content widget title font matched as expected');
|
|
} else {
|
|
errors.push(`Expected: My Content widget title font "Poppins, sans-serif", serif; Actual: ${elementTextFont}`);
|
|
}
|
|
|
|
//font size
|
|
if (elementTextSize === '18px') {
|
|
console.log('Passed: My Content widget title text font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: My Content widget title text font-size "18px"; Actual: "${elementTextSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementTextColor === 'rgba(40, 39, 90, 1)') {
|
|
console.log('Passed: My Content widget title text color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: My Content widget title text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`);
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//My Content total item Count
|
|
{
|
|
description: 'My Content total item count',
|
|
action: async () => {
|
|
const multipleChecks = 'My Content total item count';
|
|
|
|
const element = await driver.findElement(By.css('#badge_content_total'));
|
|
|
|
//Get button text, text font, text size, text color, and button color
|
|
const elementText = await element.getText('');
|
|
const elementTextFont = await element.getCssValue('font-family');
|
|
const elementTextSize = await element.getCssValue('font-size');
|
|
const elementTextColor = await element.getCssValue('color');
|
|
const elementButtonColor = await element.getCssValue('background-color');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//text
|
|
if (elementText === myContentItemTotals) {
|
|
console.log('Passed: Total item count button text matched as expected');
|
|
} else {
|
|
errors.push(`Expected: "${myContentItemTotals}"; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//font-family
|
|
if (elementTextFont === "Poppins, sans-serif") {
|
|
console.log('Passed: Total item count button text font matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Total item count button text font "Poppins, sans-serif"; Actual: ${elementTextFont}`);
|
|
}
|
|
|
|
//font size
|
|
if (elementTextSize === '13.5px') {
|
|
console.log('Passed: Total item count button text font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Total item count button text font-size "13.5px"; Actual: "${elementTextSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementTextColor === 'rgba(255, 255, 255, 1)') {
|
|
console.log('Passed: Total item count button text color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Total item count button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`);
|
|
}
|
|
|
|
//button color
|
|
if (elementButtonColor === 'rgba(40, 39, 90, 1)') {
|
|
console.log('Passed: Total item count button background color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Total item count button background color: "rgba(40, 39, 90, 1)"; Actual: "${elementButtonColor}"`);
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//My Content - Ellipsis icon color
|
|
{
|
|
description: 'My Content Ellipsis icon color',
|
|
action: async () => {
|
|
const elementStyle = await driver.findElement(By.css('.fa-ellipsis-h')).getCssValue('color');
|
|
if (elementStyle === 'rgba(40, 39, 90, 1)') {
|
|
console.log('Passed: My Content Ellipsis icon color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: My Content Ellipsis icon color did not match; Actual: "${elementStyle}"`);
|
|
}
|
|
}
|
|
},
|
|
|
|
//My Content - filter row
|
|
//Filter textbox placeholder
|
|
{
|
|
description: 'Filter placeholder text',
|
|
action: async () => {
|
|
const multipleChecks = 'Filter textbox';
|
|
|
|
const elementIcon = await driver.findElement(By.css('.col-12 > .fa')).getCssValue('color');
|
|
const element = await driver.findElement(By.css('#content-org-filter'));
|
|
|
|
//Get text, font, size, and color
|
|
const elementText = await element.getAttribute('placeholder');
|
|
|
|
//filter icon color
|
|
if (elementIcon === 'rgba(40, 39, 90, 1)') {
|
|
console.log('Passed: Filter icon color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Filter icon color did not match; Actual: "${elementIcon}"`);
|
|
}
|
|
|
|
//Get placeholder styles via executeScript since it's a pseudo-element
|
|
const elementFont = await driver.executeScript(
|
|
`return window.getComputedStyle(arguments[0], '::placeholder').getPropertyValue('font-family')`,
|
|
element
|
|
);
|
|
|
|
const elementSize = await driver.executeScript(
|
|
`return window.getComputedStyle(arguments[0], '::placeholder').getPropertyValue('font-size')`,
|
|
element
|
|
);
|
|
|
|
const elementColor = await driver.executeScript(
|
|
`return window.getComputedStyle(arguments[0], '::placeholder').getPropertyValue('color')`,
|
|
element
|
|
);
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//text
|
|
if (elementText === 'filter...') {
|
|
console.log('Passed: Filter placeholder text matched as expected');
|
|
} else {
|
|
errors.push(`Expected: "filter..." placeholder; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//font-family
|
|
if (elementFont === "Poppins, sans-serif") {
|
|
console.log('Passed: Filter placeholder text font matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Filter placeholder text font "Poppins, sans-serif"; Actual: ${elementFont}`);
|
|
}
|
|
|
|
//font size
|
|
if (elementSize === '13.5px') {
|
|
console.log('Passed: Filter placeholder text font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Filter placeholder text font-size "13.5px"; Actual: "${elementSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementColor === 'rgb(108, 117, 125)') {
|
|
console.log('Passed: Filter placeholder text color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Filter placeholder text color: "rgb(108, 117, 125)"; Actual: "${elementColor}"`);
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Sort label
|
|
{
|
|
description: 'My Sort label',
|
|
action: async () => {
|
|
const multipleChecks = 'Sort label';
|
|
|
|
const element = await driver.findElement(By.css('.col-4'));
|
|
|
|
//Get text, font, size, and color
|
|
const elementText = await element.getText('');
|
|
const elementTextFont = await element.getCssValue('font-family');
|
|
const elementTextSize = await element.getCssValue('font-size');
|
|
const elementTextColor = await element.getCssValue('color');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//text
|
|
if (elementText === 'Sort:') {
|
|
console.log('Passed: Sort: label text matched as expected');
|
|
} else {
|
|
errors.push(`Expected: "Sort:" label; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//font-family
|
|
if (elementTextFont === "Poppins, sans-serif") {
|
|
console.log('Passed: Sort: label text font matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Sort: label text font "Poppins, sans-serif"; Actual: ${elementTextFont}`);
|
|
}
|
|
|
|
//font size
|
|
if (elementTextSize === '15px') {
|
|
console.log('Passed: Sort: label text font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Sort: label text font-size "15px"; Actual: "${elementTextSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementTextColor === 'rgba(40, 39, 90, 1)') {
|
|
console.log('Passed: Sort: label text color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Sort: label text color: "rgba(40, 39, 90, 1)"; Actual: "${elementTextColor}"`);
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Sort dropdown values
|
|
{
|
|
description: 'Sort dropdown values',
|
|
action: async () => {
|
|
const multipleChecks = 'Sort dropdown values';
|
|
|
|
const dropdown = await driver.wait(until.elementLocated(By.css('#orgsort')), 5000);
|
|
|
|
//Wrap with Select class for full dropdown functionality
|
|
const selectElement = new Select(dropdown);
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//Verify default selected value
|
|
const defaultOption = await selectElement.getFirstSelectedOption();
|
|
const defaultText = await defaultOption.getText();
|
|
|
|
if (defaultText === 'Count') {
|
|
console.log('Passed: Sort: dropdown default value matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Sort dropdown default value "Count"; Actual: "${defaultText}"`);
|
|
}
|
|
|
|
//Verify all dropdown options
|
|
const options = await selectElement.getOptions();
|
|
const expected = [
|
|
'Count',
|
|
'Name'
|
|
];
|
|
|
|
const actual = [];
|
|
for (const opt of options) {
|
|
const text = (await opt.getText()).trim();
|
|
actual.push(text);
|
|
}
|
|
|
|
if (JSON.stringify(actual) === JSON.stringify(expected)) {
|
|
console.log('Passed: Sort: dropdown list matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Sort dropdown list: ${JSON.stringify(expected)}; Actual: ${JSON.stringify(actual)}`);
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//My Content - Sort by Count (default)
|
|
{
|
|
description: 'sort order by Count',
|
|
action: async () => {
|
|
const multipleChecks = 'My Content - Sort order by Count';
|
|
|
|
const errors = [];
|
|
|
|
const rows = await driver.executeScript(`
|
|
const results = [];
|
|
const items = document.querySelectorAll('#mycontentlist .orgname');
|
|
items.forEach((item, index) => {
|
|
const nameLink = item.querySelector('a:first-child');
|
|
const name = nameLink ? nameLink.textContent.trim() : '';
|
|
const editLink = item.querySelector('a.ml-2');
|
|
const href = editLink ? editLink.getAttribute('href') : '';
|
|
const countSpan = item.closest('li').querySelector('.badge.contnet_set_count');
|
|
const count = countSpan ? countSpan.textContent.trim() : '';
|
|
results.push({ position: index + 1, name, href, count });
|
|
});
|
|
return results;
|
|
`);
|
|
|
|
const expected = [
|
|
{ position: 1, name: 'Biology', count: '1493', href: '/exact/contentset_edit_modal.php?id=585821587' },
|
|
{ position: 2, name: 'Khan URL test', count: '1118', href: '/exact/contentset_edit_modal.php?id=1474381884' },
|
|
{ position: 3, name: 'Math Alignment Import Test', count: '730', href: '/exact/contentset_edit_modal.php?id=1423792414' },
|
|
{ position: 4, name: 'English I', count: '388', href: '/exact/contentset_edit_modal.php?id=585821585' },
|
|
{ position: 5, name: 'Copy Move Delete Test 2', count: '327', href: '/exact/contentset_edit_modal.php?id=1228574325' },
|
|
{ position: 6, name: 'Post NIght July26', count: '278', href: '/exact/contentset_edit_modal.php?id=1476789487' },
|
|
{ position: 7, name: 'Algebra', count: '194', href: '/exact/contentset_edit_modal.php?id=585821586' },
|
|
{ position: 8, name: 'seesaw test', count: '156', href: '/exact/contentset_edit_modal.php?id=1476742363' },
|
|
{ position: 9, name: 'US History III', count: '68', href: '/exact/contentset_edit_modal.php?id=585821589' },
|
|
{ position: 10, name: 'Import Align - Concept Based 1', count: '44', href: '/exact/contentset_edit_modal.php?id=1323320445' },
|
|
{ position: 11, name: 'Import Align - Concept Based 2', count: '44', href: '/exact/contentset_edit_modal.php?id=1323322624' },
|
|
{ position: 12, name: 'Import Align - Direct Align 1', count: '44', href: '/exact/contentset_edit_modal.php?id=1323322921' },
|
|
{ position: 13, name: 'Import Align - Direct Align 2', count: '44', href: '/exact/contentset_edit_modal.php?id=1323322923' },
|
|
{ position: 14, name: 'Copy Move Delete Test 1', count: '35', href: '/exact/contentset_edit_modal.php?id=1228574323' },
|
|
{ position: 15, name: 'ECS-3037 On Prod TC2', count: '26', href: '/exact/contentset_edit_modal.php?id=1473840373' },
|
|
{ position: 16, name: 'ECS-3037 On Prod TC1', count: '24', href: '/exact/contentset_edit_modal.php?id=1473840197' },
|
|
{ position: 17, name: 'create me', count: '9', href: '/exact/contentset_edit_modal.php?id=1427607301' },
|
|
{ position: 18, name: 'Illustrative Math Test 1', count: '5', href: '/exact/contentset_edit_modal.php?id=1473839901' },
|
|
{ position: 19, name: 'Illustrative Math Test 2', count: '5', href: '/exact/contentset_edit_modal.php?id=1473840078' },
|
|
{ position: 20, name: 'webinar test', count: '5', href: '/exact/contentset_edit_modal.php?id=1476429225' },
|
|
{ position: 21, name: 'create import test', count: '3', href: '/exact/contentset_edit_modal.php?id=1478966441' },
|
|
{ position: 22, name: 'New One For Agust Post Night', count: '0', href: '/exact/contentset_edit_modal.php?id=1478966652' }
|
|
];
|
|
|
|
for (const exp of expected) {
|
|
const actual = rows[exp.position - 1];
|
|
if (!actual) {
|
|
errors.push(`Position ${exp.position}: row not found`);
|
|
continue;
|
|
}
|
|
|
|
const nameMatch = actual.name === exp.name;
|
|
const countMatch = actual.count === exp.count;
|
|
//Use includes() for href if exp.hrefContains is defined, otherwise exact match
|
|
const hrefMatch = exp.hrefContains
|
|
? actual.href.includes(exp.hrefContains)
|
|
: actual.href === exp.href;
|
|
|
|
if (nameMatch && countMatch && hrefMatch) {
|
|
console.log(`Passed: Sort Order ${exp.position} - ${exp.name} | Count: ${exp.count} | href | All matched as expected`);
|
|
} else {
|
|
if (!nameMatch) errors.push(`Sort Order ${exp.position} name - Expected: "${exp.name}"; Actual: "${actual.name}"`);
|
|
if (!countMatch) errors.push(`Sort Order ${exp.position} count - Expected: "${exp.count}"; Actual: "${actual.count}"`);
|
|
if (!hrefMatch) errors.push(`Sort Order ${exp.position} href - Expected: "${exp.href}"; Actual: "${actual.href}"`);
|
|
}
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//MY STANDARDS WIDGET
|
|
//My Standards Widget title (active)
|
|
{
|
|
description: 'My Standards Widget title text, color, and size',
|
|
action: async () => {
|
|
const multipleChecks = 'My Standards Widget title (active)';
|
|
|
|
const element = await driver.findElement(By.css('#mystd-tab'));
|
|
|
|
//Get text, font, size, and color
|
|
const elementText = await element.getText();
|
|
const elementFont = await element.getCssValue('font-family');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
const elementColor = await element.getCssValue('color');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//text
|
|
if (elementText === 'My Standards') {
|
|
console.log('Passed: My Standards Widget title matched as expected');
|
|
} else {
|
|
errors.push(`Expected: My Standards; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//font
|
|
if (elementFont === `Poppins, sans-serif`) {
|
|
console.log('Passed: My Standards Widget title font-family matched as expected');
|
|
} else {
|
|
errors.push(`Expected: My Standards Widget title font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
|
|
}
|
|
|
|
//size
|
|
if (elementSize === '15px') {
|
|
console.log('Passed: My Standards Widget title text font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: My Standards Widget title text font-size "15px"; Actual: "${elementSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementColor === 'rgba(40, 39, 90, 1)') {
|
|
console.log('Passed: My Standards Widget title text color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: My Standards Widget title text color "rgba(40, 39, 90, 1)"; Actual: "${elementColor}"`);
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//My Standards - Other Available Standards tab title
|
|
{
|
|
description: 'Other Available Standards tab title text, color, and size',
|
|
action: async () => {
|
|
const multipleChecks = 'Other Available Standards tab title';
|
|
|
|
const element = await driver.findElement(By.css('#availstd-tab'));
|
|
|
|
//Get text, font, size, and color
|
|
const elementText = await element.getText();
|
|
const elementFont = await element.getCssValue('font-family');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
const elementColor = await element.getCssValue('color');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//text
|
|
if (elementText === 'Other Available Standards') {
|
|
console.log('Passed: Other Available Standards tab title matched as expected');
|
|
} else {
|
|
errors.push(`Expected: "Other Available Standards"; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//font
|
|
if (elementFont === `Poppins, sans-serif`) {
|
|
console.log('Passed: Other Available Standards tab title font-family matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Other Available Standards tab title font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
|
|
}
|
|
|
|
//size
|
|
if (elementSize === '15px') {
|
|
console.log('Passed: Other Available Standards tab title text font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Other Available Standards tab title text font-size "15px"; Actual: "${elementSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementColor === 'rgba(182, 186, 181, 1)') {
|
|
console.log('Passed: Other Available Standards tab title text color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Other Available Standards tab title text color "rgba(182, 186, 181, 1)"'; Actual: "${elementColor}"`);
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//My Standards dropdown
|
|
{
|
|
description: 'My Standards dropdown list and value',
|
|
action: async () => {
|
|
const multipleChecks = 'My Standards dropdown list';
|
|
|
|
const elementDropdown = await driver.findElement(By.css('#stdparent'));
|
|
const selectedOption = await elementDropdown.findElement(By.css('option:checked'));
|
|
|
|
const elementText = await selectedOption.getText();
|
|
const elementFont = await selectedOption.getCssValue('font-family');
|
|
const elementSize = await selectedOption.getCssValue('font-size');
|
|
const elementColor = await selectedOption.getCssValue('color');
|
|
|
|
const options = await elementDropdown.findElements(By.css('option'));
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//text
|
|
if (elementText === 'United States Standards') {
|
|
console.log('Passed: My Standards dropdown text matched as expected');
|
|
} else {
|
|
throw new Error(`Expected: My Standards: "United States Standards"; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//font
|
|
if (elementFont === "Poppins, sans-serif") {
|
|
console.log('Passed: My Standards dropdown font-family matched as expected');
|
|
} else {
|
|
errors.push(`Expected: My Standards dropdown font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
|
|
}
|
|
|
|
//size
|
|
if (elementSize === '13px') {
|
|
console.log('Passed: My Standards dropdown font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: My Standards dropdown font-size "13px"; Actual: "${elementSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementColor === 'rgba(40, 39, 90, 1)') {
|
|
console.log('Passed: My Standards dropdown color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: My Standards dropdown color: "rgba(40, 39, 90, 1)"; Actual: "${elementColor}"`);
|
|
}
|
|
|
|
const expected = [
|
|
'ACTFL',
|
|
'Australia',
|
|
'California',
|
|
'Canada',
|
|
'Common Core Standards',
|
|
'Creating Org',
|
|
'Demo Client Standards',
|
|
'Demo Standards',
|
|
'New Folder',
|
|
'QA Client Test Frameworks',
|
|
'United States Standards',
|
|
'WIDA'
|
|
];
|
|
|
|
const actual = [];
|
|
|
|
for (const opt of options) {
|
|
const text = (await opt.getText()).trim();
|
|
actual.push(text);
|
|
}
|
|
|
|
if (JSON.stringify(actual) === JSON.stringify(expected)) {
|
|
console.log('Passed: My Standards dropdown list matched as expected');
|
|
} else {
|
|
throw new Error(`Expected: My Standards dropdown list: ${JSON.stringify(expected)}, Actual: ${JSON.stringify(actual)}`);
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//My Standards - Organization column title
|
|
{
|
|
description: 'My Standards - Organization column title, text, and font size',
|
|
action: async () => {
|
|
const multipleChecks = 'My Standards - Organization column title'
|
|
|
|
const element = await driver.findElement(By.css('.table:nth-child(2) th:nth-child(1)'));
|
|
|
|
//Get text, font, size, and color
|
|
const elementText = await element.getText();
|
|
const elementFont = await element.getCssValue('font-family');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
const elementColor = await element.getCssValue('color');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//text
|
|
if (elementText === 'Organization') {
|
|
console.log('Passed: My Standards - Organization column title matched as expected');
|
|
} else {
|
|
errors.push(`Expected: My Standards - "Organization" column title; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//font
|
|
if (elementFont === "Poppins, sans-serif") {
|
|
console.log('Passed: My Standards - Organization column title font-family matched as expected');
|
|
} else {
|
|
errors.push(`Expected: My Standards - Organization column title font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
|
|
}
|
|
|
|
//size
|
|
if (elementSize === '14px') {
|
|
console.log('Passed: My Standards - Organization column title text font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: My Standards - Organization column title text font-size "14px"; Actual: "${elementSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementColor === 'rgba(94, 105, 116, 1)') {
|
|
console.log('Passed: My Standards - Organization column title text color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: My Standards - Organization column title text color "rgba(94, 105, 116, 1)"'; Actual: "${elementColor}"`);
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//My Standards - Export column title
|
|
{
|
|
description: 'My Standards - Export column title, text, and font size',
|
|
action: async () => {
|
|
const multipleChecks = 'My Standards - Export column title';
|
|
|
|
const element = await driver.findElement(By.css('.table:nth-child(2) > thead .text-center:nth-child(2)'));
|
|
|
|
//Get text, font, size, and color
|
|
const elementText = await element.getText();
|
|
const elementFont = await element.getCssValue('font-family');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
const elementColor = await element.getCssValue('color');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//text
|
|
if (elementText === 'Export') {
|
|
console.log('Passed: My Standards - Export column title matched as expected');
|
|
} else {
|
|
errors.push(`Expected: My Standards - "Export" column title; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//font
|
|
if (elementFont === "Poppins, sans-serif") {
|
|
console.log('Passed: My Standards - Export column title font-family matched as expected');
|
|
} else {
|
|
errors.push(`Expected: My Standards - Export column title font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
|
|
}
|
|
|
|
//size
|
|
if (elementSize === '14px') {
|
|
console.log('Passed: My Standards - Export column title text font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: My Standards - Export column title text font-size "14px"; Actual: "${elementSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementColor === 'rgba(94, 105, 116, 1)') {
|
|
console.log('Passed: My Standards - Export column title text color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: My Standards - Export column title text color "rgba(94, 105, 116, 1)"'; Actual: "${elementColor}"`);
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//My Standards - Manage column title
|
|
{
|
|
description: 'My Standards - Manage column title, text, and font size',
|
|
action: async () => {
|
|
const multipleChecks = 'My Standards - Manage column title';
|
|
|
|
const element = await driver.findElement(By.css('.text-center:nth-child(3)'));
|
|
|
|
//Get text, font, size, and color
|
|
const elementText = await element.getText();
|
|
const elementFont = await element.getCssValue('font-family');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
const elementColor = await element.getCssValue('color');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//text
|
|
if (elementText === 'Manage') {
|
|
console.log('Passed: My Standards - Manage column title matched as expected');
|
|
} else {
|
|
errors.push(`Expected: My Standards - "Manage" column title; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//font
|
|
if (elementFont === "Poppins, sans-serif") {
|
|
console.log('Passed: My Standards - Manage column title font-family matched as expected');
|
|
} else {
|
|
errors.push(`Expected: My Standards - Manage column title font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
|
|
}
|
|
|
|
//size
|
|
if (elementSize === '14px') {
|
|
console.log('Passed: My Standards - Manage column title text font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: My Standards - Manage column title text font-size "14px"; Actual: "${elementSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementColor === 'rgba(94, 105, 116, 1)') {
|
|
console.log('Passed: My Standards - Manage column title text color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: My Standards Manage column title text color "rgba(94, 105, 116, 1)"'; Actual: "${elementColor}"`);
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//My Standards - More Info column title
|
|
{
|
|
description: 'My Standards - More Info column title, text, and font size',
|
|
action: async () => {
|
|
const multipleChecks = 'My Standards - More Info column title';
|
|
|
|
const element = await driver.findElement(By.css('.table-sm > thead .text-center:nth-child(4)'));
|
|
|
|
//Get text, font, size, and color
|
|
const elementText = await element.getText();
|
|
const elementFont = await element.getCssValue('font-family');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
const elementColor = await element.getCssValue('color');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//text
|
|
if (elementText === 'More Info') {
|
|
console.log('Passed: My Standards - More Info column title matched as expected');
|
|
} else {
|
|
errors.push(`Expected: My Standards - "More Info" column title; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//font
|
|
if (elementFont === "Poppins, sans-serif") {
|
|
console.log('Passed: My Standards - More Info column title font-family matched as expected');
|
|
} else {
|
|
errors.push(`Expected: My Standards - More Info column title font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
|
|
}
|
|
|
|
//size
|
|
if (elementSize === '14px') {
|
|
console.log('Passed: My Standards - More Info column title text font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: My Standards - More Info column title text font-size "14px"; Actual: "${elementSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementColor === 'rgba(94, 105, 116, 1)') {
|
|
console.log('Passed: My Standards - More Info column title text color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: My Standards - More Info column title text color "rgba(94, 105, 116, 1)"'; Actual: "${elementColor}"`);
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//My Standards - View column title
|
|
{
|
|
description: 'My Standards - View column title, text, and font size',
|
|
action: async () => {
|
|
const multipleChecks = 'My Standards - View column title';
|
|
|
|
const element = await driver.findElement(By.css('thead .text-center:nth-child(5)'));
|
|
|
|
//Get text, font, size, and color
|
|
const elementText = await element.getText();
|
|
const elementFont = await element.getCssValue('font-family');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
const elementColor = await element.getCssValue('color');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//text
|
|
if (elementText === 'View') {
|
|
console.log('Passed: My Standards - View column title matched as expected');
|
|
} else {
|
|
errors.push(`Expected: My Standards - "View" column title; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//font
|
|
if (elementFont === "Poppins, sans-serif") {
|
|
console.log('Passed: My Standards - View column title font-family matched as expected');
|
|
} else {
|
|
errors.push(`Expected: My Standards - View column title font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
|
|
}
|
|
|
|
//size
|
|
if (elementSize === '14px') {
|
|
console.log('Passed: My Standards - View column title text font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: My Standards - View column title text font-size "14px"; Actual: "${elementSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementColor === 'rgba(94, 105, 116, 1)') {
|
|
console.log('Passed: My Standards - View column title text color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: My Standards - View column title text color "rgba(94, 105, 116, 1)"'; Actual: "${elementColor}"`);
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//My Standards = Alabama
|
|
{
|
|
description: 'My Standards - Organization = Alabama Standards text',
|
|
action: async () => {
|
|
const multipleChecks = 'My Standards - Organization = Alabama';
|
|
|
|
const element = await driver.findElement(By.css('#stdbody > tr:nth-child(1) > td:nth-child(1)'));
|
|
|
|
//Get text, font, color, and size
|
|
const elementText = await element.getText('');
|
|
const elementFont = await element.getCssValue('font-family');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
const elementColor = await element.getCssValue('color');
|
|
|
|
const elementExportIcon = await driver.findElement(By.css('#stdbody > tr:nth-child(1) > .text-center:nth-child(2) img'));
|
|
const elementMoreInfoIconTooltip = await driver.findElement(By.css('#stdbody > tr:nth-child(1) > td:nth-child(4) > a')).getAttribute('title');
|
|
const elementViewIcon = await driver.findElement(By.css('tr:nth-child(1) > .text-center:nth-child(5) img'));
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//text
|
|
if (elementText === 'Alabama') {
|
|
console.log("Passed: My Standards - Organization = Alabama text matched as expected");
|
|
} else {
|
|
throw new Error(`Expected: My Standards - Organization = "Alabama"; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//font
|
|
if (elementFont === "Poppins, sans-serif") {
|
|
console.log('Passed: My Standards - Organization = Alabama text font-family matched as expected');
|
|
} else {
|
|
errors.push(`Expected: My Standards - Organization = Alabama text font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
|
|
}
|
|
|
|
//size
|
|
if (elementSize === '14.3px') {
|
|
console.log('Passed: My Standards - Organization = Alabama text font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: My Standards - Organization = Alabama text font-size "14.3px"; Actual: "${elementSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementColor === 'rgba(33, 37, 41, 1)') {
|
|
console.log('Passed: My Standards - Organization = Alabama text color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: My Standards - Organization = Alabama text color: "rgba(33, 37, 41, 1)"; Actual: "${elementColor}"`);
|
|
}
|
|
|
|
//export icon
|
|
if (elementExportIcon) {
|
|
console.log('Passed: My Standards - Organization = Alabama - Export icon is present');
|
|
} else {
|
|
errors.push('Expected: My Standards - Organization = Alabama - Export icon not found');
|
|
}
|
|
|
|
//more info icon tool-tip
|
|
if (elementMoreInfoIconTooltip === 'View Detail Information') {
|
|
console.log('Passed: My Standards - Organization = Alabama icon tool-tip text matched as expected');
|
|
} else {
|
|
errors.push(`Expected: My Standards - Organization = Alabama: "View Detail Information"; Actual: "${elementMoreInfoIconTooltip}"`);
|
|
}
|
|
|
|
//view icon
|
|
if (elementViewIcon) {
|
|
console.log('Passed: My Standards - Organization = Alabama - View icon is present');
|
|
} else {
|
|
errors.push('Expected: My Standards - Organization = Alabama - View icon not found');
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//My Standards = Arizona
|
|
{
|
|
description: 'My Standards - Organization = Arizona Standards text',
|
|
action: async () => {
|
|
const multipleChecks = 'My Standards - Organization = Arizona';
|
|
|
|
const element = await driver.findElement(By.css('#stdbody > tr:nth-child(2) > td:nth-child(1)'));
|
|
|
|
//Get text, font, color, and size
|
|
const elementText = await element.getText('');
|
|
const elementFont = await element.getCssValue('font-family');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
const elementColor = await element.getCssValue('color');
|
|
|
|
const elementExportIcon = await driver.findElement(By.css('#stdbody > tr:nth-child(2) > .text-center:nth-child(2) img'));
|
|
const elementMoreInfoIconTooltip = await driver.findElement(By.css('#stdbody > tr:nth-child(2) > td:nth-child(4) > a')).getAttribute('title');
|
|
const elementViewIcon = await driver.findElement(By.css('tr:nth-child(2) > .text-center:nth-child(5) img'));
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//text
|
|
if (elementText === 'Arizona') {
|
|
console.log("Passed: My Standards - Organization = Arizona text matched as expected");
|
|
} else {
|
|
throw new Error(`Expected: My Standards - Organization = "Arizona"; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//font
|
|
if (elementFont === "Poppins, sans-serif") {
|
|
console.log('Passed: My Standards - Organization = Arizona text font-family matched as expected');
|
|
} else {
|
|
errors.push(`Expected: My Standards - Organization = Arizona text font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
|
|
}
|
|
|
|
//size
|
|
if (elementSize === '14.3px') {
|
|
console.log('Passed: My Standards - Organization = Arizona text font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: My Standards - Organization = Arizona text font-size "14.3px"; Actual: "${elementSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementColor === 'rgba(33, 37, 41, 1)') {
|
|
console.log('Passed: My Standards - Organization = Arizona text color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: My Standards - Organization = Arizona text color: "rgba(33, 37, 41, 1)"; Actual: "${elementColor}"`);
|
|
}
|
|
|
|
//export icon
|
|
if (elementExportIcon) {
|
|
console.log('Passed: My Standards - Organization = Arizona - Export icon is present');
|
|
} else {
|
|
errors.push('Expected: My Standards - Organization = Arizona - Export icon not found');
|
|
}
|
|
|
|
//more info icon tool-tip
|
|
if (elementMoreInfoIconTooltip === 'View Detail Information') {
|
|
console.log('Passed: My Standards - Organization = Arizona icon tool-tip text matched as expected');
|
|
} else {
|
|
errors.push(`Expected: My Standards - Organization = Arizona: "View Detail Information"; Actual: "${elementMoreInfoIconTooltip}"`);
|
|
}
|
|
|
|
//view icon
|
|
if (elementViewIcon) {
|
|
console.log('Passed: My Standards - Organization = Arizona - View icon is present');
|
|
} else {
|
|
errors.push('Expected: My Standards - Organization = Arizona - View icon not found');
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//My Standards = California
|
|
{
|
|
description: 'My Standards - Organization = California Standards text',
|
|
action: async () => {
|
|
const multipleChecks = 'My Standards - Organization = California';
|
|
|
|
const element = await driver.findElement(By.css('#stdbody > tr:nth-child(3) > td:nth-child(1)'));
|
|
|
|
//Get text, font, color, and size
|
|
const elementText = await element.getText('');
|
|
const elementFont = await element.getCssValue('font-family');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
const elementColor = await element.getCssValue('color');
|
|
|
|
const elementExportIcon = await driver.findElement(By.css('#stdbody > tr:nth-child(3) > .text-center:nth-child(2) img'));
|
|
const elementMoreInfoIconTooltip = await driver.findElement(By.css('#stdbody > tr:nth-child(3) > td:nth-child(4) > a')).getAttribute('title');
|
|
const elementViewIcon = await driver.findElement(By.css('tr:nth-child(3) > .text-center:nth-child(5) img'));
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//text
|
|
if (elementText === 'California') {
|
|
console.log("Passed: My Standards - Organization = California text matched as expected");
|
|
} else {
|
|
throw new Error(`Expected: My Standards - Organization = "California"; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//font
|
|
if (elementFont === "Poppins, sans-serif") {
|
|
console.log('Passed: My Standards - Organization = California text font-family matched as expected');
|
|
} else {
|
|
errors.push(`Expected: My Standards - Organization = California text font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
|
|
}
|
|
|
|
//size
|
|
if (elementSize === '14.3px') {
|
|
console.log('Passed: My Standards - Organization = California text font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: My Standards - Organization = California text font-size "14.3px"; Actual: "${elementSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementColor === 'rgba(33, 37, 41, 1)') {
|
|
console.log('Passed: My Standards - Organization = California text color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: My Standards - Organization = California text color: "rgba(33, 37, 41, 1)"; Actual: "${elementColor}"`);
|
|
}
|
|
|
|
//export icon
|
|
if (elementExportIcon) {
|
|
console.log('Passed: My Standards - Organization = California - Export icon is present');
|
|
} else {
|
|
errors.push('Expected: My Standards - Organization = California - Export icon not found');
|
|
}
|
|
|
|
//more info icon tool-tip
|
|
if (elementMoreInfoIconTooltip === 'View Detail Information') {
|
|
console.log('Passed: My Standards - Organization = California icon tool-tip text matched as expected');
|
|
} else {
|
|
errors.push(`Expected: My Standards - Organization = California: "View Detail Information"; Actual: "${elementMoreInfoIconTooltip}"`);
|
|
}
|
|
|
|
//view icon
|
|
if (elementViewIcon) {
|
|
console.log('Passed: My Standards - Organization = California - View icon is present');
|
|
} else {
|
|
errors.push('Expected: My Standards - Organization = California - View icon not found');
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//My Standards = Florida
|
|
{
|
|
description: 'My Standards - Organization = Florida Standards text',
|
|
action: async () => {
|
|
const multipleChecks = 'My Standards - Organization = Florida';
|
|
|
|
const element = await driver.findElement(By.css('#stdbody > tr:nth-child(4) > td:nth-child(1)'));
|
|
|
|
//Get text, font, color, and size
|
|
const elementText = await element.getText('');
|
|
const elementFont = await element.getCssValue('font-family');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
const elementColor = await element.getCssValue('color');
|
|
|
|
const elementExportIcon = await driver.findElement(By.css('#stdbody > tr:nth-child(4) > .text-center:nth-child(2) img'));
|
|
const elementMoreInfoIconTooltip = await driver.findElement(By.css('#stdbody > tr:nth-child(4) > td:nth-child(4) > a')).getAttribute('title');
|
|
const elementViewIcon = await driver.findElement(By.css('tr:nth-child(4) > .text-center:nth-child(5) img'));
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//text
|
|
if (elementText === 'Florida') {
|
|
console.log("Passed: My Standards - Organization = Florida text matched as expected");
|
|
} else {
|
|
throw new Error(`Expected: My Standards - Organization = "Florida"; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//font
|
|
if (elementFont === "Poppins, sans-serif") {
|
|
console.log('Passed: My Standards - Organization = Florida text font-family matched as expected');
|
|
} else {
|
|
errors.push(`Expected: My Standards - Organization = Florida text font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
|
|
}
|
|
|
|
//size
|
|
if (elementSize === '14.3px') {
|
|
console.log('Passed: My Standards - Organization = Florida text font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: My Standards - Organization = Florida text font-size "14.3px"; Actual: "${elementSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementColor === 'rgba(33, 37, 41, 1)') {
|
|
console.log('Passed: My Standards - Organization = Florida text color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: My Standards - Organization = Florida text color: "rgba(33, 37, 41, 1)"; Actual: "${elementColor}"`);
|
|
}
|
|
|
|
//export icon
|
|
if (elementExportIcon) {
|
|
console.log('Passed: My Standards - Organization = Florida - Export icon is present');
|
|
} else {
|
|
errors.push('Expected: My Standards - Organization = Florida - Export icon not found');
|
|
}
|
|
|
|
//more info icon tool-tip
|
|
if (elementMoreInfoIconTooltip === 'View Detail Information') {
|
|
console.log('Passed: My Standards - Organization = Florida icon tool-tip text matched as expected');
|
|
} else {
|
|
errors.push(`Expected: My Standards - Organization = Florida: "View Detail Information"; Actual: "${elementMoreInfoIconTooltip}"`);
|
|
}
|
|
|
|
//view icon
|
|
if (elementViewIcon) {
|
|
console.log('Passed: My Standards - Organization = Florida - View icon is present');
|
|
} else {
|
|
errors.push('Expected: My Standards - Organization = Florida - View icon not found');
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//My Standards = Georgia
|
|
{
|
|
description: 'My Standards - Organization = Georgia Standards text',
|
|
action: async () => {
|
|
const multipleChecks = 'My Standards - Organization = Georgia';
|
|
|
|
const element = await driver.findElement(By.css('#stdbody > tr:nth-child(5) > td:nth-child(1)'));
|
|
|
|
//Get text, font, color, and size
|
|
const elementText = await element.getText('');
|
|
const elementFont = await element.getCssValue('font-family');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
const elementColor = await element.getCssValue('color');
|
|
|
|
const elementExportIcon = await driver.findElement(By.css('#stdbody > tr:nth-child(5) > .text-center:nth-child(2) img'));
|
|
const elementMoreInfoIconTooltip = await driver.findElement(By.css('#stdbody > tr:nth-child(5) > td:nth-child(4) > a')).getAttribute('title');
|
|
const elementViewIcon = await driver.findElement(By.css('tr:nth-child(5) > .text-center:nth-child(5) img'));
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//text
|
|
if (elementText === 'Georgia') {
|
|
console.log("Passed: My Standards - Organization = Georgia text matched as expected");
|
|
} else {
|
|
throw new Error(`Expected: My Standards - Organization = "Georgia"; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//font
|
|
if (elementFont === "Poppins, sans-serif") {
|
|
console.log('Passed: My Standards - Organization = Georgia text font-family matched as expected');
|
|
} else {
|
|
errors.push(`Expected: My Standards - Organization = Georgia text font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
|
|
}
|
|
|
|
//size
|
|
if (elementSize === '14.3px') {
|
|
console.log('Passed: My Standards - Organization = Georgia text font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: My Standards - Organization = Georgia text font-size "14.3px"; Actual: "${elementSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementColor === 'rgba(33, 37, 41, 1)') {
|
|
console.log('Passed: My Standards - Organization = Georgia text color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: My Standards - Organization = Georgia text color: "rgba(33, 37, 41, 1)"; Actual: "${elementColor}"`);
|
|
}
|
|
|
|
//export icon
|
|
if (elementExportIcon) {
|
|
console.log('Passed: My Standards - Organization = Georgia - Export icon is present');
|
|
} else {
|
|
errors.push('Expected: My Standards - Organization = Georgia - Export icon not found');
|
|
}
|
|
|
|
//more info icon tool-tip
|
|
if (elementMoreInfoIconTooltip === 'View Detail Information') {
|
|
console.log('Passed: My Standards - Organization = Georgia icon tool-tip text matched as expected');
|
|
} else {
|
|
errors.push(`Expected: My Standards - Organization = Georgia: "View Detail Information"; Actual: "${elementMoreInfoIconTooltip}"`);
|
|
}
|
|
|
|
//view icon
|
|
if (elementViewIcon) {
|
|
console.log('Passed: My Standards - Organization = Georgia - View icon is present');
|
|
} else {
|
|
errors.push('Expected: My Standards - Organization = Georgia - View icon not found');
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//My Standards = Illinois
|
|
{
|
|
description: 'My Standards - Organization = Illinois Standards text',
|
|
action: async () => {
|
|
const multipleChecks = 'My Standards - Organization = Illinois';
|
|
|
|
const element = await driver.findElement(By.css('#stdbody > tr:nth-child(6) > td:nth-child(1)'));
|
|
|
|
//Get text, font, color, and size
|
|
const elementText = await element.getText('');
|
|
const elementFont = await element.getCssValue('font-family');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
const elementColor = await element.getCssValue('color');
|
|
|
|
const elementExportIcon = await driver.findElement(By.css('#stdbody > tr:nth-child(6) > .text-center:nth-child(2) img'));
|
|
const elementMoreInfoIconTooltip = await driver.findElement(By.css('#stdbody > tr:nth-child(6) > td:nth-child(4) > a')).getAttribute('title');
|
|
const elementViewIcon = await driver.findElement(By.css('tr:nth-child(6) > .text-center:nth-child(5) img'));
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//text
|
|
if (elementText === 'Illinois') {
|
|
console.log("Passed: My Standards - Organization = Illinois text matched as expected");
|
|
} else {
|
|
throw new Error(`Expected: My Standards - Organization = "Illinois"; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//font
|
|
if (elementFont === "Poppins, sans-serif") {
|
|
console.log('Passed: My Standards - Organization = Illinois text font-family matched as expected');
|
|
} else {
|
|
errors.push(`Expected: My Standards - Organization = Illinois text font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
|
|
}
|
|
|
|
//size
|
|
if (elementSize === '14.3px') {
|
|
console.log('Passed: My Standards - Organization = Illinois text font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: My Standards - Organization = Illinois text font-size "14.3px"; Actual: "${elementSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementColor === 'rgba(33, 37, 41, 1)') {
|
|
console.log('Passed: My Standards - Organization = Illinois text color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: My Standards - Organization = Illinois text color: "rgba(33, 37, 41, 1)"; Actual: "${elementColor}"`);
|
|
}
|
|
|
|
//export icon
|
|
if (elementExportIcon) {
|
|
console.log('Passed: My Standards - Organization = Illinois - Export icon is present');
|
|
} else {
|
|
errors.push('Expected: My Standards - Organization = Illinois - Export icon not found');
|
|
}
|
|
|
|
//more info icon tool-tip
|
|
if (elementMoreInfoIconTooltip === 'View Detail Information') {
|
|
console.log('Passed: My Standards - Organization = Illinois icon tool-tip text matched as expected');
|
|
} else {
|
|
errors.push(`Expected: My Standards - Organization = Illinois: "View Detail Information"; Actual: "${elementMoreInfoIconTooltip}"`);
|
|
}
|
|
|
|
//view icon
|
|
if (elementViewIcon) {
|
|
console.log('Passed: My Standards - Organization = Illinois - View icon is present');
|
|
} else {
|
|
errors.push('Expected: My Standards - Organization = Illinois - View icon not found');
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//My Standards = New York
|
|
{
|
|
description: 'My Standards - Organization = New York Standards text',
|
|
action: async () => {
|
|
const multipleChecks = 'My Standards - Organization = New York';
|
|
|
|
const element = await driver.findElement(By.css('#stdbody > tr:nth-child(7) > td:nth-child(1)'));
|
|
|
|
//Get text, font, color, and size
|
|
const elementText = await element.getText('');
|
|
const elementFont = await element.getCssValue('font-family');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
const elementColor = await element.getCssValue('color');
|
|
|
|
const elementExportIcon = await driver.findElement(By.css('#stdbody > tr:nth-child(7) > .text-center:nth-child(2) img'));
|
|
const elementMoreInfoIconTooltip = await driver.findElement(By.css('#stdbody > tr:nth-child(7) > td:nth-child(4) > a')).getAttribute('title');
|
|
const elementViewIcon = await driver.findElement(By.css('tr:nth-child(7) > .text-center:nth-child(5) img'));
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//text
|
|
if (elementText === 'New York') {
|
|
console.log("Passed: My Standards - Organization = New York text matched as expected");
|
|
} else {
|
|
throw new Error(`Expected: My Standards - Organization = "New York"; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//font
|
|
if (elementFont === "Poppins, sans-serif") {
|
|
console.log('Passed: My Standards - Organization = New York text font-family matched as expected');
|
|
} else {
|
|
errors.push(`Expected: My Standards - Organization = New York text font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
|
|
}
|
|
|
|
//size
|
|
if (elementSize === '14.3px') {
|
|
console.log('Passed: My Standards - Organization = New York text font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: My Standards - Organization = New York text font-size "14.3px"; Actual: "${elementSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementColor === 'rgba(33, 37, 41, 1)') {
|
|
console.log('Passed: My Standards - Organization = New York text color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: My Standards - Organization = New York text color: "rgba(33, 37, 41, 1)"; Actual: "${elementColor}"`);
|
|
}
|
|
|
|
//export icon
|
|
if (elementExportIcon) {
|
|
console.log('Passed: My Standards - Organization = New York - Export icon is present');
|
|
} else {
|
|
errors.push('Expected: My Standards - Organization = New York - Export icon not found');
|
|
}
|
|
|
|
//more info icon tool-tip
|
|
if (elementMoreInfoIconTooltip === 'View Detail Information') {
|
|
console.log('Passed: My Standards - Organization = New York icon tool-tip text matched as expected');
|
|
} else {
|
|
errors.push(`Expected: My Standards - Organization = New York: "View Detail Information"; Actual: "${elementMoreInfoIconTooltip}"`);
|
|
}
|
|
|
|
//view icon
|
|
if (elementViewIcon) {
|
|
console.log('Passed: My Standards - Organization = New York - View icon is present');
|
|
} else {
|
|
errors.push('Expected: My Standards - Organization = New York - View icon not found');
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//My Standards = Texas
|
|
{
|
|
description: 'My Standards - Organization = Texas Standards text',
|
|
action: async () => {
|
|
const multipleChecks = 'My Standards - Organization = Texas';
|
|
|
|
const element = await driver.findElement(By.css('#stdbody > tr:nth-child(8) > td:nth-child(1)'));
|
|
|
|
//Get text, font, color, and size
|
|
const elementText = await element.getText('');
|
|
const elementFont = await element.getCssValue('font-family');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
const elementColor = await element.getCssValue('color');
|
|
|
|
const elementExportIcon = await driver.findElement(By.css('#stdbody > tr:nth-child(8) > .text-center:nth-child(2) img'));
|
|
const elementMoreInfoIconTooltip = await driver.findElement(By.css('#stdbody > tr:nth-child(8) > td:nth-child(4) > a')).getAttribute('title');
|
|
const elementViewIcon = await driver.findElement(By.css('tr:nth-child(8) > .text-center:nth-child(5) img'));
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//text
|
|
if (elementText === 'Texas') {
|
|
console.log("Passed: My Standards - Organization = Texas text matched as expected");
|
|
} else {
|
|
throw new Error(`Expected: My Standards - Organization = "Texas"; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//font
|
|
if (elementFont === "Poppins, sans-serif") {
|
|
console.log('Passed: My Standards - Organization = Texas text font-family matched as expected');
|
|
} else {
|
|
errors.push(`Expected: My Standards - Organization = Texas text font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
|
|
}
|
|
|
|
//size
|
|
if (elementSize === '14.3px') {
|
|
console.log('Passed: My Standards - Organization = Texas text font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: My Standards - Organization = Texas text font-size "14.3px"; Actual: "${elementSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementColor === 'rgba(33, 37, 41, 1)') {
|
|
console.log('Passed: My Standards - Organization = Texas text color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: My Standards - Organization = Texas text color: "rgba(33, 37, 41, 1)"; Actual: "${elementColor}"`);
|
|
}
|
|
|
|
//export icon
|
|
if (elementExportIcon) {
|
|
console.log('Passed: My Standards - Organization = Texas - Export icon is present');
|
|
} else {
|
|
errors.push('Expected: My Standards - Organization = Texas - Export icon not found');
|
|
}
|
|
|
|
//more info icon tool-tip
|
|
if (elementMoreInfoIconTooltip === 'View Detail Information') {
|
|
console.log('Passed: My Standards - Organization = Texas icon tool-tip text matched as expected');
|
|
} else {
|
|
errors.push(`Expected: My Standards - Organization = Texas: "View Detail Information"; Actual: "${elementMoreInfoIconTooltip}"`);
|
|
}
|
|
|
|
//view icon
|
|
if (elementViewIcon) {
|
|
console.log('Passed: My Standards - Organization = Texas - View icon is present');
|
|
} else {
|
|
errors.push('Expected: My Standards - Organization = Texas - View icon not found');
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//My Standards = Washington
|
|
{
|
|
description: 'My Standards - Organization = Washington Standards text',
|
|
action: async () => {
|
|
const multipleChecks = 'My Standards - Organization = Washington';
|
|
|
|
const element = await driver.findElement(By.css('#stdbody > tr:nth-child(9) > td:nth-child(1)'));
|
|
|
|
//Get text, font, color, and size
|
|
const elementText = await element.getText('');
|
|
const elementFont = await element.getCssValue('font-family');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
const elementColor = await element.getCssValue('color');
|
|
|
|
const elementExportIcon = await driver.findElement(By.css('#stdbody > tr:nth-child(9) > .text-center:nth-child(2) img'));
|
|
const elementMoreInfoIconTooltip = await driver.findElement(By.css('#stdbody > tr:nth-child(9) > td:nth-child(4) > a')).getAttribute('title');
|
|
const elementViewIcon = await driver.findElement(By.css('tr:nth-child(9) > .text-center:nth-child(5) img'));
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//text
|
|
if (elementText === 'Washington') {
|
|
console.log("Passed: My Standards - Organization = Washington text matched as expected");
|
|
} else {
|
|
throw new Error(`Expected: My Standards - Organization = "Washington"; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//font
|
|
if (elementFont === "Poppins, sans-serif") {
|
|
console.log('Passed: My Standards - Organization = Washington text font-family matched as expected');
|
|
} else {
|
|
errors.push(`Expected: My Standards - Organization = Washington text font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
|
|
}
|
|
|
|
//size
|
|
if (elementSize === '14.3px') {
|
|
console.log('Passed: My Standards - Organization = Washington text font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: My Standards - Organization = Washington text font-size "14.3px"; Actual: "${elementSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementColor === 'rgba(33, 37, 41, 1)') {
|
|
console.log('Passed: My Standards - Organization = Washington text color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: My Standards - Organization = Washington text color: "rgba(33, 37, 41, 1)"; Actual: "${elementColor}"`);
|
|
}
|
|
|
|
//export icon
|
|
if (elementExportIcon) {
|
|
console.log('Passed: My Standards - Organization = Washington - Export icon is present');
|
|
} else {
|
|
errors.push('Expected: My Standards - Organization = Washington - Export icon not found');
|
|
}
|
|
|
|
//more info icon tool-tip
|
|
if (elementMoreInfoIconTooltip === 'View Detail Information') {
|
|
console.log('Passed: My Standards - Organization = Washington icon tool-tip text matched as expected');
|
|
} else {
|
|
errors.push(`Expected: My Standards - Organization = Washington: "View Detail Information"; Actual: "${elementMoreInfoIconTooltip}"`);
|
|
}
|
|
|
|
//view icon
|
|
if (elementViewIcon) {
|
|
console.log('Passed: My Standards - Organization = Washington - View icon is present');
|
|
} else {
|
|
errors.push('Expected: My Standards - Organization = Washington - View icon not found');
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//CORRELATION COVERAGES WIDGET
|
|
//Correlation Coverages Widget title
|
|
{
|
|
description: 'Correlation Coverages Widget title text, color, and size',
|
|
action: async () => {
|
|
const multipleChecks = 'Correlation Coverages Widget title';
|
|
|
|
const element = await driver.findElement(By.css('.dash-gap-card h2'));
|
|
|
|
//Get text, font, size, and color
|
|
const elementText = await element.getText();
|
|
const elementFont = await element.getCssValue('font-family');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
const elementColor = await element.getCssValue('color');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//text
|
|
if (elementText === 'Correlation Coverages') {
|
|
console.log('Passed: Correlation Coverages Widget title matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Correlation Coverages; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//font
|
|
if (elementFont === `Poppins, sans-serif`) {
|
|
console.log('Passed: Correlation Coverages Widget title font-family matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Correlation Coverages Widget title font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
|
|
}
|
|
|
|
//size
|
|
if (elementSize === '18px') {
|
|
console.log('Passed: Correlation Coverages Widget title text font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Correlation Coverages Widget title text font-size "18px"; Actual: "${elementSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementColor === 'rgba(40, 39, 90, 1)') {
|
|
console.log('Passed: Correlation Coverages Widget title text color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Correlation Coverages Widget title text color "rgba(40, 39, 90, 1)"; Actual: "${elementColor}"`);
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Filters button
|
|
{
|
|
description: 'Filters button',
|
|
action: async () => {
|
|
const multipleChecks = 'Filters button';
|
|
|
|
const element = await driver.findElement(By.css('.gap-filters-wrap > .btn'));
|
|
const elementIcon = await element.findElement(By.css('.btn-primary > img'));
|
|
|
|
//Get button text, text font, text size, text color, and button color
|
|
const elementText = await element.getText('');
|
|
const elementTextFont = await element.getCssValue('font-family');
|
|
const elementTextSize = await element.getCssValue('font-size');
|
|
const elementTextColor = await element.getCssValue('color');
|
|
const elementButtonColor = await element.getCssValue('background-color');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//text
|
|
if (elementText === 'Filters') {
|
|
console.log('Passed: Filters button text matched as expected');
|
|
} else {
|
|
errors.push(`Expected: "${myContentItemTotals}"; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//font-family
|
|
if (elementTextFont === "Poppins, sans-serif") {
|
|
console.log('Passed: Filters button text font matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Filters button text font "Poppins, sans-serif"; Actual: ${elementTextFont}`);
|
|
}
|
|
|
|
//font size
|
|
if (elementTextSize === '12px') {
|
|
console.log('Passed: Filters button text font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Filters button text font-size "12px"; Actual: "${elementTextSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementTextColor === 'rgba(255, 255, 255, 1)') {
|
|
console.log('Passed: Filters button text color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Filters button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`);
|
|
}
|
|
|
|
//button color
|
|
if (elementButtonColor === 'rgba(48, 200, 172, 1)') {
|
|
console.log('Passed: Filters button background color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Filters button background color: "rgba(48, 200, 172, 1)"; Actual: "${elementButtonColor}"`);
|
|
}
|
|
|
|
//icon present
|
|
if (await elementIcon.isDisplayed()) {
|
|
console.log('Passed: Filters button icon was displayed as expected');
|
|
} else {
|
|
errors.push('Expected: Filters button icon was not displayed');
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Correlation Coverages Widget sub-title
|
|
{
|
|
description: 'Correlation Coverages Widget sub-title text, color, and size',
|
|
action: async () => {
|
|
const multipleChecks = 'Correlation Coverages Widget sub-title';
|
|
|
|
const element = await driver.findElement(By.css('.gap-idle-text'));
|
|
|
|
//Get text, font, size, and color
|
|
const elementText = await element.getText();
|
|
const elementFont = await element.getCssValue('font-family');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
const elementColor = await element.getCssValue('color');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//text
|
|
if (elementText === 'Please click the Filters button above to select filters and view Correlation Coverage') {
|
|
console.log('Passed: Correlation Coverages Widget sub-title matched as expected');
|
|
} else {
|
|
errors.push(`Expected: "Please click the Filters button above to select filters and view Correlation Coverage"; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//font
|
|
if (elementFont === `Poppins, sans-serif`) {
|
|
console.log('Passed: Correlation Coverages Widget sub-title font-family matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Correlation Coverages Widget sub-title font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
|
|
}
|
|
|
|
//size
|
|
if (elementSize === '14px') {
|
|
console.log('Passed: Correlation Coverages Widget sub-title text font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Correlation Coverages Widget sub-title text font-size "14px"; Actual: "${elementSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementColor === 'rgba(40, 39, 90, 1)') {
|
|
console.log('Passed: Correlation Coverages Widget sub-title text color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Correlation Coverages Widget sub-title text color "rgba(40, 39, 90, 1)"; Actual: "${elementColor}"`);
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Correlation Coverages Default Image
|
|
{
|
|
description: 'Correlation Coverages Default Image',
|
|
action: async () => {
|
|
const multipleChecks = 'Correlation Coverages Default Image';
|
|
|
|
const element = await driver.findElement(By.css('.gap-idle-wrap > img'));
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//icon present
|
|
if (await element.isDisplayed()) {
|
|
console.log('Passed: Correlation Coverages default image was displayed as expected');
|
|
} else {
|
|
errors.push('Expected: Correlation Coverages default image was not displayed');
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//SEMANTIC STANDARDS COMPARISON WIDGET
|
|
//Scroll to widget Semantic Standards Comparsion widget
|
|
{
|
|
description: 'Scroll to Semantic Standards Comparison Wiget 2',
|
|
action: async () => {
|
|
const location = await driver.findElement(By.css('#sscMapPane > p'));
|
|
await driver.executeScript("arguments[0].scrollIntoView({block: 'center'});", location);
|
|
await driver.sleep(2000);
|
|
}
|
|
},
|
|
|
|
//Semantic Standards Comparison Widget title
|
|
{
|
|
description: 'Semantic Standards Comparison Widget title text, font, size, and color',
|
|
action: async () => {
|
|
const element = await driver.findElement(By.css('.standards-compare h2'));
|
|
|
|
//Get text, font, size, and color
|
|
const elementText = await element.getText();
|
|
const elementFont = await element.getCssValue('font-family');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
const elementColor = await element.getCssValue('color');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//Validate text
|
|
if (elementText === 'Semantic Standards Comparison') {
|
|
console.log('Passed: Semantic Standards Comparison Widget title matched as expected');
|
|
} else {
|
|
const message = `Expected: Semantic Standards Comparison; Actual: "${elementText}"`;
|
|
errors.push(message);
|
|
}
|
|
|
|
//font
|
|
if (elementFont === `Poppins, sans-serif`) {
|
|
console.log('Passed: Semantic Standards Comparison Widget sub-title font-family matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Semantic Standards Comparison Widget sub-title font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
|
|
}
|
|
|
|
//Validate color
|
|
if (elementColor === 'rgba(40, 39, 90, 1)') {
|
|
console.log('Passed: Semantic Standards Comparison Widget title text color matched as expected');
|
|
} else {
|
|
const message = `Expected: Semantic Standards Comparison Widget title text color "rgba(40, 39, 90, 1)"; Actual: "${elementColor}"`;
|
|
errors.push(message);
|
|
}
|
|
|
|
//Validate font size
|
|
if (elementSize === '18px') {
|
|
console.log('Passed: Semantic Standards Comparison Widget title text font-size matched as expected');
|
|
} else {
|
|
const message = `Expected: Semantic Standards Comparison Widget 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'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//National Standards tab title, text, and font size (active)
|
|
{
|
|
description: 'National Standards tab title text, color, and size',
|
|
action: async () => {
|
|
const element = await driver.findElement(By.css('#sscMap-tab'));
|
|
|
|
//Get text, font, size, and color
|
|
const elementText = await element.getText();
|
|
const elementFont = await element.getCssValue('font-family');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
const elementColor = await element.getCssValue('color');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//Validate text
|
|
if (elementText === 'National Standards') {
|
|
console.log('Passed: National Standards tab title matched as expected');
|
|
} else {
|
|
const message = `Expected: National Standards; Actual: "${elementText}"`;
|
|
errors.push(message);
|
|
}
|
|
|
|
//Validate font
|
|
if (elementFont === 'Poppins, sans-serif') {
|
|
console.log('Passed: National Standards tab title text font matched as expected');
|
|
} else {
|
|
const message = `Expected: National Standards tab title text font "Poppins, sans-serif"; Actual: "${elementFont}"`;
|
|
errors.push(message);
|
|
}
|
|
|
|
//Validate color
|
|
if (elementColor === 'rgba(40, 39, 90, 1)') {
|
|
console.log('Passed: National Standards tab title text color matched as expected');
|
|
} else {
|
|
const message = `Expected: National Standards tab title text color "rgba(40, 39, 90, 1)"'; Actual: "${elementColor}"`;
|
|
errors.push(message);
|
|
}
|
|
|
|
//Validate font size
|
|
if (elementSize === '15px') {
|
|
console.log('Passed: National Standards tab title text font-size matched as expected');
|
|
} else {
|
|
const message = `Expected: National 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'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Custom Comparison tab title and color (dimmed)
|
|
{
|
|
description: 'Custom Comparison tab title, text color, and size',
|
|
action: async () => {
|
|
const element = await driver.findElement(By.css('#sscFilterLaunch-tab'));
|
|
|
|
//Get text, font, size, and color
|
|
const elementText = await element.getText();
|
|
const elementFont = await element.getCssValue('font-family');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
const elementColor = await element.getCssValue('color');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//Validate text
|
|
if (elementText === 'Custom Comparison') {
|
|
console.log('Passed: Custom Comparison tab title matched as expected');
|
|
} else {
|
|
const message = `Expected: "Custom Comparison" tab title; Actual: "${elementText}"`;
|
|
errors.push(message);
|
|
}
|
|
|
|
//Validate font
|
|
if (elementFont === 'Poppins, sans-serif') {
|
|
console.log('Passed: Custom Comparison tab title text font matched as expected');
|
|
} else {
|
|
const message = `Expected: Custom Comparison tab title text font "Poppins, sans-serif"; Actual: "${elementFont}"`;
|
|
errors.push(message);
|
|
}
|
|
|
|
//Validate color -gray
|
|
if (elementColor === 'rgba(182, 186, 181, 1)') {
|
|
console.log('Passed: Custom Comparison tab title color matched as expected');
|
|
} else {
|
|
const message = `Expected: Custom Comparison tab title color "rgba(182, 186, 181, 1)"; Actual: "${elementColor}"`;
|
|
errors.push(message);
|
|
}
|
|
|
|
//Validate font size
|
|
if (elementSize === '15px') {
|
|
console.log('Passed: Custom Comparison tab title font size matched as expected');
|
|
} else {
|
|
const message = `Expected: Custom Comparison tab title 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'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Custom Comparison - State Dropdown values
|
|
{
|
|
description: 'Custom Comparison - State Dropdown values',
|
|
action: async () => {
|
|
const elementDropdown = await driver.findElement(By.css('#compstate'));
|
|
const selectedOption = await elementDropdown.findElement(By.css('option:checked'));
|
|
|
|
const elementValue = await selectedOption.getAttribute('value');
|
|
const elementText = await selectedOption.getText();
|
|
|
|
const options = await elementDropdown.findElements(By.css('option'));
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
if (elementValue === '') {
|
|
console.log('Passed: Custom Comparison - State Dropdown value Please select a state, matched as expected');
|
|
} else {
|
|
throw new Error(`Expected: Custom Comparison - State Dropdown value "Please select a state"; Actual: "${elementText}"`);
|
|
}
|
|
|
|
const expected = [
|
|
'Please select a state',
|
|
'Alabama',
|
|
'Arizona',
|
|
'California',
|
|
'Florida',
|
|
'Georgia',
|
|
'Illinois',
|
|
'New York',
|
|
'Texas',
|
|
'Washington'
|
|
];
|
|
const actual = [];
|
|
|
|
for (const opt of options) {
|
|
const text = (await opt.getText()).trim();
|
|
actual.push(text);
|
|
}
|
|
|
|
if (JSON.stringify(actual) === JSON.stringify(expected)) {
|
|
console.log('Passed: Custom Comparison - State Dropdown list matched as expected');
|
|
} else {
|
|
throw new Error(`Expected: Custom Comparison - State Dropdown list: ${JSON.stringify(expected)}, Actual: ${JSON.stringify(actual)}`);
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift('Multiple validation checks did not pass');
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Custom Comparison - State dropdown Go button validation
|
|
{
|
|
description: 'Go button',
|
|
action: async () => {
|
|
const multipleChecks = 'Go button';
|
|
|
|
const element = await driver.findElement(By.css('#compbtn'));
|
|
|
|
//Get button text, text font, text size, text color, and button color
|
|
const elementText = await element.getText('');
|
|
const elementTextFont = await element.getCssValue('font-family');
|
|
const elementTextSize = await element.getCssValue('font-size');
|
|
const elementTextColor = await element.getCssValue('color');
|
|
const elementButtonColor = await element.getCssValue('background-color');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//text
|
|
if (elementText === 'Go') {
|
|
console.log('Passed: Go button text matched as expected');
|
|
} else {
|
|
errors.push(`Expected: "${myContentItemTotals}"; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//font-family
|
|
if (elementTextFont === "Poppins, sans-serif") {
|
|
console.log('Passed: Go button text font matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Go button text font "Poppins, sans-serif"; Actual: ${elementTextFont}`);
|
|
}
|
|
|
|
//font size
|
|
if (elementTextSize === '14px') {
|
|
console.log('Passed: Go button text font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Go button text font-size "14px"; Actual: "${elementTextSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementTextColor === 'rgba(255, 255, 255, 1)') {
|
|
console.log('Passed: Go button text color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Go button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`);
|
|
}
|
|
|
|
//button color
|
|
if (elementButtonColor === 'rgba(48, 200, 172, 1)') {
|
|
console.log('Passed: Go button background color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Go button background color: "rgba(48, 200, 172, 1)"; Actual: "${elementButtonColor}"`);
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Semantic Standards Comparison sub-title, text, font, size, and color
|
|
{
|
|
description: 'Semantic Standards Comparison sub-title text, font, size, and color',
|
|
action: async () => {
|
|
const element = await driver.findElement(By.css('#sscMapPane > p'));
|
|
|
|
//Get text, font, size, and color
|
|
const elementText = await element.getText();
|
|
const elementFont = await element.getCssValue('font-family');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
const elementColor = await element.getCssValue('color');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//Validate text
|
|
if (elementText === 'View semantic comparisons of state standards to national sets') {
|
|
console.log('Passed: Semantic Standards Comparison sub-title matched as expected');
|
|
} else {
|
|
const message = `Expected: "View semantic comparisons of state standards to national sets"; Actual: "${elementText}"`;
|
|
errors.push(message);
|
|
}
|
|
|
|
//Validate font
|
|
if (elementFont === 'Poppins, sans-serif') {
|
|
console.log('Passed: Semantic Standards Comparison sub-title text font matched as expected');
|
|
} else {
|
|
const message = `Expected: Semantic Standards Comparison sub-title text font "Poppins, sans-serif"; Actual: "${elementFont}"`;
|
|
errors.push(message);
|
|
}
|
|
|
|
//Validate color
|
|
if (elementColor === 'rgba(40, 39, 90, 1)') {
|
|
console.log('Passed: Semantic Standards Comparison sub-title text color matched as expected');
|
|
} else {
|
|
const message = `Expected: Semantic Standards Comparison sub-title text color "rgba(40, 39, 90, 1)"'; Actual: "${elementColor}"`;
|
|
errors.push(message);
|
|
}
|
|
|
|
//Validate font size
|
|
if (elementSize === '13px') {
|
|
console.log('Passed: Semantic Standards Comparison sub-title text font-size matched as expected');
|
|
} else {
|
|
const message = `Expected: Semantic Standards Comparison 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'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//LATEST STANDARDS UPDATE WIDGET
|
|
//Scroll to bottom of page
|
|
{
|
|
description: 'Scroll to bottom of page',
|
|
action: async () => {
|
|
await driver.executeScript('window.scrollTo(0, document.body.scrollHeight);');
|
|
await driver.sleep(2000);
|
|
}
|
|
},
|
|
|
|
|
|
//Latest Standards Update Widget title, text, font, size, and color
|
|
{
|
|
description: 'Latest Standards Update Widget text, font, size, and color',
|
|
action: async () => {
|
|
const element = await driver.findElement(By.css('.latest-standards h2'));
|
|
|
|
//Get text, font, size, and color
|
|
const elementText = await element.getText();
|
|
const elementFont = await element.getCssValue('font-family');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
const elementColor = await element.getCssValue('color');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//Validate text
|
|
if (elementText === 'Latest Standards Updates') {
|
|
console.log('Passed: Latest Standards Update Widget title matched as expected');
|
|
} else {
|
|
const message = `Expected: "Latest Standards Updates"; Actual: "${elementText}"`;
|
|
errors.push(message);
|
|
}
|
|
|
|
//Validate font
|
|
if (elementFont === 'Poppins, sans-serif') {
|
|
console.log('Passed: Latest Standards Update Widget title text font matched as expected');
|
|
} else {
|
|
const message = `Expected: Latest Standards Update Widget title text font "Poppins, sans-serif"; Actual: "${elementFont}"`;
|
|
errors.push(message);
|
|
}
|
|
|
|
//Validate color
|
|
if (elementColor === 'rgba(40, 39, 90, 1)') {
|
|
console.log('Passed: Latest Standards Update Widget title text color matched as expected');
|
|
} else {
|
|
const message = `Expected: Latest Standards Update Widget title text color "rgba(40, 39, 90, 1)"'; Actual: "${elementColor}"`;
|
|
errors.push(message);
|
|
}
|
|
|
|
//Validate font size
|
|
if (elementSize === '18px') {
|
|
console.log('Passed: Latest Standards Update Widget title text font-size matched as expected');
|
|
} else {
|
|
const message = `Expected: Latest Standards Update Widget 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'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//See More Button
|
|
{
|
|
description: 'See More button text, size, color, and href',
|
|
action: async () => {
|
|
const multipleChecks = 'See More button';
|
|
|
|
const element = await driver.findElement(By.linkText('See More'));
|
|
const elementIcon = await driver.findElement(By.css('.e-btn:nth-child(1) > .icon-See-More'));
|
|
const expectedHref = 'https://correlation.edgate.com/pic/standards-updates.html';
|
|
|
|
//Get text, font, size, and color
|
|
const elementText = await element.getText();
|
|
const elementTextFont = await element.getCssValue('font-family');
|
|
const elementTextSize = await element.getCssValue('font-size');
|
|
const elementTextColor = await element.getCssValue('color');
|
|
const elementBGTextColor = await element.getCssValue('background-color');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//text
|
|
if (elementText === 'See More') {
|
|
console.log('Passed: See More button text matched as expected');
|
|
} else {
|
|
errors.push(`Expected: "See More"; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//href
|
|
const actualHref = await element.getAttribute('href');
|
|
if (actualHref && actualHref === expectedHref) {
|
|
console.log('Passed: See More href matched as expected');
|
|
} else {
|
|
errors.push(`Expected: See More button href to be "${expectedHref}"; but found "${actualHref}"`);
|
|
}
|
|
|
|
//font-family
|
|
if (elementTextFont === "Poppins, sans-serif") {
|
|
console.log('Passed: See More button font matched as expected');
|
|
} else {
|
|
errors.push(`Expected: See More button font "Poppins, sans-serif"; Actual: ${elementTextFont}`);
|
|
}
|
|
|
|
//font size
|
|
if (elementTextSize === '13px') {
|
|
console.log('Passed: See More button text font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: See More button text font-size "13px"; Actual: "${elementTextSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementTextColor === 'rgba(255, 255, 255, 1)') {
|
|
console.log('Passed: See More button text color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: See More button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`);
|
|
}
|
|
|
|
//background color
|
|
if (elementBGTextColor === 'rgba(48, 200, 172, 1)') {
|
|
console.log('Passed: See More button background color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: See More button background color: "rgba(48, 200, 172, 1)"; Actual: "${elementBGTextColor}"`);
|
|
}
|
|
|
|
//icon
|
|
if (await elementIcon.isDisplayed()) {
|
|
console.log('Passed: See More button icon was displayed as expected');
|
|
} else {
|
|
errors.push('Expected: See More button icon was not displayed');
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Latest Standards Update Update 1 title, text, font, size, and color
|
|
{
|
|
description: 'Latest Standards Update 1 title, text, font, size, and color',
|
|
action: async () => {
|
|
const element = await driver.findElement(By.css('.mb-4:nth-child(1) > h4'));
|
|
|
|
//Get text, font, size, and color
|
|
const elementText = await element.getText();
|
|
const elementFont = await element.getCssValue('font-family');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
const elementColor = await element.getCssValue('color');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//Validate text
|
|
if (elementText.trim() !== '') {
|
|
console.log('Passed: Latest Standards Update 1 title matched as expected');
|
|
} else {
|
|
const message = 'Expected: Latest Standards Update 1 title to not be empty; Actual: Empty string';
|
|
errors.push(message);
|
|
}
|
|
|
|
//Validate font
|
|
if (elementFont === 'Poppins, sans-serif') {
|
|
console.log('Passed: Latest Standards Update 1 title text font matched as expected');
|
|
} else {
|
|
const message = `Expected: Latest Standards Update 1 title text font "Poppins, sans-serif"; Actual: "${elementFont}"`;
|
|
errors.push(message);
|
|
}
|
|
|
|
//Validate color
|
|
if (elementColor === 'rgba(40, 39, 90, 1)') {
|
|
console.log('Passed: Latest Standards Update 1 title text color matched as expected');
|
|
} else {
|
|
const message = `Expected: Latest Standards Update 1 title text color "rgba(40, 39, 90, 1)"; Actual: "${elementColor}"`;
|
|
errors.push(message);
|
|
}
|
|
|
|
//Validate font size
|
|
if (elementSize === '15px') {
|
|
console.log('Passed: Latest Standards Update 1 title text font-size matched as expected');
|
|
} else {
|
|
const message = `Expected: Latest Standards Update 1 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'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Latest Standards Update Update 1 sub-title, text, font, size, and color
|
|
{
|
|
description: 'Latest Standards Update 1 sub-title, text, font, size, and color',
|
|
action: async () => {
|
|
const element = await driver.findElement(By.css('.mb-4:nth-child(1) > p'));
|
|
|
|
//Get text, font, size, and color
|
|
const elementText = await element.getText();
|
|
const elementFont = await element.getCssValue('font-family');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
const elementColor = await element.getCssValue('color');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//Validate text
|
|
if (elementText.trim() !== '') {
|
|
console.log('Passed: Latest Standards Update 1 sub-title matched as expected');
|
|
} else {
|
|
const message = 'Expected: Latest Standards Update 1 sub-title to not be empty; Actual: Empty string';
|
|
errors.push(message);
|
|
}
|
|
|
|
//Validate font
|
|
if (elementFont === 'Poppins, sans-serif') {
|
|
console.log('Passed: Latest Standards Update 1 sub-title text font matched as expected');
|
|
} else {
|
|
const message = `Expected: Latest Standards Update 1 sub-title text font "Poppins, sans-serif"; Actual: "${elementFont}"`;
|
|
errors.push(message);
|
|
}
|
|
|
|
//Validate color
|
|
if (elementColor === 'rgba(40, 39, 90, 1)') {
|
|
console.log('Passed: Latest Standards Update 1 sub-title text color matched as expected');
|
|
} else {
|
|
const message = `Expected: Latest Standards Update 1 sub-title text color "rgba(40, 39, 90, 1)"; Actual: "${elementColor}"`;
|
|
errors.push(message);
|
|
}
|
|
|
|
//Validate font size
|
|
if (elementSize === '12px') {
|
|
console.log('Passed: Latest Standards Update 1 sub-title text font-size matched as expected');
|
|
} else {
|
|
const message = `Expected: Latest Standards Update 1 sub-title text font-size "12px"; 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'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Latest Standards Update Update 1 date, text, font, size, and color
|
|
{
|
|
description: 'Latest Standards Update 1 date, text, font, size, and color',
|
|
action: async () => {
|
|
const element = await driver.findElement(By.css('.mb-4:nth-child(1) em'));
|
|
|
|
//Get text, font, size, and color
|
|
const elementText = await element.getText();
|
|
const elementFont = await element.getCssValue('font-family');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
const elementColor = await element.getCssValue('color');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//Validate text
|
|
if (elementText.trim() !== '') {
|
|
console.log('Passed: Latest Standards Update 1 date matched as expected');
|
|
} else {
|
|
const message = 'Expected: Latest Standards Update 1 date to not be empty; Actual: Empty string';
|
|
errors.push(message);
|
|
}
|
|
|
|
//Validate font
|
|
if (elementFont === 'Poppins, sans-serif') {
|
|
console.log('Passed: Latest Standards Update 1 date text font matched as expected');
|
|
} else {
|
|
const message = `Expected: Latest Standards Update 1 date text font "Poppins, sans-serif"; Actual: "${elementFont}"`;
|
|
errors.push(message);
|
|
}
|
|
|
|
//Validate color
|
|
if (elementColor === 'rgba(40, 39, 90, 1)') {
|
|
console.log('Passed: Latest Standards Update 1 date text color matched as expected');
|
|
} else {
|
|
const message = `Expected: Latest Standards Update 1 date text color "rgba(40, 39, 90, 1)"; Actual: "${elementColor}"`;
|
|
errors.push(message);
|
|
}
|
|
|
|
//Validate font size
|
|
if (elementSize === '12px') {
|
|
console.log('Passed: Latest Standards Update 1 date text font-size matched as expected');
|
|
} else {
|
|
const message = `Expected: Latest Standards Update 1 date text font-size "12px"; 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'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Latest Standards Update Update 2 title, text, font, size, and color
|
|
{
|
|
description: 'Latest Standards Update 2 title, text, font, size, and color',
|
|
action: async () => {
|
|
const element = await driver.findElement(By.css('.mb-4:nth-child(2) > h4'));
|
|
|
|
//Get text, font, size, and color
|
|
const elementText = await element.getText();
|
|
const elementFont = await element.getCssValue('font-family');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
const elementColor = await element.getCssValue('color');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//Validate text
|
|
if (elementText.trim() !== '') {
|
|
console.log('Passed: Latest Standards Update 2 title matched as expected');
|
|
} else {
|
|
const message = 'Expected: Latest Standards Update 2 title to not be empty; Actual: Empty string';
|
|
errors.push(message);
|
|
}
|
|
|
|
//Validate font
|
|
if (elementFont === 'Poppins, sans-serif') {
|
|
console.log('Passed: Latest Standards Update 2 title text font matched as expected');
|
|
} else {
|
|
const message = `Expected: Latest Standards Update 2 title text font "Poppins, sans-serif"; Actual: "${elementFont}"`;
|
|
errors.push(message);
|
|
}
|
|
|
|
//Validate color
|
|
if (elementColor === 'rgba(40, 39, 90, 1)') {
|
|
console.log('Passed: Latest Standards Update 2 title text color matched as expected');
|
|
} else {
|
|
const message = `Expected: Latest Standards Update 2 title text color "rgba(40, 39, 90, 1)"; Actual: "${elementColor}"`;
|
|
errors.push(message);
|
|
}
|
|
|
|
//Validate font size
|
|
if (elementSize === '15px') {
|
|
console.log('Passed: Latest Standards Update 2 title text font-size matched as expected');
|
|
} else {
|
|
const message = `Expected: Latest Standards Update 2 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'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Latest Standards Update Update 2 sub-title, text, font, size, and color
|
|
{
|
|
description: 'Latest Standards Update 2 sub-title, text, font, size, and color',
|
|
action: async () => {
|
|
const element = await driver.findElement(By.css('.mb-4:nth-child(2) > p'));
|
|
|
|
//Get text, font, size, and color
|
|
const elementText = await element.getText();
|
|
const elementFont = await element.getCssValue('font-family');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
const elementColor = await element.getCssValue('color');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//Validate text
|
|
if (elementText.trim() !== '') {
|
|
console.log('Passed: Latest Standards Update 2 sub-title matched as expected');
|
|
} else {
|
|
const message = 'Expected: Latest Standards Update 2 sub-title to not be empty; Actual: Empty string';
|
|
errors.push(message);
|
|
}
|
|
|
|
//Validate font
|
|
if (elementFont === 'Poppins, sans-serif') {
|
|
console.log('Passed: Latest Standards Update 2 sub-title text font matched as expected');
|
|
} else {
|
|
const message = `Expected: Latest Standards Update 2 sub-title text font "Poppins, sans-serif"; Actual: "${elementFont}"`;
|
|
errors.push(message);
|
|
}
|
|
|
|
//Validate color
|
|
if (elementColor === 'rgba(40, 39, 90, 1)') {
|
|
console.log('Passed: Latest Standards Update 2 sub-title text color matched as expected');
|
|
} else {
|
|
const message = `Expected: Latest Standards Update 2 sub-title text color "rgba(40, 39, 90, 1)"; Actual: "${elementColor}"`;
|
|
errors.push(message);
|
|
}
|
|
|
|
//Validate font size
|
|
if (elementSize === '12px') {
|
|
console.log('Passed: Latest Standards Update 2 sub-title text font-size matched as expected');
|
|
} else {
|
|
const message = `Expected: Latest Standards Update 2 sub-title text font-size "12px"; 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'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Latest Standards Update Update 2 date, text, font, size, and color
|
|
{
|
|
description: 'Latest Standards Update 2 date, text, font, size, and color',
|
|
action: async () => {
|
|
const element = await driver.findElement(By.css('.mb-4:nth-child(2) em'));
|
|
|
|
//Get text, font, size, and color
|
|
const elementText = await element.getText();
|
|
const elementFont = await element.getCssValue('font-family');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
const elementColor = await element.getCssValue('color');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//Validate text
|
|
if (elementText.trim() !== '') {
|
|
console.log('Passed: Latest Standards Update 2 date matched as expected');
|
|
} else {
|
|
const message = 'Expected: Latest Standards Update 2 date to not be empty; Actual: Empty string';
|
|
errors.push(message);
|
|
}
|
|
|
|
//Validate font
|
|
if (elementFont === 'Poppins, sans-serif') {
|
|
console.log('Passed: Latest Standards Update 2 date text font matched as expected');
|
|
} else {
|
|
const message = `Expected: Latest Standards Update 2 date text font "Poppins, sans-serif"; Actual: "${elementFont}"`;
|
|
errors.push(message);
|
|
}
|
|
|
|
//Validate color
|
|
if (elementColor === 'rgba(40, 39, 90, 1)') {
|
|
console.log('Passed: Latest Standards Update 2 date text color matched as expected');
|
|
} else {
|
|
const message = `Expected: Latest Standards Update 2 date text color "rgba(40, 39, 90, 1)"'; Actual: "${elementColor}"`;
|
|
errors.push(message);
|
|
}
|
|
|
|
//Validate font size
|
|
if (elementSize === '12px') {
|
|
console.log('Passed: Latest Standards Update 2 date text font-size matched as expected');
|
|
} else {
|
|
const message = `Expected: Latest Standards Update 2 date text font-size "12px"; 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'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Latest Standards Update Update 3 title, text, font, size, and color
|
|
{
|
|
description: 'Latest Standards Update 3 title, text, font, size, and color',
|
|
action: async () => {
|
|
const element = await driver.findElement(By.css('.mb-4:nth-child(3) > h4'));
|
|
|
|
//Get text, font, size, and color
|
|
const elementText = await element.getText();
|
|
const elementFont = await element.getCssValue('font-family');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
const elementColor = await element.getCssValue('color');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//Validate text
|
|
if (elementText.trim() !== '') {
|
|
console.log('Passed: Latest Standards Update 3 title matched as expected');
|
|
} else {
|
|
const message = 'Expected: Latest Standards Update 3 title to not be empty; Actual: Empty string';
|
|
errors.push(message);
|
|
}
|
|
|
|
//Validate font
|
|
if (elementFont === 'Poppins, sans-serif') {
|
|
console.log('Passed: Latest Standards Update 3 title text font matched as expected');
|
|
} else {
|
|
const message = `Expected: Latest Standards Update 3 title text font "Poppins, sans-serif"; Actual: "${elementFont}"`;
|
|
errors.push(message);
|
|
}
|
|
|
|
//Validate color
|
|
if (elementColor === 'rgba(40, 39, 90, 1)') {
|
|
console.log('Passed: Latest Standards Update 3 title text color matched as expected');
|
|
} else {
|
|
const message = `Expected: Latest Standards Update 3 title text color "rgba(40, 39, 90, 1)"'; Actual: "${elementColor}"`;
|
|
errors.push(message);
|
|
}
|
|
|
|
//Validate font size
|
|
if (elementSize === '15px') {
|
|
console.log('Passed: Latest Standards Update 3 title text font-size matched as expected');
|
|
} else {
|
|
const message = `Expected: Latest Standards Update 3 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'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Latest Standards Update Update 3 sub-title, text, font, size, and color
|
|
{
|
|
description: 'Latest Standards Update 3 sub-title, text, font, size, and color',
|
|
action: async () => {
|
|
const element = await driver.findElement(By.css('.mb-4:nth-child(3) > p'));
|
|
|
|
//Get text, font, size, and color
|
|
const elementText = await element.getText();
|
|
const elementFont = await element.getCssValue('font-family');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
const elementColor = await element.getCssValue('color');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//Validate text
|
|
if (elementText.trim() !== '') {
|
|
console.log('Passed: Latest Standards Update 3 sub-title matched as expected');
|
|
} else {
|
|
const message = 'Expected: Latest Standards Update 3 sub-title to not be empty; Actual: Empty string';
|
|
errors.push(message);
|
|
}
|
|
|
|
//Validate font
|
|
if (elementFont === 'Poppins, sans-serif') {
|
|
console.log('Passed: Latest Standards Update 3 sub-title text font matched as expected');
|
|
} else {
|
|
const message = `Expected: Latest Standards Update 3 sub-title text font "Poppins, sans-serif"; Actual: "${elementFont}"`;
|
|
errors.push(message);
|
|
}
|
|
|
|
//Validate color
|
|
if (elementColor === 'rgba(40, 39, 90, 1)') {
|
|
console.log('Passed: Latest Standards Update 3 sub-title text color matched as expected');
|
|
} else {
|
|
const message = `Expected: Latest Standards Update 3 sub-title text color "rgba(40, 39, 90, 1)"'; Actual: "${elementColor}"`;
|
|
errors.push(message);
|
|
}
|
|
|
|
//Validate font size
|
|
if (elementSize === '12px') {
|
|
console.log('Passed: Latest Standards Update 3 sub-title text font-size matched as expected');
|
|
} else {
|
|
const message = `Expected: Latest Standards Update 3 sub-title text font-size "12px"; 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'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Latest Standards Update Update 3 date, text, font, size, and color
|
|
{
|
|
description: 'Latest Standards Update 3 date, text, font, size, and color',
|
|
action: async () => {
|
|
const element = await driver.findElement(By.css('.mb-4:nth-child(3) em'));
|
|
|
|
//Get text, font, size, and color
|
|
const elementText = await element.getText();
|
|
const elementFont = await element.getCssValue('font-family');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
const elementColor = await element.getCssValue('color');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//Validate text
|
|
if (elementText.trim() !== '') {
|
|
console.log('Passed: Latest Standards Update 3 date matched as expected');
|
|
} else {
|
|
const message = 'Expected: Latest Standards Update 3 date to not be empty; Actual: Empty string';
|
|
errors.push(message);
|
|
}
|
|
|
|
//Validate font
|
|
if (elementFont === 'Poppins, sans-serif') {
|
|
console.log('Passed: Latest Standards Update 3 date text font matched as expected');
|
|
} else {
|
|
const message = `Expected: Latest Standards Update 3 date text font "Poppins, sans-serif"; Actual: "${elementFont}"`;
|
|
errors.push(message);
|
|
}
|
|
|
|
//Validate color
|
|
if (elementColor === 'rgba(40, 39, 90, 1)') {
|
|
console.log('Passed: Latest Standards Update 3 date text color matched as expected');
|
|
} else {
|
|
const message = `Expected: Latest Standards Update 3 date text color "rgba(40, 39, 90, 1)"'; Actual: "${elementColor}"`;
|
|
errors.push(message);
|
|
}
|
|
|
|
//Validate font size
|
|
if (elementSize === '12px') {
|
|
console.log('Passed: Latest Standards Update 3 date text font-size matched as expected');
|
|
} else {
|
|
const message = `Expected: Latest Standards Update 3 date text font-size "12px"; 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'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Latest Standards Update Update 4 title, text, font, size, and color
|
|
{
|
|
description: 'Latest Standards Update 4 title, text, font, size, and color',
|
|
action: async () => {
|
|
const element = await driver.findElement(By.css('.mb-4:nth-child(4) > h4'));
|
|
|
|
//Get text, font, size, and color
|
|
const elementText = await element.getText();
|
|
const elementFont = await element.getCssValue('font-family');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
const elementColor = await element.getCssValue('color');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//Validate text
|
|
if (elementText.trim() !== '') {
|
|
console.log('Passed: Latest Standards Update 4 title matched as expected');
|
|
} else {
|
|
const message = 'Expected: Latest Standards Update 4 title to not be empty; Actual: Empty string';
|
|
errors.push(message);
|
|
}
|
|
|
|
//Validate font
|
|
if (elementFont === 'Poppins, sans-serif') {
|
|
console.log('Passed: Latest Standards Update 4 title text font matched as expected');
|
|
} else {
|
|
const message = `Expected: Latest Standards Update 4 title text font "Poppins, sans-serif"; Actual: "${elementFont}"`;
|
|
errors.push(message);
|
|
}
|
|
|
|
//Validate color
|
|
if (elementColor === 'rgba(40, 39, 90, 1)') {
|
|
console.log('Passed: Latest Standards Update 4 title text color matched as expected');
|
|
} else {
|
|
const message = `Expected: Latest Standards Update 4 title text color "rgba(40, 39, 90, 1)"'; Actual: "${elementColor}"`;
|
|
errors.push(message);
|
|
}
|
|
|
|
//Validate font size
|
|
if (elementSize === '15px') {
|
|
console.log('Passed: Latest Standards Update 4 title text font-size matched as expected');
|
|
} else {
|
|
const message = `Expected: Latest Standards Update 4 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'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Latest Standards Update Update 4 sub-title, text, font, size, and color
|
|
{
|
|
description: 'Latest Standards Update 4 sub-title, text, font, size, and color',
|
|
action: async () => {
|
|
const element = await driver.findElement(By.css('.mb-4:nth-child(4) > p'));
|
|
|
|
//Get text, font, size, and color
|
|
const elementText = await element.getText();
|
|
const elementFont = await element.getCssValue('font-family');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
const elementColor = await element.getCssValue('color');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//Validate text
|
|
if (elementText.trim() !== '') {
|
|
console.log('Passed: Latest Standards Update 4 sub-title matched as expected');
|
|
} else {
|
|
const message = 'Expected: Latest Standards Update 4 sub-title to not be empty; Actual: Empty string';
|
|
errors.push(message);
|
|
}
|
|
|
|
//Validate font
|
|
if (elementFont === 'Poppins, sans-serif') {
|
|
console.log('Passed: Latest Standards Update 4 sub-title text font matched as expected');
|
|
} else {
|
|
const message = `Expected: Latest Standards Update 4 sub-title text font "Poppins, sans-serif"; Actual: "${elementFont}"`;
|
|
errors.push(message);
|
|
}
|
|
|
|
//Validate color
|
|
if (elementColor === 'rgba(40, 39, 90, 1)') {
|
|
console.log('Passed: Latest Standards Update 4 sub-title text color matched as expected');
|
|
} else {
|
|
const message = `Expected: Latest Standards Update 4 sub-title text color "rgba(40, 39, 90, 1)"'; Actual: "${elementColor}"`;
|
|
errors.push(message);
|
|
}
|
|
|
|
//Validate font size
|
|
if (elementSize === '12px') {
|
|
console.log('Passed: Latest Standards Update 4 sub-title text font-size matched as expected');
|
|
} else {
|
|
const message = `Expected: Latest Standards Update 4 sub-title text font-size "12px"; 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'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Latest Standards Update Update 4 date, text, font, size, and color
|
|
{
|
|
description: 'Latest Standards Update 4 date, text, font, size, and color',
|
|
action: async () => {
|
|
const element = await driver.findElement(By.css('.mb-4:nth-child(4) em'));
|
|
|
|
//Get text, font, size, and color
|
|
const elementText = await element.getText();
|
|
const elementFont = await element.getCssValue('font-family');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
const elementColor = await element.getCssValue('color');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//Validate text
|
|
if (elementText.trim() !== '') {
|
|
console.log('Passed: Latest Standards Update 4 date matched as expected');
|
|
} else {
|
|
const message = 'Expected: Latest Standards Update 4 date to not be empty; Actual: Empty string';
|
|
errors.push(message);
|
|
}
|
|
|
|
//Validate font
|
|
if (elementFont === 'Poppins, sans-serif') {
|
|
console.log('Passed: Latest Standards Update 4 date text font matched as expected');
|
|
} else {
|
|
const message = `Expected: Latest Standards Update 4 date text font "Poppins, sans-serif"; Actual: "${elementFont}"`;
|
|
errors.push(message);
|
|
}
|
|
|
|
//Validate color
|
|
if (elementColor === 'rgba(40, 39, 90, 1)') {
|
|
console.log('Passed: Latest Standards Update 4 date text color matched as expected');
|
|
} else {
|
|
const message = `Expected: Latest Standards Update 4 date text color "rgba(40, 39, 90, 1)"'; Actual: "${elementColor}"`;
|
|
errors.push(message);
|
|
}
|
|
|
|
//Validate font size
|
|
if (elementSize === '12px') {
|
|
console.log('Passed: Latest Standards Update 4 date text font-size matched as expected');
|
|
} else {
|
|
const message = `Expected: Latest Standards Update 4 date text font-size "12px"; 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'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Latest Standards Update Update 5 title, text, font, size, and color
|
|
{
|
|
description: 'Latest Standards Update 5 title, text, font, size, and color',
|
|
action: async () => {
|
|
const element = await driver.findElement(By.css('.mb-4:nth-child(5) > h4'));
|
|
|
|
//Get text, font, size, and color
|
|
const elementText = await element.getText();
|
|
const elementFont = await element.getCssValue('font-family');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
const elementColor = await element.getCssValue('color');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//Validate text
|
|
if (elementText.trim() !== '') {
|
|
console.log('Passed: Latest Standards Update 5 title matched as expected');
|
|
} else {
|
|
const message = 'Expected: Latest Standards Update 5 title to not be empty; Actual: Empty string';
|
|
errors.push(message);
|
|
}
|
|
|
|
//Validate font
|
|
if (elementFont === 'Poppins, sans-serif') {
|
|
console.log('Passed: Latest Standards Update 5 title text font matched as expected');
|
|
} else {
|
|
const message = `Expected: Latest Standards Update 5 title text font "Poppins, sans-serif"; Actual: "${elementFont}"`;
|
|
errors.push(message);
|
|
}
|
|
|
|
//Validate color
|
|
if (elementColor === 'rgba(40, 39, 90, 1)') {
|
|
console.log('Passed: Latest Standards Update 5 title text color matched as expected');
|
|
} else {
|
|
const message = `Expected: Latest Standards Update 5 title text color "rgba(40, 39, 90, 1)"'; Actual: "${elementColor}"`;
|
|
errors.push(message);
|
|
}
|
|
|
|
//Validate font size
|
|
if (elementSize === '15px') {
|
|
console.log('Passed: Latest Standards Update 5 title text font-size matched as expected');
|
|
} else {
|
|
const message = `Expected: Latest Standards Update 5 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'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Latest Standards Update Update 5 sub-title, text, font, size, and color
|
|
{
|
|
description: 'Latest Standards Update 5 sub-title, text, font, size, and color',
|
|
action: async () => {
|
|
const element = await driver.findElement(By.css('.mb-4:nth-child(5) > p'));
|
|
|
|
//Get text, font, size, and color
|
|
const elementText = await element.getText();
|
|
const elementFont = await element.getCssValue('font-family');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
const elementColor = await element.getCssValue('color');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//Validate text
|
|
if (elementText.trim() !== '') {
|
|
console.log('Passed: Latest Standards Update 5 sub-title matched as expected');
|
|
} else {
|
|
const message = 'Expected: Latest Standards Update 5 sub-title to not be empty; Actual: Empty string';
|
|
errors.push(message);
|
|
}
|
|
|
|
//Validate font
|
|
if (elementFont === 'Poppins, sans-serif') {
|
|
console.log('Passed: Latest Standards Update 5 sub-title text font matched as expected');
|
|
} else {
|
|
const message = `Expected: Latest Standards Update 5 sub-title text font "Poppins, sans-serif"; Actual: "${elementFont}"`;
|
|
errors.push(message);
|
|
}
|
|
|
|
//Validate color
|
|
if (elementColor === 'rgba(40, 39, 90, 1)') {
|
|
console.log('Passed: Latest Standards Update 5 sub-title text color matched as expected');
|
|
} else {
|
|
const message = `Expected: Latest Standards Update 5 sub-title text color "rgba(40, 39, 90, 1)"'; Actual: "${elementColor}"`;
|
|
errors.push(message);
|
|
}
|
|
|
|
//Validate font size
|
|
if (elementSize === '12px') {
|
|
console.log('Passed: Latest Standards Update 5 sub-title text font-size matched as expected');
|
|
} else {
|
|
const message = `Expected: Latest Standards Update 5 sub-title text font-size "12px"; 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'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Latest Standards Update Update 5 date, text, font, size, and color
|
|
{
|
|
description: 'Latest Standards Update 5 date, text, font, size, and color',
|
|
action: async () => {
|
|
const element = await driver.findElement(By.css('.mb-4:nth-child(5) em'));
|
|
|
|
//Get text, font, size, and color
|
|
const elementText = await element.getText();
|
|
const elementFont = await element.getCssValue('font-family');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
const elementColor = await element.getCssValue('color');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//Validate text
|
|
if (elementText.trim() !== '') {
|
|
console.log('Passed: Latest Standards Update 5 date matched as expected');
|
|
} else {
|
|
const message = 'Expected: Latest Standards Update 5 date to not be empty; Actual: Empty string';
|
|
errors.push(message);
|
|
}
|
|
|
|
//Validate font
|
|
if (elementFont === 'Poppins, sans-serif') {
|
|
console.log('Passed: Latest Standards Update 5 date text font matched as expected');
|
|
} else {
|
|
const message = `Expected: Latest Standards Update 5 date text font "Poppins, sans-serif"; Actual: "${elementFont}"`;
|
|
errors.push(message);
|
|
}
|
|
|
|
//Validate color
|
|
if (elementColor === 'rgba(40, 39, 90, 1)') {
|
|
console.log('Passed: Latest Standards Update 5 date text color matched as expected');
|
|
} else {
|
|
const message = `Expected: Latest Standards Update 5 date text color "rgba(40, 39, 90, 1)"'; Actual: "${elementColor}"`;
|
|
errors.push(message);
|
|
}
|
|
|
|
//Validate font size
|
|
if (elementSize === '12px') {
|
|
console.log('Passed: Latest Standards Update 5 date text font-size matched as expected');
|
|
} else {
|
|
const message = `Expected: Latest Standards Update 5 date text font-size "12px"; 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'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//FAVORITE REPORTS WIDGET
|
|
//Favorite Reports Widget title, text, font, size, and color
|
|
{
|
|
description: 'Favorite Reports Widget text, font, size, and color',
|
|
action: async () => {
|
|
const element = await driver.findElement(By.css('h2:nth-child(3)'));
|
|
|
|
//Get text, font, size, and color
|
|
const elementText = await element.getText();
|
|
const elementFont = await element.getCssValue('font-family');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
const elementColor = await element.getCssValue('color');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//Validate text
|
|
if (elementText === 'Favorite Reports') {
|
|
console.log('Passed: Favorite Reports Widget title matched as expected');
|
|
} else {
|
|
const message = `Expected: "Favorite Reports"; Actual: "${elementText}"`;
|
|
errors.push(message);
|
|
}
|
|
|
|
//Validate font
|
|
if (elementFont === 'Poppins, sans-serif') {
|
|
console.log('Passed: Favorite Reports Widget title text font matched as expected');
|
|
} else {
|
|
const message = `Expected: Favorite Reports Widget title text font "Poppins, sans-serif"; Actual: "${elementFont}"`;
|
|
errors.push(message);
|
|
}
|
|
|
|
//Validate color
|
|
if (elementColor === 'rgba(40, 39, 90, 1)') {
|
|
console.log('Passed: Favorite Reports Widget title text color matched as expected');
|
|
} else {
|
|
const message = `Expected: Favorite Reports Widget title text color "rgba(40, 39, 90, 1)"'; Actual: "${elementColor}"`;
|
|
errors.push(message);
|
|
}
|
|
|
|
//Validate font size
|
|
if (elementSize === '18px') {
|
|
console.log('Passed: Favorite Reports Widget title text font-size matched as expected');
|
|
} else {
|
|
const message = `Expected: Favorite Reports Widget 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'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Manage Favorites Button
|
|
{
|
|
description: 'Manage Favorite button title text, size, color, and href',
|
|
action: async () => {
|
|
const multipleChecks = 'Manage Favorites button';
|
|
|
|
const element = await driver.findElement(By.linkText('Manage Favorites'));
|
|
const elementIcon = await driver.findElement(By.css('.icon-Manage-Favorites'));
|
|
const expectedHref = 'https://correlation.edgate.com/exact/add_favorite_report.php';
|
|
|
|
//Get text, font, size, and color
|
|
const elementText = await element.getText();
|
|
const elementTextFont = await element.getCssValue('font-family');
|
|
const elementTextSize = await element.getCssValue('font-size');
|
|
const elementTextColor = await element.getCssValue('color');
|
|
const elementBGTextColor = await element.getCssValue('background-color');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//text
|
|
if (elementText === 'Manage Favorites') {
|
|
console.log('Passed: Manage Favorites button text matched as expected');
|
|
} else {
|
|
errors.push(`Expected: "Manage Favorites"; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//href
|
|
const actualHref = await element.getAttribute('href');
|
|
if (actualHref && actualHref === expectedHref) {
|
|
console.log('Passed: Manage Favorites href matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Manage Favorites button href to be "${expectedHref}"; but found "${actualHref}"`);
|
|
}
|
|
|
|
//font-family
|
|
if (elementTextFont === "Poppins, sans-serif") {
|
|
console.log('Passed: Manage Favorites button font matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Manage Favorites button font "Poppins, sans-serif"; Actual: ${elementTextFont}`);
|
|
}
|
|
|
|
//font size
|
|
if (elementTextSize === '13px') {
|
|
console.log('Passed: Manage Favorites button text font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Manage Favorites button text font-size "13px"; Actual: "${elementTextSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementTextColor === 'rgba(255, 255, 255, 1)') {
|
|
console.log('Passed: Manage Favorites button text color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Manage Favorites button text color: "rgba(255, 255, 255, 1)"; Actual: "${elementTextColor}"`);
|
|
}
|
|
|
|
//background color
|
|
if (elementBGTextColor === 'rgba(48, 200, 172, 1)') {
|
|
console.log('Passed: Manage Favorites button background color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Manage Favorites button background color: "rgba(48, 200, 172, 1)"; Actual: "${elementBGTextColor}"`);
|
|
}
|
|
|
|
//icon
|
|
if (await elementIcon.isDisplayed()) {
|
|
console.log('Passed: Manage Favorites button icon was displayed as expected');
|
|
} else {
|
|
errors.push('Expected: Manage Favorites button icon was not displayed');
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Favorite Reports - Format column title
|
|
{
|
|
description: 'Favorite Reports - Format column title, text, and font size',
|
|
action: async () => {
|
|
const multipleChecks = 'Favorite Reports - Format column title'
|
|
|
|
const element = await driver.findElement(By.css('.table:nth-child(1) th:nth-child(1)'));
|
|
|
|
//Get text, font, size, and color
|
|
const elementText = await element.getText();
|
|
const elementFont = await element.getCssValue('font-family');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
const elementColor = await element.getCssValue('color');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//text
|
|
if (elementText === 'Format') {
|
|
console.log('Passed: Favorite Reports - Format column title matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Favorite Reports - "Format" column title; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//font
|
|
if (elementFont === "Poppins, sans-serif") {
|
|
console.log('Passed: Favorite Reports - Format column title font-family matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Favorite Reports - Format column title font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
|
|
}
|
|
|
|
//size
|
|
if (elementSize === '14px') {
|
|
console.log('Passed: Favorite Reports - Format column title text font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Favorite Reports - Format column title text font-size "14px"; Actual: "${elementSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementColor === 'rgba(94, 105, 116, 1)') {
|
|
console.log('Passed: Favorite Reports - Format column title text color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Favorite Reports - Format column title text color "rgba(94, 105, 116, 1)"'; Actual: "${elementColor}"`);
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Favorite Reports - Report column title
|
|
{
|
|
description: 'Favorite Reports - Report column title, text, and font size',
|
|
action: async () => {
|
|
const multipleChecks = 'Favorite Reports - Report column title'
|
|
|
|
const element = await driver.findElement(By.css('.table:nth-child(1) th:nth-child(2)'));
|
|
|
|
//Get text, font, size, and color
|
|
const elementText = await element.getText();
|
|
const elementFont = await element.getCssValue('font-family');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
const elementColor = await element.getCssValue('color');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//text
|
|
if (elementText === 'Report') {
|
|
console.log('Passed: Favorite Reports - Report column title matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Favorite Reports - "Report" column title; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//font
|
|
if (elementFont === "Poppins, sans-serif") {
|
|
console.log('Passed: Favorite Reports - Report column title font-family matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Favorite Reports - Report column title font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
|
|
}
|
|
|
|
//size
|
|
if (elementSize === '14px') {
|
|
console.log('Passed: Favorite Reports - Report column title text font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Favorite Reports - Report column title text font-size "14px"; Actual: "${elementSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementColor === 'rgba(94, 105, 116, 1)') {
|
|
console.log('Passed: Favorite Reports - Report column title text color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Favorite Reports - Report column title text color "rgba(94, 105, 116, 1)"'; Actual: "${elementColor}"`);
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Favorite Reports - Run column title
|
|
{
|
|
description: 'Favorite Reports - Run column title, text, and font size',
|
|
action: async () => {
|
|
const multipleChecks = 'Favorite Reports - Run column title'
|
|
|
|
const element = await driver.findElement(By.css('.table:nth-child(1) th:nth-child(3)'));
|
|
|
|
//Get text, font, size, and color
|
|
const elementText = await element.getText();
|
|
const elementFont = await element.getCssValue('font-family');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
const elementColor = await element.getCssValue('color');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//text
|
|
if (elementText === 'Run') {
|
|
console.log('Passed: Favorite Reports - Run column title matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Favorite Reports - "Run" column title; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//font
|
|
if (elementFont === "Poppins, sans-serif") {
|
|
console.log('Passed: Favorite Reports - Run column title font-family matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Favorite Reports - Run column title font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
|
|
}
|
|
|
|
//size
|
|
if (elementSize === '14px') {
|
|
console.log('Passed: Favorite Reports - Run column title text font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Favorite Reports - Run column title text font-size "14px"; Actual: "${elementSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementColor === 'rgba(94, 105, 116, 1)') {
|
|
console.log('Passed: Favorite Reports - Run column title text color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Favorite Reports - Run column title text color "rgba(94, 105, 116, 1)"'; Actual: "${elementColor}"`);
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Favorite Reports - Download column title
|
|
{
|
|
description: 'Favorite Reports - Download column title, text, and font size',
|
|
action: async () => {
|
|
const multipleChecks = 'Favorite Reports - Download column title'
|
|
|
|
const element = await driver.findElement(By.css('.table:nth-child(1) > thead .text-center'));
|
|
|
|
//Get text, font, size, and color
|
|
const elementText = await element.getText();
|
|
const elementFont = await element.getCssValue('font-family');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
const elementColor = await element.getCssValue('color');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//text
|
|
if (elementText === 'Download') {
|
|
console.log('Passed: Favorite Reports - Download column title matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Favorite Reports - "Download" column title; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//font
|
|
if (elementFont === "Poppins, sans-serif") {
|
|
console.log('Passed: Favorite Reports - Download column title font-family matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Favorite Reports - Download column title font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
|
|
}
|
|
|
|
//size
|
|
if (elementSize === '14px') {
|
|
console.log('Passed: Favorite Reports - Download column title text font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Favorite Reports - Download column title text font-size "14px"; Actual: "${elementSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementColor === 'rgba(94, 105, 116, 1)') {
|
|
console.log('Passed: Favorite Reports - Download column title text color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Favorite Reports - Download column title text color "rgba(94, 105, 116, 1)"'; Actual: "${elementColor}"`);
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//XLS button
|
|
{
|
|
description: 'XLS button',
|
|
action: async () => {
|
|
const multipleChecks = 'XLS button';
|
|
|
|
const element = await driver.findElement(By.css('td:nth-child(1) > .xls'));
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//icon present
|
|
if (await element.isDisplayed()) {
|
|
console.log('Passed: Format - XLS button was displayed as expected');
|
|
} else {
|
|
errors.push('Expected: XLS button was not displayed');
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Favorite Reports - Report 1 column data
|
|
{
|
|
description: 'Favorite Reports - Report column 1 data, text, and font size',
|
|
action: async () => {
|
|
const multipleChecks = 'Favorite Reports - Report column 1 data';
|
|
|
|
const element = await driver.findElement(By.css('.table:nth-child(1) tr:nth-child(1) > td:nth-child(2)'));
|
|
|
|
//Get text, font, size, and color
|
|
const elementText = await element.getText();
|
|
const elementFont = await element.getCssValue('font-family');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
const elementColor = await element.getCssValue('color');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//text
|
|
if (elementText === 'SoDontLook') {
|
|
console.log('Passed: Favorite Reports - Report column 1 data matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Favorite Reports - Report = "SoDontLook" column 1 data; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//font
|
|
if (elementFont === "Poppins, sans-serif") {
|
|
console.log('Passed: Favorite Reports - Report column 1 data font-family matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Favorite Reports - Report column 1 data font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
|
|
}
|
|
|
|
//size
|
|
if (elementSize === '14.3px') {
|
|
console.log('Passed: Favorite Reports - Report column 1 data font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Favorite Reports - Report column 1 data font-size "14.3px"; Actual: "${elementSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementColor === 'rgba(33, 37, 41, 1)') {
|
|
console.log('Passed: Favorite Reports - Report column 1 data text color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Favorite Reports - Report column 1 data text color "rgba(33, 37, 41, 1)"'; Actual: "${elementColor}"`);
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Favorite Reports - Run column 1 data
|
|
{
|
|
description: 'Favorite Reports - Run column 1 data',
|
|
action: async () => {
|
|
const multipleChecks = 'Favorite Reports - Run column 1 data';
|
|
|
|
const link = await driver.findElement(By.css('tr:nth-child(1) a.reportrun'));
|
|
const element = await link.findElement(By.css('img'));
|
|
const expectedPath = '/exact/runreport.php';
|
|
const expectedParams = {
|
|
strReportFilename: 'ThisBeMyFile',
|
|
reportTitle: 'SoDontLook',
|
|
format: '3'
|
|
};
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//icon present
|
|
if (await element.isDisplayed()) {
|
|
console.log('Passed: Run icon was displayed as expected');
|
|
} else {
|
|
errors.push('Expected: Run icon was not displayed');
|
|
}
|
|
|
|
//href path
|
|
const actualHref = await link.getAttribute('href');
|
|
const url = new URL(actualHref);
|
|
if (url.pathname === expectedPath) {
|
|
console.log('Passed: Run icon 1 href path matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Run icon 1 href path to be "${expectedPath}"; but found "${url.pathname}"`);
|
|
}
|
|
|
|
//href query parameters
|
|
for (const [key, expectedValue] of Object.entries(expectedParams)) {
|
|
const actualValue = url.searchParams.get(key);
|
|
if (actualValue === expectedValue) {
|
|
console.log('Passed: Run icon 1 href param matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Run icon 1 href param "${key}" to be "${expectedValue}"; but found "${actualValue}"`);
|
|
}
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Favorite Reports - Download column 1 data
|
|
{
|
|
description: 'Favorite Reports - Download column 1 data',
|
|
action: async () => {
|
|
const multipleChecks = 'Favorite Reports - Download column 1 data';
|
|
|
|
const link = await driver.findElement(By.css('.table:nth-child(1) tr:nth-child(1) > .text-center a'));
|
|
const element = await link.findElement(By.css('img'));
|
|
const expectedHref = 'https://correlation.edgate.com/exact/reports/exact_juan/ThisBeMyFile.xls';
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//icon present
|
|
if (await element.isDisplayed()) {
|
|
console.log('Passed: Download icon 1 was displayed as expected');
|
|
} else {
|
|
errors.push('Expected: Download icon 1 was not displayed');
|
|
}
|
|
|
|
//href
|
|
const actualHref = await link.getAttribute('href');
|
|
if (actualHref && actualHref.endsWith(expectedHref)) {
|
|
console.log('Passed: Download icon 1 href matched expected');
|
|
} else {
|
|
errors.push(`Expected: Download icon 1 href to end with "${expectedHref}"; but found "${actualHref}"`);
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//doc button
|
|
{
|
|
description: 'doc button',
|
|
action: async () => {
|
|
const multipleChecks = 'doc button';
|
|
|
|
const element = await driver.findElement(By.css('td:nth-child(1) > .doc'));
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//icon present
|
|
if (await element.isDisplayed()) {
|
|
console.log('Passed: doc button was displayed as expected');
|
|
} else {
|
|
errors.push('Expected: doc button was not displayed');
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Favorite Reports - Report 2 column data
|
|
{
|
|
description: 'Favorite Reports - Report column 2 data, text, and font size',
|
|
action: async () => {
|
|
const multipleChecks = 'Favorite Reports - Report column 2 data';
|
|
|
|
const element = await driver.findElement(By.css('.table:nth-child(1) tr:nth-child(2) > td:nth-child(2)'));
|
|
|
|
//Get text, font, size, and color
|
|
const elementText = await element.getText();
|
|
const elementFont = await element.getCssValue('font-family');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
const elementColor = await element.getCssValue('color');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//text
|
|
if (elementText === 'Test Inc.') {
|
|
console.log('Passed: Favorite Reports - Report column 2 data matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Favorite Reports - Report = "Test Inc." column 2 data; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//font
|
|
if (elementFont === "Poppins, sans-serif") {
|
|
console.log('Passed: Favorite Reports - Report column 2 data font-family matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Favorite Reports - Report column 2 data font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
|
|
}
|
|
|
|
//size
|
|
if (elementSize === '14.3px') {
|
|
console.log('Passed: Favorite Reports - Report column 2 data font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Favorite Reports - Report column 2 data font-size "14.3px"; Actual: "${elementSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementColor === 'rgba(33, 37, 41, 1)') {
|
|
console.log('Passed: Favorite Reports - Report column 2 data text color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Favorite Reports - Report column 2 data text color "rgba(33, 37, 41, 1)"'; Actual: "${elementColor}"`);
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Favorite Reports - Run column 2 data
|
|
{
|
|
description: 'Favorite Reports - Run column 2 data',
|
|
action: async () => {
|
|
const multipleChecks = 'Favorite Reports - Run column 2 data';
|
|
|
|
const link = await driver.findElement(By.css('tr:nth-child(2) a.reportrun'));
|
|
const element = await link.findElement(By.css('img'));
|
|
const expectedPath = '/exact/runreport.php';
|
|
const expectedParams = {
|
|
strReportFilename: 'WordToYa',
|
|
reportTitle: 'Test Inc.',
|
|
format: '2'
|
|
};
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//icon present
|
|
if (await element.isDisplayed()) {
|
|
console.log('Passed: Run icon 2 was displayed as expected');
|
|
} else {
|
|
errors.push('Expected: Run icon 2 was not displayed');
|
|
}
|
|
|
|
//href path
|
|
const actualHref = await link.getAttribute('href');
|
|
const url = new URL(actualHref);
|
|
if (url.pathname === expectedPath) {
|
|
console.log('Passed: Run icon 2 href path matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Run icon 2 href path to be "${expectedPath}"; but found "${url.pathname}"`);
|
|
}
|
|
|
|
//href query parameters
|
|
for (const [key, expectedValue] of Object.entries(expectedParams)) {
|
|
const actualValue = url.searchParams.get(key);
|
|
if (actualValue === expectedValue) {
|
|
console.log('Passed: Run icon 2 href param matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Run icon 2 href param "${key}" to be "${expectedValue}"; but found "${actualValue}"`);
|
|
}
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Favorite Reports - Download column 2 data
|
|
{
|
|
description: 'Favorite Reports - Download column 2 data',
|
|
action: async () => {
|
|
const multipleChecks = 'Favorite Reports - Download column 2 data';
|
|
|
|
const link = await driver.findElement(By.css('.table:nth-child(1) tr:nth-child(2) > .text-center a'));
|
|
const element = await link.findElement(By.css('img'));
|
|
const expectedHref = '/exact/reports/exact_juan/WordToYa.doc';
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//icon present
|
|
if (await element.isDisplayed()) {
|
|
console.log('Passed: Download icon 2 was displayed as expected');
|
|
} else {
|
|
errors.push('Expected: Download icon 2 was not displayed');
|
|
}
|
|
|
|
//href
|
|
const actualHref = await link.getAttribute('href');
|
|
if (actualHref && actualHref.endsWith(expectedHref)) {
|
|
console.log('Passed: Download icon 2 href matched expected');
|
|
} else {
|
|
errors.push(`Expected: Download icon 2 href to end with "${expectedHref}"; but found "${actualHref}"`);
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//pdf button
|
|
{
|
|
description: 'pdf button',
|
|
action: async () => {
|
|
const multipleChecks = 'pdf button';
|
|
|
|
const element = await driver.findElement(By.css('td:nth-child(1) > .pdf'));
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//icon present
|
|
if (await element.isDisplayed()) {
|
|
console.log('Passed: pdf button was displayed as expected');
|
|
} else {
|
|
errors.push('Expected: pdf button was not displayed');
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Favorite Reports - Report 3 column data
|
|
{
|
|
description: 'Favorite Reports - Report column 3 data, text, and font size',
|
|
action: async () => {
|
|
const multipleChecks = 'Favorite Reports - Report column 3 data';
|
|
|
|
const element = await driver.findElement(By.css('.table:nth-child(1) tr:nth-child(3) > td:nth-child(2)'));
|
|
|
|
//Get text, font, size, and color
|
|
const elementText = await element.getText();
|
|
const elementFont = await element.getCssValue('font-family');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
const elementColor = await element.getCssValue('color');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//text
|
|
if (elementText === 'What Eves') {
|
|
console.log('Passed: Favorite Reports - Report column 3 data matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Favorite Reports - Report = "What Eves" column 3 data; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//font
|
|
if (elementFont === "Poppins, sans-serif") {
|
|
console.log('Passed: Favorite Reports - Report column 3 data font-family matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Favorite Reports - Report column 3 data font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
|
|
}
|
|
|
|
//size
|
|
if (elementSize === '14.3px') {
|
|
console.log('Passed: Favorite Reports - Report column 3 data font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Favorite Reports - Report column 3 data font-size "14.3px"; Actual: "${elementSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementColor === 'rgba(33, 37, 41, 1)') {
|
|
console.log('Passed: Favorite Reports - Report column 3 data text color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Favorite Reports - Report column 3 data text color "rgba(33, 37, 41, 1)"'; Actual: "${elementColor}"`);
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Favorite Reports - Run column 3 data
|
|
{
|
|
description: 'Favorite Reports - Run column 3 data',
|
|
action: async () => {
|
|
const multipleChecks = 'Favorite Reports - Run column 3 data';
|
|
|
|
const link = await driver.findElement(By.css('tr:nth-child(3 ) a.reportrun'));
|
|
const element = await link.findElement(By.css('img'));
|
|
const expectedPath = '/exact/runreport.php';
|
|
const expectedParams = {
|
|
strReportFilename: 'IDontThinkSo',
|
|
reportTitle: 'What Eves',
|
|
format: '4'
|
|
};
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//icon present
|
|
if (await element.isDisplayed()) {
|
|
console.log('Passed: Run icon 3 was displayed as expected');
|
|
} else {
|
|
errors.push('Expected: Run icon 3 was not displayed');
|
|
}
|
|
|
|
//href path
|
|
const actualHref = await link.getAttribute('href');
|
|
const url = new URL(actualHref);
|
|
if (url.pathname === expectedPath) {
|
|
console.log('Passed: Run icon 3 href path matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Run icon 3 href path to be "${expectedPath}"; but found "${url.pathname}"`);
|
|
}
|
|
|
|
//href query parameters
|
|
for (const [key, expectedValue] of Object.entries(expectedParams)) {
|
|
const actualValue = url.searchParams.get(key);
|
|
if (actualValue === expectedValue) {
|
|
console.log('Passed: Run icon 3 href param matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Run icon 3 href param "${key}" to be "${expectedValue}"; but found "${actualValue}"`);
|
|
}
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Favorite Reports - Download column 3 data
|
|
{
|
|
description: 'Favorite Reports - Download column 3 data',
|
|
action: async () => {
|
|
const multipleChecks = 'Favorite Reports - Download column 3 data';
|
|
|
|
const link = await driver.findElement(By.css('.table:nth-child(1) tr:nth-child(3) > .text-center a'));
|
|
const element = await link.findElement(By.css('img'));
|
|
const expectedHref = '/exact/reports/exact_juan/IDontThinkSo.pdf';
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//icon present
|
|
if (await element.isDisplayed()) {
|
|
console.log('Passed: Download icon 3 was displayed as expected');
|
|
} else {
|
|
errors.push('Expected: Download icon 3 was not displayed');
|
|
}
|
|
|
|
//href
|
|
const actualHref = await link.getAttribute('href');
|
|
if (actualHref && actualHref.endsWith(expectedHref)) {
|
|
console.log('Passed: Download icon 3 href matched expected');
|
|
} else {
|
|
errors.push(`Expected: Download icon 3 href to end with "${expectedHref}"; but found "${actualHref}"`);
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//html button
|
|
{
|
|
description: 'html button',
|
|
action: async () => {
|
|
const multipleChecks = 'html button';
|
|
|
|
const element = await driver.findElement(By.css('td:nth-child(1) > .html'));
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//icon present
|
|
if (await element.isDisplayed()) {
|
|
console.log('Passed: html button was displayed as expected');
|
|
} else {
|
|
errors.push('Expected: html button was not displayed');
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Favorite Reports - Report 4 column data
|
|
{
|
|
description: 'Favorite Reports - Report column 4 data, text, and font size',
|
|
action: async () => {
|
|
const multipleChecks = 'Favorite Reports - Report column 4 data';
|
|
|
|
const element = await driver.findElement(By.css('.table:nth-child(1) tr:nth-child(4) > td:nth-child(2)'));
|
|
|
|
//Get text, font, size, and color
|
|
const elementText = await element.getText();
|
|
const elementFont = await element.getCssValue('font-family');
|
|
const elementSize = await element.getCssValue('font-size');
|
|
const elementColor = await element.getCssValue('color');
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//text
|
|
if (elementText === 'Comparing UI icons') {
|
|
console.log('Passed: Favorite Reports - Report column 4 data matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Favorite Reports - Report = "Comparing UI icons" column 4 data; Actual: "${elementText}"`);
|
|
}
|
|
|
|
//font
|
|
if (elementFont === "Poppins, sans-serif") {
|
|
console.log('Passed: Favorite Reports - Report column 4 data font-family matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Favorite Reports - Report column 4 data font-family "Poppins, sans-serif"; Actual: ${elementFont}`);
|
|
}
|
|
|
|
//size
|
|
if (elementSize === '14.3px') {
|
|
console.log('Passed: Favorite Reports - Report column 4 data font-size matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Favorite Reports - Report column 4 data font-size "14.3px"; Actual: "${elementSize}"`);
|
|
}
|
|
|
|
//color
|
|
if (elementColor === 'rgba(33, 37, 41, 1)') {
|
|
console.log('Passed: Favorite Reports - Report column 4 data text color matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Favorite Reports - Report column 4 data text color "rgba(33, 37, 41, 1)"'; Actual: "${elementColor}"`);
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Favorite Reports - Run column 4 data
|
|
{
|
|
description: 'Favorite Reports - Run column 4 data',
|
|
action: async () => {
|
|
const multipleChecks = 'Favorite Reports - Run column 4 data';
|
|
|
|
const link = await driver.findElement(By.css('tr:nth-child(4 ) a.reportrun'));
|
|
const element = await link.findElement(By.css('img'));
|
|
const expectedPath = '/exact/runreport.php';
|
|
const expectedParams = {
|
|
strReportFilename: 'Checking',
|
|
reportTitle: 'Comparing UI icons',
|
|
format: '1'
|
|
};
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//icon present
|
|
if (await element.isDisplayed()) {
|
|
console.log('Passed: Run icon 4 was displayed as expected');
|
|
} else {
|
|
errors.push('Expected: Run icon 4 was not displayed');
|
|
}
|
|
|
|
//href path
|
|
const actualHref = await link.getAttribute('href');
|
|
const url = new URL(actualHref);
|
|
if (url.pathname === expectedPath) {
|
|
console.log('Passed: Run icon 4 href path matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Run icon 4 href path to be "${expectedPath}"; but found "${url.pathname}"`);
|
|
}
|
|
|
|
//href query parameters
|
|
for (const [key, expectedValue] of Object.entries(expectedParams)) {
|
|
const actualValue = url.searchParams.get(key);
|
|
if (actualValue === expectedValue) {
|
|
console.log('Passed: Run icon 4 href param matched as expected');
|
|
} else {
|
|
errors.push(`Expected: Run icon 4 href param "${key}" to be "${expectedValue}"; but found "${actualValue}"`);
|
|
}
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//Favorite Reports - Download column 4 data
|
|
{
|
|
description: 'Favorite Reports - Download column 4 data',
|
|
action: async () => {
|
|
const multipleChecks = 'Favorite Reports - Download column 4 data';
|
|
|
|
const link = await driver.findElement(By.css('.table:nth-child(1) tr:nth-child(4) > .text-center a'));
|
|
const element = await link.findElement(By.css('img'));
|
|
const expectedHref = '/exact/reports/exact_juan/Checking.html';
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//icon present
|
|
if (await element.isDisplayed()) {
|
|
console.log('Passed: Download icon 4 was displayed as expected');
|
|
} else {
|
|
errors.push('Expected: Download icon 4 was not displayed');
|
|
}
|
|
|
|
//href
|
|
const actualHref = await link.getAttribute('href');
|
|
if (actualHref && actualHref.endsWith(expectedHref)) {
|
|
console.log('Passed: Download icon 4 href matched expected');
|
|
} else {
|
|
errors.push(`Expected: Download icon 4 href to end with "${expectedHref}"; but found "${actualHref}"`);
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//FOOTER
|
|
//EdGate Footer Logo
|
|
{
|
|
description: 'EdGate Footer Logo',
|
|
action: async () => {
|
|
const multipleChecks = 'EdGate Footer Logo';
|
|
|
|
const element = await driver.findElement(By.css('.pull-right img'));
|
|
const expectedSrc = 'https://correlation.edgate.com/exact/images/edgate_logo_new.png';
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
//icon present
|
|
if (await element.isDisplayed()) {
|
|
console.log('Passed: EdGate logo was displayed as expected');
|
|
} else {
|
|
errors.push('Expected: EdGate logo was not displayed');
|
|
}
|
|
|
|
//image src
|
|
const actualSrc = await element.getAttribute('src');
|
|
if (actualSrc && actualSrc === expectedSrc) {
|
|
console.log('Passed: EdGate logo src matched expected');
|
|
} else {
|
|
errors.push(`Expected: EdGate logo src: "${expectedSrc}"; but found "${actualSrc}"`);
|
|
}
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
|
|
//NEXT ACTION
|
|
{
|
|
description: 'Log Out',
|
|
action: async () => {
|
|
const multipleChecks = 'Log Out';
|
|
|
|
//Track all errors
|
|
const errors = [];
|
|
|
|
await driver.findElement(By.css('#navbarDropdown > span')).click();
|
|
await driver.sleep(2000);
|
|
await driver.findElement(By.linkText('Log Out')).click();
|
|
console.log('----->| NEXT ACTION: Clicked User Profile and Logged Out');
|
|
|
|
//Wait until the element exists in the DOM
|
|
const exactLogo = await driver.wait(
|
|
until.elementLocated(By.css('.logo')),
|
|
30000
|
|
);
|
|
|
|
//Wait until it becomes visible
|
|
await driver.wait(
|
|
until.elementIsVisible(exactLogo),
|
|
30000
|
|
);
|
|
|
|
//Wait for page to load completely
|
|
await driver.wait(async () => {
|
|
const readyState = await driver.executeScript('return document.readyState');
|
|
return readyState === 'complete';
|
|
}, 30000, 'ExACT Langing page did not fully load within 30 seconds');
|
|
console.log('Passed: ExACT Landing Page loaded successfully');
|
|
|
|
//Throw summary if any validation failed
|
|
if (errors.length > 0) {
|
|
//Add summary line only when multiple checks failed
|
|
if (errors.length > 1) {
|
|
errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`);
|
|
}
|
|
|
|
//Throw collected messages — catch() will prefix with "FAILED:"
|
|
throw new Error(errors.join('\n'));
|
|
}
|
|
}
|
|
},
|
|
];
|
|
|
|
const logStep = (worksheet, stepDescription, status, stepIndex, timestamp, screenshotPath) => {
|
|
const json_data = XLSX.utils.sheet_to_json(worksheet, { header: 1 });
|
|
json_data.push([stepIndex, stepDescription, status, timestamp, screenshotPath]);
|
|
return XLSX.utils.aoa_to_sheet(json_data);
|
|
};
|
|
|
|
const takeScreenshot = async (driver, stepIndex, stepDescription) => {
|
|
const screenshot = await driver.takeScreenshot();
|
|
|
|
const dir = path.join('screenshots', 'correlationsDashboard');
|
|
|
|
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', 'correlationsDashboard');
|
|
if (fs.existsSync(screenshotDir)) {
|
|
fs.rmSync(screenshotDir, { recursive: true, force: true });
|
|
}
|
|
fs.mkdirSync(screenshotDir, { recursive: true });
|
|
|
|
//Remove old Excel file
|
|
if (fs.existsSync('correlationsDashboard.xlsx')) {
|
|
fs.unlinkSync('correlationsDashboard.xlsx');
|
|
}
|
|
};
|
|
|
|
try {
|
|
//Initialize workbook and worksheet
|
|
clearOldResults();
|
|
|
|
//Initialize workbook and worksheet
|
|
workbook = XLSX.utils.book_new();
|
|
worksheet = XLSX.utils.aoa_to_sheet([
|
|
['Step Number', 'Step Description', 'Status', 'Timestamp', 'Screenshot']
|
|
]);
|
|
XLSX.utils.book_append_sheet(workbook, worksheet, 'Sheet1');
|
|
|
|
//Log test start time
|
|
worksheet = logStep(worksheet, 'Test Start', 'Started', '', startTime, '');
|
|
|
|
let allStepsPassed = true;
|
|
|
|
const failedSteps = []; //Track failed steps
|
|
|
|
for (const step of steps) {
|
|
const stepIndex = steps.indexOf(step) + 1;
|
|
const timestamp = new Date().toISOString();
|
|
|
|
try {
|
|
//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}`);
|
|
failedSteps.push(`Step ${stepIndex}: ${step.description} - ${error.message}`); //Track failed step
|
|
testStatus = 'Failed';
|
|
allStepsPassed = false;
|
|
}
|
|
}
|
|
|
|
//Check if log out was successful
|
|
if (allStepsPassed) {
|
|
console.log('------------->| THE END |<-------------');
|
|
console.log('PASSED: CORRELATIONS DASHBOARD(correlationsDashboard); All test steps completed successfully');
|
|
testStatus = 'Passed';
|
|
} else {
|
|
console.log('------------->| THE END |<-------------');
|
|
console.log('FAILED: CORRELATIONS DASHBOARD(correlationsDashboard); One or more test steps failed');
|
|
console.log('FAILED STEPS:');
|
|
failedSteps.forEach(step => console.error(` ✗ ${step}`));
|
|
testStatus = 'Failed';
|
|
}
|
|
|
|
//Log test end time
|
|
const endTime = new Date().toISOString();
|
|
worksheet = logStep(worksheet, 'Test End', testStatus, '', endTime, '');
|
|
|
|
//Write the updated worksheet back to the workbook and save it
|
|
workbook.Sheets['Sheet1'] = worksheet;
|
|
XLSX.writeFile(workbook, 'correlationsDashboard.xlsx');
|
|
} finally {
|
|
await driver.quit();
|
|
}
|
|
})();
|
|
}
|
|
|
|
export default correlationsDashboard;
|