Files
EdGateAutomatedRegression/tests/ExACT_frameworkManagementPage.js

4231 lines
154 KiB
JavaScript

import { Builder, By, Key, until } from 'selenium-webdriver';
import fs from 'fs';
import XLSX from 'xlsx';
import path from 'path';
const ExACT_frameworkManagementPage = (req, res) => {
res.send('<h2>ExACT Automated Test Script: Framework Management Page(ExACT_frameworkManagementPage); Initiated</h2>');
(async function example() {
let driver = await new Builder().forBrowser('chrome').build();
let testStatus = 'Failed';
let workbook;
let worksheet;
const startTime = new Date().toISOString();
const steps = [
{ description: 'Navigate to ExACT Landing Page', action: async () => await driver.navigate().to('https://stage.edgate.com/exact/login.php') }, //PROD - https://correlation.edgate.com/exact/login.php
{ description: 'Expand browser', action: async () => await driver.manage().window().maximize() },
//LOGIN
{ description: 'Enter username', action: async () => await driver.findElement(By.css('.form-control:nth-child(2)')).sendKeys('exact_juan') },
{ description: 'Enter password', action: async () => await driver.findElement(By.css('.passfield')).sendKeys('Edgate1!') },
{ description: 'Click Login button', action: async () => await driver.findElement(By.css('.login')).click() },
{ description: 'Wait for login process to complete', action: async () => await driver.sleep(10000) },
//Wait for dashboard to load - Correlation Coverages View Details button
{
description: 'Wait for dashboard load to completely',
action: async () => {
return await driver.wait(until.elementLocated(By.linkText('View Details')), 10000).catch(() => false);
}
},
//Dashboard title
{
description: 'Validate dashboard title',
action: async () => {
const elementText = await driver.findElement(By.css('.e-heading')).getText();
if (elementText !== 'Correlation Dashboard') {
throw new Error(`Expected: "Correlation Dashboard"; Actual: "${elementText}"`);
}
console.log('Passed: Dashboard title matched as expected');
}
},
//Align icon color -gray
{
description: 'Validate Align icon color',
action: async () => {
const elementStyle = await driver.findElement(By.css('.fb-align')).getCssValue('color');
if (elementStyle !== 'rgba(99, 99, 99, 1)') {
throw new Error(`Align icon color did not match; Actual: "${elementStyle}"`);
}
console.log('Passed: Align icon color matched as expected');
}
},
//NEXT ACTION - Navigate to Framework Management page
{ description: 'Click Frameworks navigation link', action: async () => await driver.findElement(By.linkText('Frameworks')).click() },
//Wait for page to load - Correlation Coverages View Details button
{
description: 'Wait for page to load',
action: async () => {
return await driver.wait(until.elementLocated(By.css('h2')), 10000).catch(() => false);
}
},
//Framework Management page title
{
description: 'Validate Framework Management page title',
action: async () => {
const elementText = await driver.findElement(By.css('h2')).getText();
if (elementText !== 'Framework Management') {
throw new Error(`Expected: "Framework Management" page title; Actual: "${elementText}"`);
}
console.log('Passed: Framework Management page title matched as expected');
}
},
//Framework Management page title text color -dark blue
{
description: 'Validate Framework Management page title text color',
action: async () => {
const elementStyle = await driver.findElement(By.css('h2')).getCssValue('color');
if (elementStyle !== 'rgba(40, 39, 90, 1)') {
throw new Error(`Framework Management page title text color did not match; Actual: "${elementStyle}"`);
}
console.log('Passed: Framework Management page title text color matched as expected');
}
},
//Framework Management page title text font
{
description: 'Validate Framework Management page title text font size',
action: async () => {
const elementStyle = await driver.findElement(By.css('h2')).getCssValue('font-size');
if (elementStyle !== '32px') {
throw new Error(`Framework Management page title text font-size did not match; Actual: "${elementStyle}"`);
}
console.log('Passed: Framework Management page title text font-size matched as expected');
}
},
//Publishing button icon
{
description: 'Verify Publishing buttion icon is present',
action: async () =>
{ const expectedIcon = await driver.wait(until.elementLocated(By.css('.btn > .fa-cloud-upload')), 5000).catch(() => false);
if (!expectedIcon) {
throw new Error('Publishing button icon not found');
}
console.log('Passed: Publishing button icon present');
}
},
//Publishing button text
{
description: 'Validate Publishing button text',
action: async () => {
const elementText = await driver.findElement(By.linkText('Publishing')).getText();
if (elementText !== 'Publishing') {
throw new Error(`Expected: "Publishing" button text; Actual: "${elementText}"`);
}
console.log('Passed: Publishging button text matched as expected');
}
},
//Publishing button color -green
{
description: 'Validate Publishing button color',
action: async () => {
const elementStyle = await driver.findElement(By.linkText('Publishing')).getCssValue('background-color');
if (elementStyle !== 'rgba(48, 200, 172, 1)') {
throw new Error(`Publishing button color did not match; Actual: "${elementStyle}"`);
}
console.log('Passed: Publishing button color matched as expected');
}
},
//NEXT ACTION - Click Publishing button
{ description: 'Click Publishing button', action: async () => await driver.findElement(By.linkText('Publishing')).click() },
//Publishing Page
{
description: 'Wait for Publishing page to load',
action: async () =>
{ const expectedIcon = await driver.wait(until.elementLocated(By.css('h2')), 5000).catch(() => false);
if (!expectedIcon) {
throw new Error('Publishing page did not load');
}
console.log('Passed: Publishing page loaded');
}
},
//Framework Publishing page title
{
description: 'Validate Framework Publishing page title',
action: async () => {
const elementText = await driver.findElement(By.css('h2')).getText();
if (elementText !== 'Framework Publishing') {
throw new Error(`Expected: "Framework Publishing" page title text; Actual: "${elementText}"`);
}
console.log('Passed: Framework Publishing page title text matched as expected');
}
},
//NEXT ACTION - Navigate to Framework Management page
{ description: 'Click Frameworks navigation link', action: async () => await driver.findElement(By.linkText('Frameworks')).click() },
//Wait for page to load - Correlation Coverages View Details button
{
description: 'Wait for page to load',
action: async () => {
return await driver.wait(until.elementLocated(By.css('h2')), 10000).catch(() => false);
}
},
//Import Framework button icon
{
description: 'Verify Import Framework buttion icon is present',
action: async () =>
{ const expectedIcon = await driver.wait(until.elementLocated(By.css('.fa-upload')), 5000).catch(() => false);
if (!expectedIcon) {
throw new Error('Import Framework button icon not found');
}
console.log('Passed: Import Framework button icon present');
}
},
//Import Framework button text
{
description: 'Validate Import Framework button text',
action: async () => {
const elementText = await driver.findElement(By.linkText('Import Framework')).getText();
if (elementText !== 'Import Framework') {
throw new Error(`Expected: "Import Framework" button text; Actual: "${elementText}"`);
}
console.log('Passed: Import Framework button text matched as expected');
}
},
//Import Framework button color -green
{
description: 'Validate Import Framework button color',
action: async () => {
const elementStyle = await driver.findElement(By.linkText('Import Framework')).getCssValue('background-color');
if (elementStyle !== 'rgba(48, 200, 172, 1)') {
throw new Error(`Import Framework button color did not match; Actual: "${elementStyle}"`);
}
console.log('Passed: Import Framework button color matched as expected');
}
},
//NEXT ACTION - Click Import Framework button
{ description: 'Click Import Framework button', action: async () => await driver.findElement(By.linkText('Import Framework')).click() },
//Import Framework DIV
{
description: 'Wait for Import Framework DIV to open',
action: async () =>
{ const expectedIcon = await driver.wait(until.elementLocated(By.css('.modal-lg .modal-title')), 5000).catch(() => false);
if (!expectedIcon) {
throw new Error('Import Framework DIV did not open');
}
console.log('Passed: Import Framework DIV opened');
}
},
//Import Framework DIV title
{
description: 'Validate Import Framework DIV title',
action: async () => {
const elementText = await driver.findElement(By.css('.modal-lg .modal-title')).getText();
if (elementText !== 'Import Framework') {
throw new Error(`Expected: "Import Framework" DIV title text; Actual: "${elementText}"`);
}
console.log('Passed: Import Framework DIV title text matched as expected');
}
},
//X icon DIV color -red
{
description: 'Validate X icon color',
action: async () => {
const elementStyle = await driver.findElement(By.css('.modal-lg .modal-header span')).getCssValue('color');
if (elementStyle !== 'rgba(246, 60, 40, 1)') {
throw new Error(`DIV "X" icon color did not match; Actual: "${elementStyle}"`);
}
console.log('Passed: DIV X icon color matched as expected');
}
},
//Import Into label
{
description: 'Validate Import Into label',
action: async () => {
const elementText = await driver.findElement(By.css('#divtype > .form-label')).getText();
if (elementText !== 'Import Into') {
throw new Error(`Expected: "Import Into" label text; Actual: "${elementText}"`);
}
console.log('Passed: Import Into label text matched as expected');
}
},
//Import Into dropdown "New = <Create New Framework"
{
description: 'Validate Import Into dropdown option',
action: async () => {
const elementOption = await driver.findElement(By.css('#target')).getAttribute('value');
if (elementOption !== 'new') {
throw new Error(`Expected: "<Create New Framework>"; Actual: "${elementOption}"`);
}
console.log('Passed: <Create New Framework> dropdown option matched as expected');
}
},
//Name label
{
description: 'Validate Name label',
action: async () => {
const elementText = await driver.findElement(By.css('#divname > .form-label')).getText();
if (elementText !== 'Name') {
throw new Error(`Expected: "Name" label text; Actual: "${elementText}"`);
}
console.log('Passed: Name label text matched as expected');
}
},
//Name textbox
{
description: 'Validate Name textbox value',
action: async () => {
const elementValue = await driver.findElement(By.css('#orgname')).getText();
if (elementValue !== '') {
throw new Error(`Expected: "Blank" Name textbox value; Actual: "${elementValue}"`);
}
console.log('Passed: Blank Name textbox value matched as expected');
}
},
//Upload File label
{
description: 'Validate Upload File label',
action: async () => {
const elementText = await driver.findElement(By.css('#divupload > .form-label')).getText();
if (elementText !== 'Upload File') {
throw new Error(`Expected: "Upload File" label text; Actual: "${elementText}"`);
}
console.log('Passed: Upload File label text matched as expected');
}
},
//Upload File type
{
description: 'Validate Upload File type',
action: async () => {
const elementText = await driver.findElement(By.css('#upload')).getAttribute('type');
if (elementText !== 'file') {
throw new Error(`Expected: "file" type; Actual: "${elementText}"`);
}
console.log('Passed: File type matched as expected');
}
},
//Parent label
{
description: 'Validate Parent label',
action: async () => {
const elementText = await driver.findElement(By.css('#divparent > .form-label')).getText();
if (elementText !== 'Parent') {
throw new Error(`Expected: "Parent" label text; Actual: "${elementText}"`);
}
console.log('Passed: Parent label text matched as expected');
}
},
//Parent dropdown
{
description: 'Validate Parent dropdown',
action: async () => {
const elementText = await driver.findElement(By.css('#parent > option:nth-child(1)')).getText();
if (elementText !== 'None') {
throw new Error(`Expected: Parent dropdown "None" default text; Actual: "${elementText}"`);
}
console.log('Passed: Parent dropdown None default text matched as expected');
}
},
//Download Import Template button icon
{
description: 'Verify Download Import Template buttion icon is present',
action: async () =>
{ const expectedIcon = await driver.wait(until.elementLocated(By.css('.mr-auto > .fa')), 5000).catch(() => false);
if (!expectedIcon) {
throw new Error('Download Import Template button icon not found');
}
console.log('Passed: Download Import Template button icon present');
}
},
//Download Import Template button text
{
description: 'Validate Download Import Template button text',
action: async () => {
const elementText = await driver.findElement(By.linkText('Download Import Template')).getText();
if (elementText !== 'Download Import Template') {
throw new Error(`Expected: "Download Import Template" button text; Actual: "${elementText}"`);
}
console.log('Passed: Download Import Template button text matched as expected');
}
},
//Download Import Template button color -green
{
description: 'Validate Download Import Template button color',
action: async () => {
const elementStyle = await driver.findElement(By.linkText('Download Import Template')).getCssValue('background-color');
if (elementStyle !== 'rgba(48, 200, 172, 1)') {
throw new Error(`Download Import Template button color did not match; Actual: "${elementStyle}"`);
}
console.log('Passed: Download Import Template button color matched as expected');
}
},
//Import button text
{
description: 'Validate Import button text',
action: async () => {
const elementText = await driver.findElement(By.css('#modalop')).getAttribute('value');
if (elementText !== 'Import') {
throw new Error(`Expected: "Import" button text; Actual: "${elementText}"`);
}
console.log('Passed: Import button text matched as expected');
}
},
//Import button color -green
{
description: 'Validate Import button color',
action: async () => {
const elementStyle = await driver.findElement(By.css('#modalop')).getCssValue('background-color');
if (elementStyle !== 'rgba(48, 200, 172, 1)') {
throw new Error(`Import button color did not match; Actual: "${elementStyle}"`);
}
console.log('Passed: Import button color matched as expected');
}
},
//Close button text
{
description: 'Validate Close button text',
action: async () => {
const elementText = await driver.findElement(By.css('#modalclose')).getText();
if (elementText !== 'Close') {
throw new Error(`Expected: "Close" button text; Actual: "${elementText}"`);
}
console.log('Passed: Close button text matched as expected');
}
},
//Close button color -white
{
description: 'Validate Close button color',
action: async () => {
const elementStyle = await driver.findElement(By.css('#modalclose')).getCssValue('background-color');
if (elementStyle !== 'rgba(0, 0, 0, 0)') {
throw new Error(`Close button color did not match; Actual: "${elementStyle}"`);
}
console.log('Passed: Close button color matched as expected');
}
},
//NEXT ACTION - Import Framework DIV validation
{ description: 'Click Import button', action: async () => await driver.findElement(By.css('#modalop')).click() },
{ description: 'Wait for action to complete', action: async () => await driver.sleep(2000) },
//Valiation text
{
description: 'Validattion text',
action: async () => {
const elementText = await driver.findElement(By.css('b')).getText();
if (elementText !== 'Please enter a value for all highlighted fields') {
throw new Error(`Expected: "Please enter a value for all highlighted fields" validation text; Actual: "${elementText}"`);
}
console.log('Passed: Validation text matched as expected');
}
},
//Validation text color -red
{
description: 'Validate text color',
action: async () => {
const elementStyle = await driver.findElement(By.css('b')).getCssValue('color');
if (elementStyle !== 'rgba(220, 53, 69, 1)') {
throw new Error(`Validation text color did not match; Actual: "${elementStyle}"`);
}
console.log('Passed: Validation text color matched as expected');
}
},
//NEXT ACTION - DIV X-Close Icon
{ description: 'Click DIV X icon', action: async () => await driver.findElement(By.css('.modal-lg .modal-header span')).click() },
{ description: 'Wait for action to complete', action: async () => await driver.sleep(2000) },
//Create button icon
{
description: 'Verify Create buttion icon is present',
action: async () =>
{ const expectedIcon = await driver.wait(until.elementLocated(By.css('.fa-plus-circle')), 5000).catch(() => false);
if (!expectedIcon) {
throw new Error('Create button icon not found');
}
console.log('Passed: Create button icon present');
}
},
//Create button text
{
description: 'Validate Create button text',
action: async () => {
const elementText = await driver.findElement(By.linkText('Create')).getText();
if (elementText !== 'Create') {
throw new Error(`Expected: "Create" button text; Actual: "${elementText}"`);
}
console.log('Passed: Create button text matched as expected');
}
},
//Create button color -green
{
description: 'Validate Create button color',
action: async () => {
const elementStyle = await driver.findElement(By.linkText('Create')).getCssValue('background-color');
if (elementStyle !== 'rgba(48, 200, 172, 1)') {
throw new Error(`Create button color did not match; Actual: "${elementStyle}"`);
}
console.log('Passed: Create button color matched as expected');
}
},
//NEXT ACTION - Click Create button
{ description: 'Click Create button', action: async () => await driver.findElement(By.linkText('Create')).click() },
//Create DIV
{
description: 'Wait for Create DIV to load',
action: async () =>
{ const expectedIcon = await driver.wait(until.elementLocated(By.css('.modal-lg .modal-title')), 5000).catch(() => false);
if (!expectedIcon) {
throw new Error('Create DIV did not load');
}
console.log('Passed: Create DIV loaded');
}
},
//Create DIV title
{
description: 'Validate Create DIV title',
action: async () => {
const elementText = await driver.findElement(By.css('.modal-lg .modal-title')).getText();
if (elementText !== 'Create Organization/Framework') {
throw new Error(`Expected: "Create Organization/Framework" DIV title text; Actual: "${elementText}"`);
}
console.log('Passed: Create Organization/Framework DIV title text matched as expected');
}
},
//X icon DIV color -red
{
description: 'Validate X icon color',
action: async () => {
const elementStyle = await driver.findElement(By.css('.modal-lg .modal-header span')).getCssValue('color');
if (elementStyle !== 'rgba(246, 60, 40, 1)') {
throw new Error(`DIV "X" icon color did not match; Actual: "${elementStyle}"`);
}
console.log('Passed: DIV X icon color matched as expected');
}
},
//Type label
{
description: 'Validate Type label',
action: async () => {
const elementText = await driver.findElement(By.css('#divtype > .form-label')).getText();
if (elementText !== 'Type') {
throw new Error(`Expected: "Type" label text; Actual: "${elementText}"`);
}
console.log('Passed: Type label text matched as expected');
}
},
//Type dropdown (C= Organization)
{
description: 'Validate Type dropdown option',
action: async () => {
const elementOption = await driver.findElement(By.css('#orgtype')).getAttribute('value');
if (elementOption !== 'C') {
throw new Error(`Expected: "Organization"; Actual: "${elementOption}"`);
}
console.log('Passed: Organization dropdown option matched as expected');
}
},
//Name label
{
description: 'Validate Name label',
action: async () => {
const elementText = await driver.findElement(By.css('#divname > .form-label')).getText();
if (elementText !== 'Name') {
throw new Error(`Expected: "Name" label text; Actual: "${elementText}"`);
}
console.log('Passed: Name label text matched as expected');
}
},
//Name textbox
{
description: 'Validate Name textbox value',
action: async () => {
const elementValue = await driver.findElement(By.css('#orgname')).getText();
if (elementValue !== '') {
throw new Error(`Expected: "Blank" Name textbox value; Actual: "${elementValue}"`);
}
console.log('Passed: Blank Name textbox value matched as expected');
}
},
//Notes label
{
description: 'Validate Notes label',
action: async () => {
const elementText = await driver.findElement(By.css('#divnotes > .form-label')).getText();
if (elementText !== 'Notes') {
throw new Error(`Expected: "Notes" label text; Actual: "${elementText}"`);
}
console.log('Passed: Notes label text matched as expected');
}
},
//Notes textbox
{
description: 'Validate Notes textbox',
action: async () => {
const elementText = await driver.findElement(By.css('#notes')).getText();
if (elementText !== '') {
throw new Error(`Expected: "Blank" Notes textbox value; Actual: "${elementText}"`);
}
console.log('Passed: Blank Notes textboxd value matched as expected');
}
},
//Notes textbox
{
description: 'Validate Notes textbox value',
action: async () => {
const elementValue = await driver.findElement(By.css('#notes')).getText();
if (elementValue !== '') {
throw new Error(`Expected: "Blank" Notes textbox value; Actual: "${elementValue}"`);
}
console.log('Passed: Blank Notes textbox value matched as expected');
}
},
//Create button text
{
description: 'Validate Create button text',
action: async () => {
const elementText = await driver.findElement(By.css('#modalop')).getAttribute('value');
if (elementText !== 'Create') {
throw new Error(`Expected: "Create" button text; Actual: "${elementText}"`);
}
console.log('Passed: Create button text matched as expected');
}
},
//Create button color -green
{
description: 'Validate Create button color',
action: async () => {
const elementStyle = await driver.findElement(By.css('#modalop')).getCssValue('background-color');
if (elementStyle !== 'rgba(48, 200, 172, 1)') {
throw new Error(`Create button color did not match; Actual: "${elementStyle}"`);
}
console.log('Passed: Create button color matched as expected');
}
},
//Close button text
{
description: 'Validate Close button text',
action: async () => {
const elementText = await driver.findElement(By.css('#modalclose')).getText();
if (elementText !== 'Close') {
throw new Error(`Expected: "Close" button text; Actual: "${elementText}"`);
}
console.log('Passed: Close button text matched as expected');
}
},
//Close button color -white
{
description: 'Validate Close button color',
action: async () => {
const elementStyle = await driver.findElement(By.css('#modalclose')).getCssValue('background-color');
if (elementStyle !== 'rgba(0, 0, 0, 0)') {
throw new Error(`Close button color did not match; Actual: "${elementStyle}"`);
}
console.log('Passed: Close button color matched as expected');
}
},
//NEXT ACTION - Create DIV validation
{ description: 'Click Import button', action: async () => await driver.findElement(By.css('#modalop')).click() },
{ description: 'Wait for action to complete', action: async () => await driver.sleep(2000) },
//Valiation text
{
description: 'Validattion text',
action: async () => {
const elementText = await driver.findElement(By.css('b')).getText();
if (elementText !== 'Please enter a value for all highlighted fields') {
throw new Error(`Expected: "Please enter a value for all highlighted fields" validation text; Actual: "${elementText}"`);
}
console.log('Passed: Validation text matched as expected');
}
},
//Validation text color -red
{
description: 'Validate text color',
action: async () => {
const elementStyle = await driver.findElement(By.css('b')).getCssValue('color');
if (elementStyle !== 'rgba(220, 53, 69, 1)') {
throw new Error(`Validation text color did not match; Actual: "${elementStyle}"`);
}
console.log('Passed: Validation text color matched as expected');
}
},
//NEXT ACTION - DIV Close button
{ description: 'Click DIV Close icon', action: async () => await driver.findElement(By.css('#modalclose')).click() },
{ description: 'Wait for action to complete', action: async () => await driver.sleep(2000) },
//Search textbox
{
description: 'Verify Search textbox is present',
action: async () =>
{ const expectedIcon = await driver.wait(until.elementLocated(By.css('#FilterOrganization')), 5000).catch(() => false);
if (!expectedIcon) {
throw new Error('Search textbox not found');
}
console.log('Passed: Search textbox present');
}
},
//Search textbox icon
{
description: 'Verify Search textbox icon is present',
action: async () =>
{ const expectedIcon = await driver.wait(until.elementLocated(By.css('.fa-times')), 5000).catch(() => false);
if (!expectedIcon) {
throw new Error('Search textbox icon not found');
}
console.log('Passed: Search textbox icon present');
}
},
//Advanced Search button icon
{
description: 'Verify Advanced Search buttion icon is present',
action: async () =>
{ const expectedIcon = await driver.wait(until.elementLocated(By.css('.fa-plus-circle')), 5000).catch(() => false);
if (!expectedIcon) {
throw new Error('Advanced Search button icon not found');
}
console.log('Passed: Advanced Search button icon present');
}
},
//Advanced Search button text
{
description: 'Validate Advanced Search button text',
action: async () => {
const elementText = await driver.findElement(By.css('div:nth-child(4) > .btn')).getText();
if (elementText !== 'Advanced Search') {
throw new Error(`Expected: "Advanced Search" button text; Actual: "${elementText}"`);
}
console.log('Passed: Advanced Search button text matched as expected');
}
},
//Advanced Search button color -green
{
description: 'Validate Advanced Search button color',
action: async () => {
const elementStyle = await driver.findElement(By.css('div:nth-child(4) > .btn')).getCssValue('background-color');
if (elementStyle !== 'rgba(48, 200, 172, 1)') {
throw new Error(`Advanced Search button color did not match; Actual: "${elementStyle}"`);
}
console.log('Passed: Advanced Search button color matched as expected');
}
},
//NEXT ACTION - Advanced Search button
{ description: 'Click Advanced Search button', action: async () => await driver.findElement(By.css('div:nth-child(4) > .btn')).click() },
//Advanced Search DIV
{
description: 'Wait for Advanced Search DIV to load',
action: async () =>
{ const expectedIcon = await driver.wait(until.elementLocated(By.css('#exampleModalCenterTitle')), 5000).catch(() => false);
if (!expectedIcon) {
throw new Error('Advanced Search DIV did not load');
}
console.log('Passed: Advanced Search DIV loaded');
}
},
//Advanced Search DIV title
{
description: 'Validate Advanced Search DIV title',
action: async () => {
const elementText = await driver.findElement(By.css('#exampleModalCenterTitle')).getText();
if (elementText !== 'Advance Framework Search') {
throw new Error(`Expected: "Advance Framework Search" DIV title text; Actual: "${elementText}"`);
}
console.log('Passed: Advance Framework Search DIV title text matched as expected');
}
},
//X icon DIV color -red
{
description: 'Validate X icon color',
action: async () => {
const elementStyle = await driver.findElement(By.css('.modal-dialog-centered .modal-header span')).getCssValue('color');
if (elementStyle !== 'rgba(246, 60, 40, 1)') {
throw new Error(`DIV "X" icon color did not match; Actual: "${elementStyle}"`);
}
console.log('Passed: DIV X icon color matched as expected');
}
},
//Search in handle
{
description: 'Validate Search in handle',
action: async () => {
const elementText = await driver.findElement(By.css('.col-sm-12:nth-child(1) > label')).getText();
if (elementText !== 'Search in') {
throw new Error(`Expected: "Search in" handle text; Actual: "${elementText}"`);
}
console.log('Passed: Search in handle text matched as expected');
}
},
//Search in dropdown text
{
description: 'Validate Search in dropdown option',
action: async () => {
const elementOption = await driver.findElement(By.css('#feild')).getAttribute('value');
if (elementOption !== 'stdtext') {
throw new Error(`Expected: "Item Text"; Actual: "${elementOption}"`);
}
console.log('Passed: Item Text dropdown option matched as expected');
}
},
//Search term textbox -placeholder
{
description: 'Validate Search term textbox placeholder',
action: async () => {
const elementValue = await driver.findElement(By.css('#searchterm')).getAttribute('placeholder');
if (elementValue !== 'Enter a search term') {
throw new Error(`Expected: Search term "Enter a search term" textbox placeholder; Actual: "${elementValue}"`);
}
console.log('Passed: Enter a search term textbox placeholder matched as expected');
}
},
//Match phrase checkbox
{
description: 'Verify Match phrase checkbox is present',
action: async () =>
{ const expectedIcon = await driver.wait(until.elementLocated(By.css('.col-sm-12:nth-child(3) > input')), 5000).catch(() => false);
if (!expectedIcon) {
throw new Error('Match exact phrase checkbox not found');
}
console.log('Passed: Match exact phrase checkbox present');
}
},
//Match exact phrase label
{
description: 'Validate Match exact phrase label',
action: async () => {
const elementText = await driver.findElement(By.css('.ml-2:nth-child(2)')).getText();
if (elementText !== 'Match exact phrase') {
throw new Error(`Expected: "Match exact phrase" label; Actual: "${elementText}"`);
}
console.log('Passed: Match exact phrase label matched as expected');
}
},
//Filter By text
{
description: 'Validate Filter By text',
action: async () => {
const elementText = await driver.findElement(By.css('.col-sm-12:nth-child(4) > label')).getText();
if (elementText !== 'Filter By') {
throw new Error(`Expected: "Filter By" text; Actual: "${elementText}"`);
}
console.log('Passed: Filter By text matched as expected');
}
},
//Framework label
{
description: 'Validate Framework label',
action: async () => {
const elementText = await driver.findElement(By.css('.col-sm-6:nth-child(1) > label')).getText();
if (elementText !== 'Framework') {
throw new Error(`Expected: "Framework" label; Actual: "${elementText}"`);
}
console.log('Passed: Framework label matched as expected');
}
},
//Framework textbox -placeholder
{
description: 'Validate Framework textbox placeholder',
action: async () => {
const elementValue = await driver.findElement(By.css('#framesearch > div.modal-body > div.row.mt-2 > div:nth-child(1) > span > span.selection > span > span > textarea')).getAttribute('placeholder');
if (elementValue !== 'All Framework') {
throw new Error(`Expected: Framework "All Framework" textbox placeholder; Actual: "${elementValue}"`);
}
console.log('Passed: Framework All Framework textbox placeholder matched as expected');
}
},
//Level label
{
description: 'Validate Level label',
action: async () => {
const elementText = await driver.findElement(By.css('.col-sm-6:nth-child(2) > label')).getText();
if (elementText !== 'Level') {
throw new Error(`Expected: "Level" label; Actual: "${elementText}"`);
}
console.log('Passed: Level label matched as expected');
}
},
//Level textbox -value
{
description: 'Validate Level textbox value',
action: async () => {
const elementValue = await driver.findElement(By.css('#level')).getAttribute('value');
if (elementValue !== 'all') {
throw new Error(`Expected: Level "All" textbox value; Actual: "${elementValue}"`);
}
console.log('Passed: Level All textbox value matched as expected');
}
},
//Subject label
{
description: 'Validate Subject label',
action: async () => {
const elementText = await driver.findElement(By.css('.col-sm-6:nth-child(3) > label')).getText();
if (elementText !== 'Subject') {
throw new Error(`Expected: "Subject" label; Actual: "${elementText}"`);
}
console.log('Passed: Subject label matched as expected');
}
},
//Subject textbox -placeholder
{
description: 'Validate Subject textbox placeholder',
action: async () => {
const elementValue = await driver.findElement(By.css('#subject > span > span.selection > span > span > textarea')).getAttribute('placeholder');
if (elementValue !== 'All Subject') {
throw new Error(`Expected: Subject "All Subject" textbox placeholder; Actual: "${elementValue}"`);
}
console.log('Passed: Subjectd All Subject textbox placeholder matched as expected');
}
},
//Grade label
{
description: 'Validate Grade label',
action: async () => {
const elementText = await driver.findElement(By.css('.col-sm-6:nth-child(4) > label')).getText();
if (elementText !== 'Grade') {
throw new Error(`Expected: "Grade" label; Actual: "${elementText}"`);
}
console.log('Passed: Grade label matched as expected');
}
},
//Grade textbox -placeholder
{
description: 'Validate Grade textbox placeholder',
action: async () => {
const elementValue = await driver.findElement(By.css('#grade > span > span.selection > span > span > textarea')).getAttribute('placeholder');
if (elementValue !== ' All Grade') {
throw new Error(`Expected: Grade "All Grade" textbox placeholder; Actual: "${elementValue}"`);
}
console.log('Passed: Grade All Grade textbox placeholder matched as expected');
}
},
//Close button text
{
description: 'Validate Close button text',
action: async () => {
const elementText = await driver.findElement(By.css('.btn-secondary:nth-child(1)')).getText();
if (elementText !== 'Close') {
throw new Error(`Expected: "Close" button text; Actual: "${elementText}"`);
}
console.log('Passed: Close button text matched as expected');
}
},
//Close button color -white
{
description: 'Validate Close button color',
action: async () => {
const elementStyle = await driver.findElement(By.css('.btn-secondary:nth-child(1)')).getCssValue('background-color');
if (elementStyle !== 'rgba(0, 0, 0, 0)') {
throw new Error(`Close button color did not match; Actual: "${elementStyle}"`);
}
console.log('Passed: Close button color matched as expected');
}
},
//Submit button text
{
description: 'Validate Submit button text',
action: async () => {
const elementText = await driver.findElement(By.css('.modal-footer:nth-child(2) > .btn-primary')).getText();
if (elementText !== 'Submit') {
throw new Error(`Expected: "Submit" button text; Actual: "${elementText}"`);
}
console.log('Passed: Submit button text matched as expected');
}
},
//Submit button color -green
{
description: 'Validate Submit button color',
action: async () => {
const elementStyle = await driver.findElement(By.css('.modal-footer:nth-child(2) > .btn-primary')).getCssValue('background-color');
if (elementStyle !== 'rgba(48, 200, 172, 1)') {
throw new Error(`Submit button color did not match; Actual: "${elementStyle}"`);
}
console.log('Passed: Submit button color matched as expected');
}
},
//NEXT ACTION - Advance Framework Search DIV validation
{ description: 'Click Submit button', action: async () => await driver.findElement(By.css('.modal-footer:nth-child(2) > .btn-primary')).click() },
{ description: 'Wait for action to complete', action: async () => await driver.sleep(2000) },
//NEXT ACTION - DIV Close button
{ description: 'Click DIV Close icon', action: async () => await driver.findElement(By.css('.modal-dialog-centered .modal-header span')).click() },
{ description: 'Wait for action to complete', action: async () => await driver.sleep(2000) },
//FRAMEWORK LIST: 4Folder + 6files
//File icon 1
{
description: 'Verify File icon 1 is present',
action: async () =>
{ const expectedIcon = await driver.wait(until.elementLocated(By.css('.org:nth-child(1) > .fa')), 5000).catch(() => false);
if (!expectedIcon) {
throw new Error('File icon 1 not found');
}
console.log('Passed: File icon 1 present');
}
},
//Framework 1 title
{
description: 'Validate Framework 1 title',
action: async () => {
const elementText = await driver.findElement(By.linkText('5th Grade Import ECS-2732')).getText();
if (elementText !== '5th Grade Import ECS-2732') {
throw new Error(`Expected: "5th Grade Import ECS-2732" title text; Actual: "${elementText}"`);
}
console.log('Passed: 5th Grade Import ECS-2732 title text matched as expected');
}
},
//Folder icon 1
{
description: 'Verify Folder icon 1 is present',
action: async () =>
{ const expectedIcon = await driver.wait(until.elementLocated(By.css('#folder874461689')), 5000).catch(() => false);
if (!expectedIcon) {
throw new Error('Folder icon 1 not found');
}
console.log('Passed: Folder icon 1 present');
}
},
//Framework 2 title
{
description: 'Validate Framework 2 title',
action: async () => {
const elementText = await driver.findElement(By.linkText('Adding a New Org to test with')).getText();
if (elementText !== 'Adding a New Org to test with') {
throw new Error(`Expected: "Adding a New Org to test with" title text; Actual: "${elementText}"`);
}
console.log('Passed: Adding a New Org to test with title text matched as expected');
}
},
//Folder icon 2
{
description: 'Verify Folder icon 2 is present',
action: async () =>
{ const expectedIcon = await driver.wait(until.elementLocated(By.css('#folder874452736')), 5000).catch(() => false);
if (!expectedIcon) {
throw new Error('Folder icon 2 not found');
}
console.log('Passed: Folder icon 2 present');
}
},
//Framework 3 title
{
description: 'Validate Framework 3 title',
action: async () => {
const elementText = await driver.findElement(By.linkText('ECS-2732 Testing Frame II')).getText();
if (elementText !== 'ECS-2732 Testing Frame II') {
throw new Error(`Expected: "ECS-2732 Testing Frame II" title text; Actual: "${elementText}"`);
}
console.log('Passed: ECS-2732 Testing Frame II title text matched as expected');
}
},
//File icon 2
{
description: 'Verify File icon 2 is present',
action: async () =>
{ const expectedIcon = await driver.wait(until.elementLocated(By.css('.list-group-item:nth-child(4) > .fa')), 5000).catch(() => false);
if (!expectedIcon) {
throw new Error('File icon 2 not found');
}
console.log('Passed: File icon 2 present');
}
},
//Framework 4 title
{
description: 'Validate Framework 4 title',
action: async () => {
const elementText = await driver.findElement(By.linkText('Kathleen Test')).getText();
if (elementText !== 'Kathleen Test') {
throw new Error(`Expected: "Kathleen Test" title text; Actual: "${elementText}"`);
}
console.log('Passed: Kathleen Test title text matched as expected');
}
},
//Folder icon 3
{
description: 'Verify Folder icon 3 is present',
action: async () =>
{ const expectedIcon = await driver.wait(until.elementLocated(By.css('#folder873575829')), 5000).catch(() => false);
if (!expectedIcon) {
throw new Error('Folder icon 3 not found');
}
console.log('Passed: Folder icon 3 present');
}
},
//Framework 5 title
{
description: 'Validate Framework 5 title',
action: async () => {
const elementText = await driver.findElement(By.linkText('Latest Test For Today')).getText();
if (elementText !== 'Latest Test For Today') {
throw new Error(`Expected: "Latest Test For Today" title text; Actual: "${elementText}"`);
}
console.log('Passed: Latest Test For Today title text matched as expected');
}
},
//Folder icon 4
{
description: 'Verify Folder icon 4 is present',
action: async () =>
{ const expectedIcon = await driver.wait(until.elementLocated(By.css('#folder873617737')), 5000).catch(() => false);
if (!expectedIcon) {
throw new Error('Folder icon 4 not found');
}
console.log('Passed: Folder icon 4 present');
}
},
//Framework 6 title
{
description: 'Validate Framework 6 title',
action: async () => {
const elementText = await driver.findElement(By.linkText('My Latest Organization For Now')).getText();
if (elementText !== 'My Latest Organization For Now') {
throw new Error(`Expected: "My Latest Organization For Now" title text; Actual: "${elementText}"`);
}
console.log('Passed: My Latest Organization For Now title text matched as expected');
}
},
//File icon 3
{
description: 'Verify File icon 3 is present',
action: async () =>
{ const expectedIcon = await driver.wait(until.elementLocated(By.css('.list-group-item:nth-child(7) > .fa')), 5000).catch(() => false);
if (!expectedIcon) {
throw new Error('File icon 3 not found');
}
console.log('Passed: File icon 3 present');
}
},
//Framework 7 title
{
description: 'Validate Framework 7 title',
action: async () => {
const elementText = await driver.findElement(By.linkText('Stats Test Framework')).getText();
if (elementText !== 'Stats Test Framework') {
throw new Error(`Expected: "Stats Test Framework" title text; Actual: "${elementText}"`);
}
console.log('Passed: Stats Test Framework title text matched as expected');
}
},
//File icon 4
{
description: 'Verify File icon 4 is present',
action: async () =>
{ const expectedIcon = await driver.wait(until.elementLocated(By.css('.list-group-item:nth-child(8) > .fa')), 5000).catch(() => false);
if (!expectedIcon) {
throw new Error('File icon 4 not found');
}
console.log('Passed: File icon 4 present');
}
},
//Framework 8 title
{
description: 'Validate Framework 8 title',
action: async () => {
const elementText = await driver.findElement(By.linkText('Test Math: Grade 9')).getText();
if (elementText !== 'Test Math: Grade 9') {
throw new Error(`Expected: "Test Math: Grade 9" title text; Actual: "${elementText}"`);
}
console.log('Passed: Test Math: Grade 9 title text matched as expected');
}
},
//File icon 5
{
description: 'Verify File icon 5 is present',
action: async () =>
{ const expectedIcon = await driver.wait(until.elementLocated(By.css('.list-group-item:nth-child(9) > .fa')), 5000).catch(() => false);
if (!expectedIcon) {
throw new Error('File icon 5 not found');
}
console.log('Passed: File icon 5 present');
}
},
//Framework 9 title
{
description: 'Validate Framework 9 title',
action: async () => {
const elementText = await driver.findElement(By.linkText('Thursday Framework')).getText();
if (elementText !== 'Thursday Framework') {
throw new Error(`Expected: "Thursday Framework" title text; Actual: "${elementText}"`);
}
console.log('Passed: Thursday Framework title text matched as expected');
}
},
//File icon 6
{
description: 'Verify File icon 6 is present',
action: async () =>
{ const expectedIcon = await driver.wait(until.elementLocated(By.css('.list-group-item:nth-child(10) > .fa')), 5000).catch(() => false);
if (!expectedIcon) {
throw new Error('File icon 6 not found');
}
console.log('Passed: File icon 6 present');
}
},
//Framework 10 title
{
description: 'Validate Framework 10 title',
action: async () => {
const elementText = await driver.findElement(By.linkText('Widget Test')).getText();
if (elementText !== 'Widget Test') {
throw new Error(`Expected: "Widget Test" title text; Actual: "${elementText}"`);
}
console.log('Passed: Widget Test title text matched as expected');
}
},
//NEXT ACTION - Click My Latest Organization For Now link
{ description: 'Click My Latest Organization For Now link', action: async () => await driver.findElement(By.linkText('My Latest Organization For Now')).click() },
{ description: 'Wait for action to complete', action: async () => await driver.sleep(2000) },
//My Latest Organization For Now Open file icon is present
{
description: 'Verify My Latest Organization For Now Open file icon is present',
action: async () =>
{ const expectedIcon = await driver.wait(until.elementLocated(By.css('#folder873617737')), 5000).catch(() => false);
if (!expectedIcon) {
throw new Error('My Latest Organization For Now Open file icon is not present');
}
console.log('Passed: My Latest Organization For Now Open file icon is present');
}
},
//Juan Testing Again & Again Edit icon is present
{
description: 'Verify My Latest Organization For Now Edit icon is present',
action: async () =>
{ const expectedIcon = await driver.wait(until.elementLocated(By.css('.list-group-item:nth-child(6) > .opts .fa')), 5000).catch(() => false);
if (!expectedIcon) {
throw new Error('My Latest Organization For Now Edit icon is not present');
}
console.log('Passed: My Latest Organization For Now Edit icon is present');
}
},
//At the Office File icon is present
{
description: 'Verify At the Office File icon is present',
action: async () =>
{ const expectedIcon = await driver.wait(until.elementLocated(By.css('#org-873617737 > .list-group-item:nth-child(1) > .fa')), 5000).catch(() => false);
if (!expectedIcon) {
throw new Error('At the Office File icon is not present');
}
console.log('Passed: At the Office File icon is present');
}
},
//At the Office title
{
description: 'Validate At the Office title',
action: async () => {
const elementText = await driver.findElement(By.linkText('At The Office')).getText();
if (elementText !== 'At The Office') {
throw new Error(`Expected: "At The Office" title text; Actual: "${elementText}"`);
}
console.log('Passed: At The Office title text matched as expected');
}
},
//Juan Testing Again & Again File icon is present
{
description: 'Verify Juan Testing Again & Again File icon is present',
action: async () =>
{ const expectedIcon = await driver.wait(until.elementLocated(By.css('.doc:nth-child(2) > .fa')), 5000).catch(() => false);
if (!expectedIcon) {
throw new Error('Juan Testing Again & Again File icon is not present');
}
console.log('Passed: Juan Testing Again & Again File icon is present');
}
},
//Juan Testing Again & Again title
{
description: 'Validate Juan Testing Again & Again title',
action: async () => {
const elementText = await driver.findElement(By.linkText('Juan Testing Again & Again')).getText();
if (elementText !== 'Juan Testing Again & Again') {
throw new Error(`Expected: "Juan Testing Again & Again" title text; Actual: "${elementText}"`);
}
console.log('Passed: Juan Testing Again & Again title text matched as expected');
}
},
//NEXT ACTION - Click My Latest Organization For Now Edit icon
{ description: 'Click My Latest Organization For Now Edit icon', action: async () => await driver.findElement(By.css('.list-group-item:nth-child(6) > .opts .fa')).click() },
//Organization DIV
{
description: 'Wait for Edit Organization DIV to open',
action: async () =>
{ const expectedIcon = await driver.wait(until.elementLocated(By.css('.modal-lg .modal-title')), 5000).catch(() => false);
if (!expectedIcon) {
throw new Error('Edit Organization DIV did not open');
}
console.log('Passed: Edit Organization DIV opened');
}
},
//Edit Organization title
{
description: 'Validate Edit Organization DIV title',
action: async () => {
const elementText = await driver.findElement(By.css('.modal-lg .modal-title')).getText();
if (elementText !== 'Edit Organization') {
throw new Error(`Expected: "Edit Organization" DIV title text; Actual: "${elementText}"`);
}
console.log('Passed: Edit Organization DIV title text matched as expected');
}
},
//X icon DIV color -red
{
description: 'Validate X icon color',
action: async () => {
const elementStyle = await driver.findElement(By.css('.modal-lg .modal-header span')).getCssValue('color');
if (elementStyle !== 'rgba(246, 60, 40, 1)') {
throw new Error(`DIV "X" icon color did not match; Actual: "${elementStyle}"`);
}
console.log('Passed: DIV X icon color matched as expected');
}
},
//Type label
{
description: 'Validate Type label',
action: async () => {
const elementText = await driver.findElement(By.css('#divtype > .form-label')).getText();
if (elementText !== 'Type') {
throw new Error(`Expected: "Type" label text; Actual: "${elementText}"`);
}
console.log('Passed: Type label text matched as expected');
}
},
//Type Info icon is present
{
description: 'Verify Type Info icon is present',
action: async () =>
{ const expectedIcon = await driver.wait(until.elementLocated(By.css('a:nth-child(2) > .fa-question-circle')), 5000).catch(() => false);
if (!expectedIcon) {
throw new Error('Type Info icon is not present');
}
console.log('Passed: Type Info icon is present');
}
},
//Organization label
{
description: 'Validate Organization label',
action: async () => {
try {
const element = await driver.findElement(By.css('#divtype'));
//Get different versions of the text for debugging
const fullText = await element.getText();
//Check for the expected text in different ways
const expectedText = 'Organization';
const trimmedFullText = fullText.trim();
const firstLine = trimmedFullText.split('\n')[0].trim();
//Try multiple matching strategies
if (firstLine.includes(expectedText)) {
console.log(`Passed: "${expectedText}" text in first line`);
} else if (trimmedFullText.includes(expectedText)) {
console.log(`Passed: "${expectedText}" text within full text`);
} else {
throw new Error(
`Text validation failed.\nExpected: "${expectedText}"\n` +
`Full text: "${fullText}"\n` +
`First line: "${firstLine}"\n`
);
}
} catch (error) {
console.error('Detailed error during validation:', error);
throw error; //Re-throw after logging
}
}
},
//Organization value
{
description: 'Validate Organization value',
action: async () => {
try {
const element = await driver.findElement(By.css('#divname > .form-label'));
//Get different versions of the text for debugging
const fullText = await element.getText();
//Check for the expected text in different ways
const expectedText = 'Name';
const trimmedFullText = fullText.trim();
const firstLine = trimmedFullText.split('\n')[0].trim();
//Try multiple matching strategies
if (firstLine.includes(expectedText)) {
console.log(`Passed: "${expectedText}" text in first line`);
} else if (trimmedFullText.includes(expectedText)) {
console.log(`Passed: "${expectedText}" text within full text`);
} else {
throw new Error(
`Text validation failed.\nExpected: "${expectedText}"\n` +
`Full text: "${fullText}"\n` +
`First line: "${firstLine}"\n`
);
}
} catch (error) {
console.error('Detailed error during validation:', error);
throw error; //Re-throw after logging
}
}
},
//Name textbox
{
description: 'Validate Name textbox value',
action: async () => {
const elementValue = await driver.findElement(By.css('#orgname')).getAttribute('value');
if (elementValue !== 'My Latest Organization For Now') {
throw new Error(`Expected: Name textbox, "My Latest Organization For Now" value; Actual: "${elementValue}"`);
}
console.log('Passed: Name textbox, My Latest Organization For Now value matched as expected');
}
},
//Notes label
{
description: 'Validate Notes label',
action: async () => {
const elementText = await driver.findElement(By.css('#divnotes > .form-label')).getText();
if (elementText !== 'Notes') {
throw new Error(`Expected: "Notes" label text; Actual: "${elementText}"`);
}
console.log('Passed: Notes label text matched as expected');
}
},
//Notes textbox
{
description: 'Validate Notes textbox value',
action: async () => {
const elementValue = await driver.findElement(By.css('#notes')).getText();
if (elementValue !== 'Would this make a difference.') {
throw new Error(`Expected: Notest textbox, "Would this make a difference." value; Actual: "${elementValue}"`);
}
console.log('Passed: Notes textbox, Would this make a difference. value matched as expected');
}
},
//Delete button text
{
description: 'Validate Delete button text',
action: async () => {
const elementText = await driver.findElement(By.css('#orgdelete')).getText();
if (elementText !== 'Delete') {
throw new Error(`Expected: "Delete" button text; Actual: "${elementText}"`);
}
console.log('Passed: Delete button text matched as expected');
}
},
//Delete button color -red
{
description: 'Validate Delete button color',
action: async () => {
const elementStyle = await driver.findElement(By.css('#orgdelete')).getCssValue('background-color');
if (elementStyle !== 'rgba(220, 53, 69, 1)') {
throw new Error(`Delete button color did not match; Actual: "${elementStyle}"`);
}
console.log('Passed: Delete button color matched as expected');
}
},
//Save button text
{
description: 'Validate Save button text',
action: async () => {
const elementText = await driver.findElement(By.css('#modalop')).getAttribute('value');
if (elementText !== 'Save') {
throw new Error(`Expected: "Save" button text; Actual: "${elementText}"`);
}
console.log('Passed: Save button text matched as expected');
}
},
//Save button color -green
{
description: 'Validate Save button color',
action: async () => {
const elementStyle = await driver.findElement(By.css('#modalop')).getCssValue('background-color');
if (elementStyle !== 'rgba(48, 200, 172, 1)') {
throw new Error(`Save button color did not match; Actual: "${elementStyle}"`);
}
console.log('Passed: Save button color matched as expected');
}
},
//Close button text
{
description: 'Validate Close button text',
action: async () => {
const elementText = await driver.findElement(By.css('#modalclose')).getText();
if (elementText !== 'Close') {
throw new Error(`Expected: "Close" button text; Actual: "${elementText}"`);
}
console.log('Passed: Close button text matched as expected');
}
},
//Close button color -white
{
description: 'Validate Close button color',
action: async () => {
const elementStyle = await driver.findElement(By.css('#modalclose')).getCssValue('background-color');
if (elementStyle !== 'rgba(0, 0, 0, 0)') {
throw new Error(`Close button color did not match; Actual: "${elementStyle}"`);
}
console.log('Passed: Close button color matched as expected');
}
},
//NEXT ACTION - Close DIV
{ description: 'Click Close button', action: async () => await driver.findElement(By.css('#modalclose')).click() },
{ description: 'Wait for action to complete', action: async () => await driver.sleep(2000) },
//NEXT ACTION - Click Juan Testing Again & Again file icon
{ description: 'Click Juan Testing Again & Again file icon', action: async () => await driver.findElement(By.css('.doc:nth-child(2) > .fa')).click() },
{ description: 'Wait for action to complete', action: async () => await driver.sleep(2000) },
//Juan Testing Again & Again Upload icon is present
{
description: 'Verify Juan Testing Again & Again Upload icon is present',
action: async () =>
{ const expectedIcon = await driver.wait(until.elementLocated(By.css('.list-group-item:nth-child(2) > .float-right .fa-cloud-upload')), 5000).catch(() => false);
if (!expectedIcon) {
throw new Error('Juan Testing Again & Again Upload icon is not present');
}
console.log('Passed: Juan Testing Again & Again Upload icon is present');
}
},
//Juan Testing Again & Again View icon is present
{
description: 'Verify Juan Testing Again & Again View icon is present',
action: async () =>
{ const expectedIcon = await driver.wait(until.elementLocated(By.css('.list-group-item:nth-child(2) > .float-right > .frame-name > .fa')), 5000).catch(() => false);
if (!expectedIcon) {
throw new Error('Juan Testing Again & Again View icon is not present');
}
console.log('Passed: Juan Testing Again & Again View icon is present');
}
},
//Juan Testing Again & Again Download icon is present
{
description: 'Verify Juan Testing Again & Again Download icon is present',
action: async () =>
{ const expectedIcon = await driver.wait(until.elementLocated(By.css('.list-group-item:nth-child(2) > .float-right .fa-download')), 5000).catch(() => false);
if (!expectedIcon) {
throw new Error('Juan Testing Again & Again Download icon is not present');
}
console.log('Passed: Juan Testing Again & Again Download icon is present');
}
},
//Juan Testing Again & Again Info icon is present
{
description: 'Verify Juan Testing Again & Again Info icon is present',
action: async () =>
{ const expectedIcon = await driver.wait(until.elementLocated(By.css('.list-group-item:nth-child(2) > .float-right .fa-info-circle')), 5000).catch(() => false);
if (!expectedIcon) {
throw new Error('Juan Testing Again & Again Info icon is not present');
}
console.log('Passed: Juan Testing Again & Again Info icon is present');
}
},
//Juan Testing Again & Again Edit icon 2 is present
{
description: 'Verify Juan Testing Again & Again Edit icon 2 is present',
action: async () =>
{ const expectedIcon = await driver.wait(until.elementLocated(By.css('.list-group-item:nth-child(2) > .float-right .fa-pencil-square-o')), 5000).catch(() => false);
if (!expectedIcon) {
throw new Error('Juan Testing Again & Again Edit icon 2 is not present');
}
console.log('Passed: Juan Testing Again & Again Edit icon 2 is present');
}
},
//NEXT ACTION - Click Juan Testing Again & Again upload icon
{ description: 'Click Juan Testing Again & Again upload icon', action: async () => await driver.findElement(By.css('.list-group-item:nth-child(2) > .float-right .fa-cloud-upload')).click() },
//Publish Framework DIV
{
description: 'Wait for DIV to open',
action: async () =>
{ const expectedIcon = await driver.wait(until.elementLocated(By.css('.modal-lg .modal-title')), 5000).catch(() => false);
if (!expectedIcon) {
throw new Error('Publish Framework DIV did not open');
}
console.log('Passed: Publish Framework DIV opened');
}
},
//Publish Framework DIV title
{
description: 'Validate Publish Framework DIV title',
action: async () => {
const elementText = await driver.findElement(By.css('.modal-lg .modal-title')).getText();
if (elementText !== 'Publish Framework') {
throw new Error(`Expected: "Publish Framework" DIV title text; Actual: "${elementText}"`);
}
console.log('Passed: Publish Framework DIV title text matched as expected');
}
},
//X icon DIV color -red
{
description: 'Validate X icon color',
action: async () => {
const elementStyle = await driver.findElement(By.css('.modal-lg .modal-header span')).getCssValue('color');
if (elementStyle !== 'rgba(246, 60, 40, 1)') {
throw new Error(`DIV "X" icon color did not match; Actual: "${elementStyle}"`);
}
console.log('Passed: DIV X icon color matched as expected');
}
},
//Framework label
{
description: 'Validate Framework label',
action: async () => {
const elementText = await driver.findElement(By.css('#divtype > .form-label')).getText();
if (elementText !== 'Framework') {
throw new Error(`Expected: "Framework" label text; Actual: "${elementText}"`);
}
console.log('Passed: Framework label text matched as expected');
}
},
//Framework textbox
{
description: 'Validate Framework textbox value',
action: async () => {
const elementValue = await driver.findElement(By.css('#org')).getAttribute('value');
if (elementValue !== '873575832') {
throw new Error(`Expected: Framework textbox, "Juan Testing Again & Again" value; Actual: "${elementValue}"`);
}
console.log('Passed: Framework textbox, Juan Testing Again & Again value matched as expected');
}
},
//Display Title label
{
description: 'Validate Display Title label',
action: async () => {
const elementText = await driver.findElement(By.css('#divname > .form-label')).getText();
if (elementText !== 'Display Title') {
throw new Error(`Expected: "Display Title" label text; Actual: "${elementText}"`);
}
console.log('Passed: Display Title label text matched as expected');
}
},
//Display Title Info icon is present
{
description: 'Verify Display Title Info icon is present',
action: async () =>
{ const expectedIcon = await driver.wait(until.elementLocated(By.css('#divname .fa')), 5000).catch(() => false);
if (!expectedIcon) {
throw new Error('Display Title Info icon is not present');
}
console.log('Passed: Display Title Info icon is present');
}
},
//Display Title textbox
{
description: 'Validate Display Title textbox value',
action: async () => {
const elementValue = await driver.findElement(By.css('#title')).getAttribute('value');
if (elementValue !== '') {
throw new Error(`Expected: "Blank" Display Title textbox value; Actual: "${elementValue}"`);
}
console.log('Passed: Blank Display Title textbo value matched as expected');
}
},
//Version label
{
description: 'Validate Version label',
action: async () => {
const elementText = await driver.findElement(By.css('#divsource > .form-label')).getText();
if (elementText !== 'Version') {
throw new Error(`Expected: "Version" label text; Actual: "${elementText}"`);
}
console.log('Passed: Version label text matched as expected');
}
},
//Version Info icon is present
{
description: 'Verify Version Info icon is present',
action: async () =>
{ const expectedIcon = await driver.wait(until.elementLocated(By.css('#divsource .fa')), 5000).catch(() => false);
if (!expectedIcon) {
throw new Error('Version Info icon is not present');
}
console.log('Passed: Version Info icon is present');
}
},
//Version textbox
{
description: 'Validate Version Title textbox value',
action: async () => {
const elementValue = await driver.findElement(By.css('#version')).getAttribute('value');
if (elementValue !== '') {
throw new Error(`Expected: "Blank" Version Title textbox value; Actual: "${elementValue}"`);
}
console.log('Passed: Blank Version Title textbox value matched as expected');
}
},
//Display Status label
{
description: 'Validate Display Status label',
action: async () => {
const elementText = await driver.findElement(By.css('#divpublisher > .form-label')).getText();
if (elementText !== 'Display Status') {
throw new Error(`Expected: "Display Status" label text; Actual: "${elementText}"`);
}
console.log('Passed: Display Status label text matched as expected');
}
},
//Display Status Info icon is present
{
description: 'Verify Display Status Info icon is present',
action: async () =>
{ const expectedIcon = await driver.wait(until.elementLocated(By.css('#divpublisher .fa')), 5000).catch(() => false);
if (!expectedIcon) {
throw new Error('Display Status Info icon is not present');
}
console.log('Passed: Display Status Info icon is present');
}
},
//Display Status textbox
{
description: 'Validate Display Status textbox value',
action: async () => {
const elementValue = await driver.findElement(By.css('#status')).getAttribute('value');
if (elementValue !== 'Implemented') {
throw new Error(`Expected: Display Status textbox, "Implemented" value; Actual: "${elementValue}"`);
}
console.log('Passed: Display Status textbox, Implemented value matched as expected');
}
},
//Group label
{
description: 'Validate Group label',
action: async () => {
const elementText = await driver.findElement(By.css('#divparent > .form-label')).getText();
if (elementText !== 'Group') {
throw new Error(`Expected: "Group" label text; Actual: "${elementText}"`);
}
console.log('Passed: Group label text matched as expected');
}
},
//Group Info icon is present
{
description: 'Verify Group Info icon is present',
action: async () =>
{ const expectedIcon = await driver.wait(until.elementLocated(By.css('#divparent .fa')), 5000).catch(() => false);
if (!expectedIcon) {
throw new Error('Group Info icon is not present');
}
console.log('Passed: Group Info icon is present');
}
},
//Group textbox
{
description: 'Validate Group textbox value',
action: async () => {
const elementValue = await driver.findElement(By.css('#group')).getAttribute('value');
if (elementValue !== '7') {
throw new Error(`Expected: Group textbox, "Initial Framework Group for Testing" value; Actual: "${elementValue}"`);
}
console.log('Passed: Group textbox, Initial Framework Group for Testing value matched as expected');
}
},
//Download Formats label
{
description: 'Validate Download Formats label',
action: async () => {
const elementText = await driver.findElement(By.css('#divcreator > .form-label')).getText();
if (elementText !== 'Download Formats') {
throw new Error(`Expected: "Download Formats" label text; Actual: "${elementText}"`);
}
console.log('Passed: Download Formats label text matched as expected');
}
},
//Download Formats Info icon is present
{
description: 'Verify Download Formats Info icon is present',
action: async () =>
{ const expectedIcon = await driver.wait(until.elementLocated(By.css('#divcreator .fa')), 5000).catch(() => false);
if (!expectedIcon) {
throw new Error('Download Formats Info icon is not present');
}
console.log('Passed: Download Formats Info icon is present');
}
},
//CSV checkbox -active
{
description: 'Validate CSV checkbox option enabled',
action: async () => {
const elementStyle = await driver.findElement(By.css('#formatcsv')).getAttribute('checked');
if (elementStyle !== 'true') {
throw new Error(`CSV checkbox option value checked did not match; Actual: "${elementStyle}"`);
}
console.log('Passed: CSV checkbox option value matched as expected');
}
},
//CSV label
{
description: 'Validate CSV label',
action: async () => {
const elementText = await driver.findElement(By.css('#divcreator > .form-check:nth-child(4) > .form-check-label')).getText();
if (elementText !== 'CSV') {
throw new Error(`Expected: "CSV" label text; Actual: "${elementText}"`);
}
console.log('Passed: CSV label text matched as expected');
}
},
//PDF checkbox -active
{
description: 'Validate PDF checkbox option enabled',
action: async () => {
const elementStyle = await driver.findElement(By.css('#formatpdf')).getAttribute('checked');
if (elementStyle !== 'true') {
throw new Error(`PDF checkbox option value checked did not match; Actual: "${elementStyle}"`);
}
console.log('Passed: PDF checkbox option value matched as expected');
}
},
//PDF label
{
description: 'Validate PDF label',
action: async () => {
const elementText = await driver.findElement(By.css('.form-check:nth-child(5) > .form-check-label')).getText();
if (elementText !== 'PDF') {
throw new Error(`Expected: "PDF" label text; Actual: "${elementText}"`);
}
console.log('Passed: PDF label text matched as expected');
}
},
//CASE JSON/API* checkbox -active
{
description: 'Validate CASE JSON API checkbox option enabled',
action: async () => {
const elementStyle = await driver.findElement(By.css('#formatcase')).getAttribute('checked');
if (elementStyle !== 'true') {
throw new Error(`CASE JSON/API* checkbox option value checked did not match; Actual: "${elementStyle}"`);
}
console.log('Passed: CASE JSON/API* checkbox option value matched as expected');
}
},
//CASE JSON/API* label
{
description: 'Validate CASE JSON API label',
action: async () => {
const elementText = await driver.findElement(By.css('.form-check:nth-child(6) > .form-check-label')).getText();
if (elementText !== 'CASE JSON/API*') {
throw new Error(`Expected: "CASE JSON/API*" label text; Actual: "${elementText}"`);
}
console.log('Passed: CASE JSON/API* label text matched as expected');
}
},
//Asterisk icons is present
{
description: 'Validate Asterisk icons',
action: async () =>
{ const expectedIcon = await driver.wait(until.elementLocated(By.css('#divcreator')), 5000).catch(() => false);
if (!expectedIcon) {
throw new Error('Asterisk icon is not present');
}
console.log('Passed: Asterisk icon is present');
}
},
//Asterisk label
{
description: 'Validate Asterisk label',
action: async () => {
const elementText = await driver.findElement(By.css('small')).getText();
if (elementText !== 'This option also allows access to this framework via CASE compliant API') {
throw new Error(`Expected: "This option also allows access to this framework via CASE compliant API" label text; Actual: "${elementText}"`);
}
console.log('Passed: This option also allows access to this framework via CASE compliant API label text matched as expected');
}
},
//Comment Settings label
{
description: 'Validate Comment Settings label',
action: async () => {
const elementText = await driver.findElement(By.css('#divstatus > .form-label')).getText();
if (elementText !== 'Comment Settings') {
throw new Error(`Expected: "Comment Settings" label text; Actual: "${elementText}"`);
}
console.log('Passed: Comment Settings label text matched as expected');
}
},
//Allow Comments checkbox -active
{
description: 'Validate Allow Comments checkbox option enabled',
action: async () => {
const elementStyle = await driver.findElement(By.css('#comments')).getAttribute('checked');
if (elementStyle !== 'true') {
throw new Error(`Allow Comments checkbox option value checked did not match; Actual: "${elementStyle}"`);
}
console.log('Passed: Allow Comments checkbox option value matched as expected');
}
},
//Allow Comments label
{
description: 'Validate Allow Comments label',
action: async () => {
const elementText = await driver.findElement(By.css('.form-check:nth-child(3) > .form-check-label')).getText();
if (elementText !== 'Allow Comments') {
throw new Error(`Expected: "Allow Comments" label text; Actual: "${elementText}"`);
}
console.log('Passed: Allow Comments label text matched as expected');
}
},
//Comments are private checkbox
{
description: 'Verify Comments are private checkbox is present',
action: async () =>
{ const expectedIcon = await driver.wait(until.elementLocated(By.css('#private')), 5000).catch(() => false);
if (!expectedIcon) {
throw new Error('Comments are private checkbox not found');
}
console.log('Passed: Comments are private checkbox present');
}
},
//Comments are private label
{
description: 'Validate Comments are private label',
action: async () => {
const elementText = await driver.findElement(By.css('#divstatus > .form-check:nth-child(4) > .form-check-label')).getText();
if (elementText !== 'Comments are private') {
throw new Error(`Expected: "Comments are private" label text; Actual: "${elementText}"`);
}
console.log('Passed: Comments are private label text matched as expected');
}
},
//Publisher's Notes label
{
description: 'Validate Publishers Notes label',
action: async () => {
const elementText = await driver.findElement(By.css('#divpubnotes > .form-label')).getText();
if (elementText !== `Publisher's Notes`) {
throw new Error(`Expected: "Publisher's Notes" label text; Actual: "${elementText}"`);
}
console.log(`Passed: Publisher's Notes label text matched as expected`);
}
},
//Publisher's Notes textbox
{
description: 'Validate Publishers Notes textbox value',
action: async () => {
const elementValue = await driver.findElement(By.css('#pubnotes')).getAttribute('value');
if (elementValue !== '') {
throw new Error(`Expected: "Blank" Publisher's Notes textbox value; Actual: "${elementValue}"`);
}
console.log(`Passed: Blank Publisher's Notes textbox value matched as expected`);
}
},
//Publish button text
{
description: 'Validate Publish button text',
action: async () => {
const elementText = await driver.findElement(By.css('#modalop')).getAttribute('value');
if (elementText !== 'Publish') {
throw new Error(`Expected: "Publish" button text; Actual: "${elementText}"`);
}
console.log('Passed: Publish button text matched as expected');
}
},
//Publish button color -green
{
description: 'Validate Publish button color',
action: async () => {
const elementStyle = await driver.findElement(By.css('#modalop')).getCssValue('background-color');
if (elementStyle !== 'rgba(48, 200, 172, 1)') {
throw new Error(`Publish button color did not match; Actual: "${elementStyle}"`);
}
console.log('Passed: Publish button color matched as expected');
}
},
//Close button text
{
description: 'Validate Close button text',
action: async () => {
const elementText = await driver.findElement(By.css('#modalclose')).getText();
if (elementText !== 'Close') {
throw new Error(`Expected: "Close" button text; Actual: "${elementText}"`);
}
console.log('Passed: Close button text matched as expected');
}
},
//Close button color -white
{
description: 'Validate Close button color',
action: async () => {
const elementStyle = await driver.findElement(By.css('#modalclose')).getCssValue('background-color');
if (elementStyle !== 'rgba(0, 0, 0, 0)') {
throw new Error(`Close button color did not match; Actual: "${elementStyle}"`);
}
console.log('Passed: Close button color matched as expected');
}
},
//NEXT ACTION - Publish Framework -validation
{ description: 'Click Publish button', action: async () => await driver.findElement(By.css('#modalop')).click() },
{ description: 'Wait for action to complete', action: async () => await driver.sleep(2000) },
//Display Title valiation text
{
description: 'Display Title validattion text',
action: async () => {
const elementText = await driver.findElement(By.css('#divname > .invalid-feedback')).getText();
if (elementText !== 'You must enter a framework title') {
throw new Error(`Expected: "You must enter a framework title" Display Title validation text; Actual: "${elementText}"`);
}
console.log('Passed: Display Title validation text matched as expected');
}
},
//Display Title validation text color -red
{
description: 'Validate text color',
action: async () => {
const elementStyle = await driver.findElement(By.css('#divname > .invalid-feedback')).getCssValue('color');
if (elementStyle !== 'rgba(220, 53, 69, 1)') {
throw new Error(`Display Title validation text color did not match; Actual: "${elementStyle}"`);
}
console.log('Passed: Display Title validation text color matched as expected');
}
},
//Version valiation text
{
description: 'Version validattion text',
action: async () => {
const elementText = await driver.findElement(By.css('#divsource > .invalid-feedback')).getText();
if (elementText !== 'You must enter a version for the published framework') {
throw new Error(`Expected: "You must enter a version for the published framework" Version validation text; Actual: "${elementText}"`);
}
console.log('Passed: Version validation text matched as expected');
}
},
//Version validation text color -red
{
description: 'Validate text color',
action: async () => {
const elementStyle = await driver.findElement(By.css('#divsource > .invalid-feedback')).getCssValue('color');
if (elementStyle !== 'rgba(220, 53, 69, 1)') {
throw new Error(`Version validation text color did not match; Actual: "${elementStyle}"`);
}
console.log('Passed: Version validation text color matched as expected');
}
},
//DIV valiation text
{
description: 'DIV validattion text',
action: async () => {
const elementText = await driver.findElement(By.css('b')).getText();
if (elementText !== 'Please enter a value for all highlighted fields') {
throw new Error(`Expected: "Please enter a value for all highlighted fields" DIV validation text; Actual: "${elementText}"`);
}
console.log('Passed: DIV validation text matched as expected');
}
},
//DIV validation text color -red
{
description: 'Validate text color',
action: async () => {
const elementStyle = await driver.findElement(By.css('b')).getCssValue('color');
if (elementStyle !== 'rgba(220, 53, 69, 1)') {
throw new Error(`DIV validation text color did not match; Actual: "${elementStyle}"`);
}
console.log('Passed: DIV validation text color matched as expected');
}
},
//NEXT ACTION - Close DIV
{ description: 'Click Close button', action: async () => await driver.findElement(By.css('#modalclose')).click() },
{ description: 'Wait for action to complete', action: async () => await driver.sleep(2000) },
//NEXT ACTION - Click Juan Testing Again & Again file icon
{ description: 'Click Juan Testing Again & Again file icon', action: async () => await driver.findElement(By.css('.doc:nth-child(2) > .fa')).click() },
{ description: 'Wait for action to complete', action: async () => await driver.sleep(2000) },
//NEXT ACTION - Click Juan Testing Again & Again View Icon
{ description: 'Click View icon', action: async () => await driver.findElement(By.css('.list-group-item:nth-child(2) > .float-right > .frame-name > .fa')).click() },
//Wait for page to load - Correlation Coverages View Details button
{
description: 'Wait for page to load',
action: async () => {
return await driver.wait(until.elementLocated(By.css('h2')), 10000).catch(() => false);
}
},
//Juan Testing Again & Again page title
{
description: 'Validate Juan Testing Again & Again page title',
action: async () => {
const elementText = await driver.findElement(By.css('h2')).getText();
if (elementText !== 'Juan Testing Again & Again') {
throw new Error(`Expected: "Juan Testing Again & Again" page title; Actual: "${elementText}"`);
}
console.log('Passed: Juan Testing Again & Again page title matched as expected');
}
},
//Framework Management page title text color -dark blue
{
description: 'Validate Framework Management page title text color',
action: async () => {
const elementStyle = await driver.findElement(By.css('h2')).getCssValue('color');
if (elementStyle !== 'rgba(40, 39, 90, 1)') {
throw new Error(`Framework Management page title text color did not match; Actual: "${elementStyle}"`);
}
console.log('Passed: Framework Management page title text color matched as expected');
}
},
//Framework Management page title text font
{
description: 'Validate Framework Management page title text font size',
action: async () => {
const elementStyle = await driver.findElement(By.css('h2')).getCssValue('font-size');
if (elementStyle !== '32px') {
throw new Error(`Framework Management page title text font-size did not match; Actual: "${elementStyle}"`);
}
console.log('Passed: Framework Management page title text font-size matched as expected');
}
},
//Edit icon
{
description: 'Verify Edit icon is present',
action: async () =>
{ const expectedIcon = await driver.wait(until.elementLocated(By.css('.fa-pencil-square-o')), 5000).catch(() => false);
if (!expectedIcon) {
throw new Error('Edit icon not found');
}
console.log('Passed: Edit icon present');
}
},
//Publish button icon
{
description: 'Verify Publish button icon is present',
action: async () =>
{ const expectedIcon = await driver.wait(until.elementLocated(By.css('.fa-pencil-square-o')), 5000).catch(() => false);
if (!expectedIcon) {
throw new Error('Publish button icon not found');
}
console.log('Passed: Publish button icon present');
}
},
//Publish button text
{
description: 'Validate Publish button text',
action: async () => {
const elementText = await driver.findElement(By.linkText('Publish')).getText();
if (elementText !== 'Publish') {
throw new Error(`Expected: "Publish" button text; Actual: "${elementText}"`);
}
console.log('Passed: Publish button text matched as expected');
}
},
//Publish button color -green
{
description: 'Validate Publish button color',
action: async () => {
const elementStyle = await driver.findElement(By.linkText('Publish')).getCssValue('background-color');
if (elementStyle !== 'rgba(48, 200, 172, 1)') {
throw new Error(`Publish button color did not match; Actual: "${elementStyle}"`);
}
console.log('Passed: Publish button color matched as expected');
}
},
//Download button icon
{
description: 'Verify Download button icon is present',
action: async () =>
{ const expectedIcon = await driver.wait(until.elementLocated(By.css('.fa-download')), 5000).catch(() => false);
if (!expectedIcon) {
throw new Error('Download button icon not found');
}
console.log('Passed: Download button icon present');
}
},
//Download button text
{
description: 'Validate Download button text',
action: async () => {
const elementText = await driver.findElement(By.linkText('Download')).getText();
if (elementText !== 'Download') {
throw new Error(`Expected: "Download" button text; Actual: "${elementText}"`);
}
console.log('Passed: Download button text matched as expected');
}
},
//Download button color -green
{
description: 'Validate Download button color',
action: async () => {
const elementStyle = await driver.findElement(By.linkText('Download')).getCssValue('background-color');
if (elementStyle !== 'rgba(48, 200, 172, 1)') {
throw new Error(`Download button color did not match; Actual: "${elementStyle}"`);
}
console.log('Passed: Download button color matched as expected');
}
},
//Add New Item button icon
{
description: 'Verify Add New Item button icon is present',
action: async () =>
{ const expectedIcon = await driver.wait(until.elementLocated(By.css('.btn > .fa-plus')), 5000).catch(() => false);
if (!expectedIcon) {
throw new Error('Add New Item button icon not found');
}
console.log('Passed: Add New Item button icon present');
}
},
//Add New Item button text
{
description: 'Validate Add New Item button text',
action: async () => {
const elementText = await driver.findElement(By.linkText('Add New Item')).getText();
if (elementText !== 'Add New Item') {
throw new Error(`Expected: "Add New Item" button text; Actual: "${elementText}"`);
}
console.log('Passed: Add New Item button text matched as expected');
}
},
//Add New Item button color -green
{
description: 'Validate Add New Item button color',
action: async () => {
const elementStyle = await driver.findElement(By.linkText('Add New Item')).getCssValue('background-color');
if (elementStyle !== 'rgba(48, 200, 172, 1)') {
throw new Error(`Add New Item button color did not match; Actual: "${elementStyle}"`);
}
console.log('Passed: Add New Item button color matched as expected');
}
},
//Add New Item button text
{
description: 'Validate Add New Item button text',
action: async () => {
const elementText = await driver.findElement(By.linkText('Add New Item')).getText();
if (elementText !== 'Add New Item') {
throw new Error(`Expected: "Add New Item" button text; Actual: "${elementText}"`);
}
console.log('Passed: Add New Item button text matched as expected');
}
},
//Add New Item button color -green
{
description: 'Validate Add New Item button color',
action: async () => {
const elementStyle = await driver.findElement(By.linkText('Add New Item')).getCssValue('background-color');
if (elementStyle !== 'rgba(48, 200, 172, 1)') {
throw new Error(`Add New Item button color did not match; Actual: "${elementStyle}"`);
}
console.log('Passed: Add New Item button color matched as expected');
}
},
//Draft button text
{
description: 'Validate Draft button text',
action: async () => {
const elementText = await driver.findElement(By.css('.badge-secondary')).getText();
if (elementText !== 'Draft') {
throw new Error(`Expected: "Draft" button text; Actual: "${elementText}"`);
}
console.log('Passed: Draft button text matched as expected');
}
},
//Draft button color -gray
{
description: 'Validate Draft button color',
action: async () => {
const elementStyle = await driver.findElement(By.css('.badge-secondary')).getCssValue('background-color');
if (elementStyle !== 'rgba(108, 117, 125, 1)') {
throw new Error(`Draft button color did not match; Actual: "${elementStyle}"`);
}
console.log('Passed: Draft button color matched as expected');
}
},
//Effective date label
{
description: 'Validate Effective date label',
action: async () => {
const elementText = await driver.findElement(By.css('.mr-2 > em')).getText();
if (elementText !== 'Effective 12/02/2022') {
throw new Error(`Expected: "Effective 12/02/2022" text; Actual: "${elementText}"`);
}
console.log('Passed: Effective 12/02/2022 text matched as expected');
}
},
//Created by label
{
description: 'Validate Created by label',
action: async () => {
const elementText = await driver.findElement(By.css('span:nth-child(7)')).getText();
if (elementText !== 'Created by: Juancho') {
throw new Error(`Expected: "Created by: Juancho" text; Actual: "${elementText}"`);
}
console.log('Passed: Created by: Juancho text matched as expected');
}
},
//Source label
{
description: 'Validate Source label',
action: async () => {
const elementText = await driver.findElement(By.css('.mt-1')).getText();
if (elementText !== 'Source: https://www.espn.com') {
throw new Error(`Expected: "Source: https://www.espn.com" text; Actual: "${elementText}"`);
}
console.log('Passed: Source: https://www.espn.com text matched as expected');
}
},
//Source URL label
{
description: 'Validate Source URL label',
action: async () => {
const elementText = await driver.findElement(By.linkText('https://www.espn.com')).getText();
if (elementText !== 'https://www.espn.com') {
throw new Error(`Expected: Source URL: "https://www.espn.com" link text; Actual: "${elementText}"`);
}
console.log('Passed: Source URL: https://www.espn.com link text matched as expected');
}
},
//Source edit icon
{
description: 'Verify Source edit icon is present',
action: async () =>
{ const expectedIcon = await driver.wait(until.elementLocated(By.css('.fa-external-link')), 5000).catch(() => false);
if (!expectedIcon) {
throw new Error('Source edit icon not found');
}
console.log('Passed: Source edit icon present');
}
},
//Search textbox -placeholder
{
description: 'Validate Search textbox placeholder',
action: async () => {
const elementValue = await driver.findElement(By.css('#framework-item-filter')).getAttribute('placeholder');
if (elementValue !== 'Search...') {
throw new Error(`Expected: "Search" textbox placeholder; Actual: "${elementValue}"`);
}
console.log('Passed: Search textbox placeholder matched as expected');
}
},
//Clear Search icon
{
description: 'Verify Clear Search icon is present',
action: async () =>
{ const expectedIcon = await driver.wait(until.elementLocated(By.css('.fa-times')), 5000).catch(() => false);
if (!expectedIcon) {
throw new Error('Clear Search icon not found');
}
console.log('Passed: Clear Search icon present');
}
},
//Comments button comment icon
{
description: 'Verify Comments button comment icon is present',
action: async () =>
{ const expectedIcon = await driver.wait(until.elementLocated(By.css('.fa-comment')), 5000).catch(() => false);
if (!expectedIcon) {
throw new Error('Comments button comment icon not found');
}
console.log('Passed: Comments button comment icon present');
}
},
//Comments 25 button text
{
description: 'Validate Comments button text',
action: async () => {
const elementText = await driver.findElement(By.css('.btn-sm:nth-child(1)')).getText();
if (elementText !== 'Comments 25') {
throw new Error(`Expected: "Comments 25" button text; Actual: "${elementText}"`);
}
console.log('Passed: Comments 25 button text matched as expected');
}
},
//Total comments button icon
{
description: 'Verify Total comments button icon is present',
action: async () =>
{ const expectedIcon = await driver.wait(until.elementLocated(By.css('.badge-light')), 5000).catch(() => false);
if (!expectedIcon) {
throw new Error('Total comments button icon not found');
}
console.log('Passed: Total comments button icon present');
}
},
//Comments button color -green
{
description: 'Validate Comments button color',
action: async () => {
const elementStyle = await driver.findElement(By.css('.badge-secondary')).getCssValue('background-color');
if (elementStyle !== 'rgba(108, 117, 125, 1)') {
throw new Error(`Comments button color did not match; Actual: "${elementStyle}"`);
}
console.log('Passed: Comments button color matched as expected');
}
},
//Expand All button icon
{
description: 'Verify Expand All button icon is present',
action: async () =>
{ const expectedIcon = await driver.wait(until.elementLocated(By.css('.fa-expand')), 5000).catch(() => false);
if (!expectedIcon) {
throw new Error('Expand All button icon not found');
}
console.log('Passed: Expand All button icon present');
}
},
//Expand All button text
{
description: 'Validate Expand All button text',
action: async () => {
const elementText = await driver.findElement(By.css('#expandall')).getText();
if (elementText !== 'Expand All') {
throw new Error(`Expected: "Expand All" button text; Actual: "${elementText}"`);
}
console.log('Passed: Expand All button text matched as expected');
}
},
//Expand All button color -green
{
description: 'Validate Expand Allbutton color',
action: async () => {
const elementStyle = await driver.findElement(By.css('#expandall')).getCssValue('background-color');
if (elementStyle !== 'rgba(48, 200, 172, 1)') {
throw new Error(`Expand All button color did not match; Actual: "${elementStyle}"`);
}
console.log('Passed: Expand All button color matched as expected');
}
},
//Collapse All button icon
{
description: 'Verify Collapse All button icon is present',
action: async () =>
{ const expectedIcon = await driver.wait(until.elementLocated(By.css('.fa-compress')), 5000).catch(() => false);
if (!expectedIcon) {
throw new Error('Collapse All button icon not found');
}
console.log('Passed: Collapse All button icon present');
}
},
//Collapse All button text
{
description: 'Validate Collapse All button text',
action: async () => {
const elementText = await driver.findElement(By.css('#collapseall')).getText();
if (elementText !== 'Collapse All') {
throw new Error(`Expected: "Collapse All" button text; Actual: "${elementText}"`);
}
console.log('Passed: Collapse All button text matched as expected');
}
},
//Collapse All button color -green
{
description: 'Validate Collapse All button color',
action: async () => {
const elementStyle = await driver.findElement(By.css('#collapseall')).getCssValue('background-color');
if (elementStyle !== 'rgba(48, 200, 172, 1)') {
throw new Error(`Collapse All button color did not match; Actual: "${elementStyle}"`);
}
console.log('Passed: Collapse All button color matched as expected');
}
},
//Parent Standard Target icon
{
description: 'Verify Parent Standard Target icon is present',
action: async () =>
{ const expectedIcon = await driver.wait(until.elementLocated(By.css('#std-873617672 > .stdtext > .fa')), 5000).catch(() => false);
if (!expectedIcon) {
throw new Error('Parent Standard Target icon not found');
}
console.log('Passed: Parent Standard Target icon present');
}
},
//Parent Standard text
{
description: 'Validate Parent Standard text',
action: async () => {
const elementText = await driver.findElement(By.css('#std-873617672 .stdstr')).getText();
if (elementText !== 'Baseball and Statistics') {
throw new Error(`Expected: Parent Standard "Baseball and Statistics" text; Actual: "${elementText}"`);
}
console.log('Passed: Parent Standard text matched as expected');
}
},
//Parent Standard text -grade
{
description: 'Validate Parent Standard grade text',
action: async () => {
const elementText = await driver.findElement(By.css('#std-873617672 em')).getText();
if (elementText !== '(Grade: 9,10,11,12)') {
throw new Error(`Expected: Parent Standard "(Grade: 9,10,11,12)" text; Actual: "${elementText}"`);
}
console.log('Passed: Parent Standard grade text matched as expected');
}
},
//Parent Standard Comments icon text
{
description: 'Validate Parent Standard Comments icon text',
action: async () => {
const elementText = await driver.findElement(By.css('#std-873617672 .badge')).getText();
if (elementText !== '14') {
throw new Error(`Expected: Parent Standard Comments icon "14" text; Actual: "${elementText}"`);
}
console.log('Passed: Parent Standard Comments icon text matched as expected');
}
},
//Parent Standard Comments icon color -red
{
description: 'Validate arent Standard Comments icon color',
action: async () => {
const elementStyle = await driver.findElement(By.css('#std-873617672 .badge')).getCssValue('background-color');
if (elementStyle !== 'rgba(220, 53, 69, 1)') {
throw new Error(`Parent Standard Comments icon color did not match; Actual: "${elementStyle}"`);
}
console.log('Passed: Parent Standard Comments icon color matched as expected');
}
},
//Parent Standard Info icon
{
description: 'Verify Parent Standard Info icon is present',
action: async () =>
{ const expectedIcon = await driver.wait(until.elementLocated(By.css('#std-873617672 .fa-info-circle')), 5000).catch(() => false);
if (!expectedIcon) {
throw new Error('Parent Standard Info icon not found');
}
console.log('Passed: Parent Standard Info icon present');
}
},
//Parent Standard Ellipsis icon
{
description: 'Verify Parent Standard Ellipsis icon is present',
action: async () =>
{ const expectedIcon = await driver.wait(until.elementLocated(By.css('#std-873617672 .fa-ellipsis-h')), 5000).catch(() => false);
if (!expectedIcon) {
throw new Error('Parent Standard Ellipsis icon not found');
}
console.log('Passed: Parent Standard Ellipsis icon present');
}
},
//Parent Standard 2 Expand icon
{
description: 'Verify Parent Standard 2 Expand icon is present',
action: async () =>
{ const expectedIcon = await driver.wait(until.elementLocated(By.css('#icon-873617673')), 5000).catch(() => false);
if (!expectedIcon) {
throw new Error('Parent Standard 2 Expand icon not found');
}
console.log('Passed: Parent Standard 2 Expand icon present');
}
},
//Parent Standard 2 text
{
description: 'Validate Parent Standard 2 text',
action: async () => {
const elementText = await driver.findElement(By.css('#std-873617673 .stdstr')).getText();
if (elementText !== 'Probabilities LFGSD') {
throw new Error(`Expected: Parent Standard 2 "Probabilities LFGSD" text; Actual: "${elementText}"`);
}
console.log('Passed: Parent Standard 2 text matched as expected');
}
},
//Parent Standard 2 text -grade
{
description: 'Validate Parent Standard 2 gade text',
action: async () => {
const elementText = await driver.findElement(By.css('#std-873617673 em')).getText();
if (elementText !== '(Grade: 9)') {
throw new Error(`Expected: Parent Standard 2 "(Grade: 9)" text; Actual: "${elementText}"`);
}
console.log('Passed: Parent Standard 2 grade text matched as expected');
}
},
//Parent Standard 2 Comments icon text
{
description: 'Validate Parent Standard 2 Comments icon text',
action: async () => {
const elementText = await driver.findElement(By.css('#std-873617673 .badge')).getText();
if (elementText !== '11') {
throw new Error(`Expected: Parent Standard 2 Comments icon "11" text; Actual: "${elementText}"`);
}
console.log('Passed: Parent Standard 2 Comments icon text matched as expected');
}
},
//Parent Standard 2 Comments icon color -red
{
description: 'Validate arent Standard 2 Comments icon color',
action: async () => {
const elementStyle = await driver.findElement(By.css('#std-873617673 .badge')).getCssValue('background-color');
if (elementStyle !== 'rgba(220, 53, 69, 1)') {
throw new Error(`Parent Standard 2 Comments icon color did not match; Actual: "${elementStyle}"`);
}
console.log('Passed: Parent Standard 2 Comments icon color matched as expected');
}
},
//Parent Standard 2 Info icon
{
description: 'Verify Parent Standard 2 Info icon is present',
action: async () =>
{ const expectedIcon = await driver.wait(until.elementLocated(By.css('#std-873617673 .fa-info-circle')), 5000).catch(() => false);
if (!expectedIcon) {
throw new Error('Parent Standard 2 Info icon not found');
}
console.log('Passed: Parent Standard 2 Info icon present');
}
},
//Parent Standard 2 Ellipsis icon
{
description: 'Verify Parent Standard 2 Ellipsis icon is present',
action: async () =>
{ const expectedIcon = await driver.wait(until.elementLocated(By.css('#std-873617673 .fa-ellipsis-h')), 5000).catch(() => false);
if (!expectedIcon) {
throw new Error('Parent Standard 2 Ellipsis icon not found');
}
console.log('Passed: Parent Standard 2 Ellipsis icon present');
}
},
//NEXT ACTION - Navigate to Framework Management page
{ description: 'Click Frameworks navigation link', action: async () => await driver.findElement(By.linkText('Frameworks')).click() },
//Wait for page to load - Correlation Coverages View Details button
{
description: 'Wait for page to load',
action: async () => {
return await driver.wait(until.elementLocated(By.css('h2')), 10000).catch(() => false);
}
},
//NEXT ACTION - Click My Latest Organization For Now link
{ description: 'Click My Latest Organization For Now link', action: async () => await driver.findElement(By.linkText('My Latest Organization For Now')).click() },
{ description: 'Wait for action to complete', action: async () => await driver.sleep(2000) },
//NEXT ACTION - Click Juan Testing Again & Again file icon
{ description: 'Click Juan Testing Again & Again file icon', action: async () => await driver.findElement(By.css('.doc:nth-child(2) > .fa')).click() },
{ description: 'Wait for action to complete', action: async () => await driver.sleep(2000) },
//NEXT ACTION - Click Juan Testing Again & Again Download Icon
{ description: 'Click Download icon', action: async () => await driver.findElement(By.css('.list-group-item:nth-child(2) > .float-right .fa-download')).click() },
//Export Framework DIV
{
description: 'Wait for DIV to open',
action: async () =>
{ const expectedIcon = await driver.wait(until.elementLocated(By.css('.modal-lg .modal-title')), 5000).catch(() => false);
if (!expectedIcon) {
throw new Error('Export Framework DIV did not open');
}
console.log('Passed: Export Framework DIV opened');
}
},
//Export Framework DIV title
{
description: 'Validate Export Framework DIV title',
action: async () => {
const elementText = await driver.findElement(By.css('.modal-lg .modal-title')).getText();
if (elementText !== 'Export Framework') {
throw new Error(`Expected: "Export Framework" DIV title text; Actual: "${elementText}"`);
}
console.log('Passed: Export Framework DIV title text matched as expected');
}
},
//X icon DIV color -red
{
description: 'Validate X icon color',
action: async () => {
const elementStyle = await driver.findElement(By.css('.modal-lg .modal-header span')).getCssValue('color');
if (elementStyle !== 'rgba(246, 60, 40, 1)') {
throw new Error(`DIV "X" icon color did not match; Actual: "${elementStyle}"`);
}
console.log('Passed: DIV X icon color matched as expected');
}
},
//Juan Testing Again & Again title
{
description: 'Validate Juan Testing Again & Again title',
action: async () => {
const elementText = await driver.findElement(By.css('b')).getText();
if (elementText !== 'Juan Testing Again & Again') {
throw new Error(`Expected: "Juan Testing Again & Again" title text; Actual: "${elementText}"`);
}
console.log('Passed: Juan Testing Again & Again title text matched as expected');
}
},
//Please choose format text
{
description: 'Validate Please choose format text',
action: async () => {
const elementText = await driver.findElement(By.css('p:nth-child(2)')).getText();
if (elementText !== 'Please choose which format you wish to download:') {
throw new Error(`Expected: "Please choose which format you wish to download:" text; Actual: "${elementText}"`);
}
console.log('Passed: Please choose which format you wish to download: text matched as expected');
}
},
//Export CSV button text
{
description: 'Validate Export CSV button text',
action: async () => {
const elementText = await driver.findElement(By.linkText('Export CSV')).getText();
if (elementText !== 'Export CSV') {
throw new Error(`Expected: "Export CSV" button text; Actual: "${elementText}"`);
}
console.log('Passed: Export CSV button text matched as expected');
}
},
//Export CSV button color -green
{
description: 'Validate Export CSV button color',
action: async () => {
const elementStyle = await driver.findElement(By.linkText('Export CSV')).getCssValue('background-color');
if (elementStyle !== 'rgba(48, 200, 172, 1)') {
throw new Error(`Export CSV button color did not match; Actual: "${elementStyle}"`);
}
console.log('Passed: Export CSV button color matched as expected');
}
},
//Export CASE JSON button text
{
description: 'Validate Export CASE JSON button text',
action: async () => {
const elementText = await driver.findElement(By.linkText('Export CASE JSON')).getText();
if (elementText !== 'Export CASE JSON') {
throw new Error(`Expected: "Export CASE JSON" button text; Actual: "${elementText}"`);
}
console.log('Passed: Export CASE JSON button text matched as expected');
}
},
//CASE JSON button color -green
{
description: 'Validate Export CASE JSON button color',
action: async () => {
const elementStyle = await driver.findElement(By.linkText('Export CASE JSON')).getCssValue('background-color');
if (elementStyle !== 'rgba(48, 200, 172, 1)') {
throw new Error(`Export CASE JSON button color did not match; Actual: "${elementStyle}"`);
}
console.log('Passed: Export CASE JSON button color matched as expected');
}
},
//Close button text
{
description: 'Validate Close button text',
action: async () => {
const elementText = await driver.findElement(By.css('#modalclose')).getText();
if (elementText !== 'Close') {
throw new Error(`Expected: "Close" button text; Actual: "${elementText}"`);
}
console.log('Passed: Close button text matched as expected');
}
},
//Close button color -white
{
description: 'Validate Close button color',
action: async () => {
const elementStyle = await driver.findElement(By.css('#modalclose')).getCssValue('background-color');
if (elementStyle !== 'rgba(0, 0, 0, 0)') {
throw new Error(`Close button color did not match; Actual: "${elementStyle}"`);
}
console.log('Passed: Close button color matched as expected');
}
},
//NEXT ACTION - Close DIV
{ description: 'Click Close button', action: async () => await driver.findElement(By.css('#modalclose')).click() },
{ description: 'Wait for action to complete', action: async () => await driver.sleep(2000) },
//NEXT ACTION - Click Juan Testing Again & Again file icon
{ description: 'Click Juan Testing Again & Again file icon', action: async () => await driver.findElement(By.css('.doc:nth-child(2) > .fa')).click() },
{ description: 'Wait for action to complete', action: async () => await driver.sleep(2000) },
//NEXT ACTION - Click Juan Testing Again & Again Info Icon
{ description: 'Click Info icon', action: async () => await driver.findElement(By.css('.list-group-item:nth-child(2) > .float-right .fa-info-circle')).click() },
//View Framework DIV
{
description: 'Wait for DIV to open',
action: async () =>
{ const expectedIcon = await driver.wait(until.elementLocated(By.css('.modal-lg .modal-title')), 5000).catch(() => false);
if (!expectedIcon) {
throw new Error('View Framework DIV did not open');
}
console.log('Passed: View Framework DIV opened');
}
},
//View Framework Info DIV title
{
description: 'Validate View Framework Info DIV title',
action: async () => {
const elementText = await driver.findElement(By.css('.modal-lg .modal-title')).getText();
if (elementText !== 'View Framework Info') {
throw new Error(`Expected: "View Framework Info" DIV title text; Actual: "${elementText}"`);
}
console.log('Passed: View Framework Info DIV title text matched as expected');
}
},
//X icon DIV color -red
{
description: 'Validate X icon color',
action: async () => {
const elementStyle = await driver.findElement(By.css('.modal-lg .modal-header span')).getCssValue('color');
if (elementStyle !== 'rgba(246, 60, 40, 1)') {
throw new Error(`DIV "X" icon color did not match; Actual: "${elementStyle}"`);
}
console.log('Passed: DIV X icon color matched as expected');
}
},
//Type label
{
description: 'Validate Type label',
action: async () => {
const elementText = await driver.findElement(By.css('#divtype > .form-label')).getText();
if (elementText !== 'Type') {
throw new Error(`Expected: "Type" label; Actual: "${elementText}"`);
}
console.log('Passed: Type label matched as expected');
}
},
//Type value
{
description: 'Validate Type value',
action: async () => {
try {
const element = await driver.findElement(By.css('#divtype'));
//Get different versions of the text for debugging
const fullText = await element.getText();
//Check for the expected text in different ways
const expectedText = 'Framework';
const trimmedFullText = fullText.trim();
const firstLine = trimmedFullText.split('\n')[0].trim();
//Try multiple matching strategies
if (firstLine.includes(expectedText)) {
console.log(`Passed: "${expectedText}" text in first line`);
} else if (trimmedFullText.includes(expectedText)) {
console.log(`Passed: "${expectedText}" text within full text`);
} else {
throw new Error(
`Text validation failed.\nExpected: "${expectedText}"\n` +
`Full text: "${fullText}"\n` +
`First line: "${firstLine}"\n`
);
}
} catch (error) {
console.error('Detailed error during validation:', error);
throw error; //Re-throw after logging
}
}
},
//Name label
{
description: 'Validate Name label',
action: async () => {
const elementText = await driver.findElement(By.css('#divname > .form-label')).getText();
if (elementText !== 'Name') {
throw new Error(`Expected: "Name" label; Actual: "${elementText}"`);
}
console.log('Passed: Name label matched as expected');
}
},
//Name value
{
description: 'Validate Name value',
action: async () => {
try {
const element = await driver.findElement(By.css('#divname'));
//Get different versions of the text for debugging
const fullText = await element.getText();
//Check for the expected text in different ways
const expectedText = 'Juan Testing Again & Again';
const trimmedFullText = fullText.trim();
const firstLine = trimmedFullText.split('\n')[0].trim();
//Try multiple matching strategies
if (firstLine.includes(expectedText)) {
console.log(`Passed: "${expectedText}" text in first line`);
} else if (trimmedFullText.includes(expectedText)) {
console.log(`Passed: "${expectedText}" text within full text`);
} else {
throw new Error(
`Text validation failed.\nExpected: "${expectedText}"\n` +
`Full text: "${fullText}"\n` +
`First line: "${firstLine}"\n`
);
}
} catch (error) {
console.error('Detailed error during validation:', error);
throw error; //Re-throw after logging
}
}
},
//Source URL label
{
description: 'Validate Source URL label',
action: async () => {
const elementText = await driver.findElement(By.css('.form-row:nth-child(1) > #divsource > .form-label')).getText();
if (elementText !== 'Source URL') {
throw new Error(`Expected: "Source URL" label; Actual: "${elementText}"`);
}
console.log('Passed: Source URL label matched as expected');
}
},
//Source URL value
{
description: 'Validate Source URL value',
action: async () => {
const elementText = await driver.findElement(By.linkText('https://www.espn.com')).getText();
if (elementText !== 'https://www.espn.com') {
throw new Error(`Expected: "https://www.espn.com" source URL valuen text; Actual: "${elementText}"`);
}
console.log('Passed: https://www.espn.com source URL value text matched as expected');
}
},
//Parent label
{
description: 'Validate Parent label',
action: async () => {
const elementText = await driver.findElement(By.css('.form-row:nth-child(1) > #divparent > .form-label')).getText();
if (elementText !== 'Parent') {
throw new Error(`Expected: "Parent" label; Actual: "${elementText}"`);
}
console.log('Passed: Parent label matched as expected');
}
},
//Parent value
{
description: 'Validate Parent value',
action: async () => {
try {
const element = await driver.findElement(By.css('.form-row:nth-child(1) > #divparent'));
//Get different versions of the text for debugging
const fullText = await element.getText();
//Check for the expected text in different ways
const expectedText = 'Parent';
const trimmedFullText = fullText.trim();
const firstLine = trimmedFullText.split('\n')[0].trim();
//Try multiple matching strategies
if (firstLine.includes(expectedText)) {
console.log(`Passed: "${expectedText}" text in first line`);
} else if (trimmedFullText.includes(expectedText)) {
console.log(`Passed: "${expectedText}" text within full text`);
} else {
throw new Error(
`Text validation failed.\nExpected: "${expectedText}"\n` +
`Full text: "${fullText}"\n` +
`First line: "${firstLine}"\n`
);
}
} catch (error) {
console.error('Detailed error during validation:', error);
throw error; //Re-throw after logging
}
}
},
//Description label
{
description: 'Validate Description label',
action: async () => {
const elementText = await driver.findElement(By.css('#divdescription > .form-label')).getText();
if (elementText !== 'Description') {
throw new Error(`Expected: "Description" label; Actual: "${elementText}"`);
}
console.log('Passed: Description label matched as expected');
}
},
//Description value
{
description: 'Validate Description value',
action: async () => {
try {
const element = await driver.findElement(By.css('#divdescription'));
//Get different versions of the text for debugging
const fullText = await element.getText();
//Check for the expected text in different ways
const expectedText = 'This is my Framework testing description.';
const trimmedFullText = fullText.trim();
const firstLine = trimmedFullText.split('\n')[0].trim();
//Try multiple matching strategies
if (firstLine.includes(expectedText)) {
console.log(`Passed: "${expectedText}" text in first line`);
} else if (trimmedFullText.includes(expectedText)) {
console.log(`Passed: "${expectedText}" text within full text`);
} else {
throw new Error(
`Text validation failed.\nExpected: "${expectedText}"\n` +
`Full text: "${fullText}"\n` +
`First line: "${firstLine}"\n`
);
}
} catch (error) {
console.error('Detailed error during validation:', error);
throw error; //Re-throw after logging
}
}
},
//Creator label
{
description: 'Validate Creator label',
action: async () => {
const elementText = await driver.findElement(By.css('#divcreator > .form-label')).getText();
if (elementText !== 'Creator') {
throw new Error(`Expected: "Creator" label; Actual: "${elementText}"`);
}
console.log('Passed: Creator label matched as expected');
}
},
//Creator value
{
description: 'Validate Creator value',
action: async () => {
try {
const element = await driver.findElement(By.css('#divcreator'));
//Get different versions of the text for debugging
const fullText = await element.getText();
//Check for the expected text in different ways
const expectedText = 'Juancho';
const trimmedFullText = fullText.trim();
const firstLine = trimmedFullText.split('\n')[0].trim();
//Try multiple matching strategies
if (firstLine.includes(expectedText)) {
console.log(`Passed: "${expectedText}" text in first line`);
} else if (trimmedFullText.includes(expectedText)) {
console.log(`Passed: "${expectedText}" text within full text`);
} else {
throw new Error(
`Text validation failed.\nExpected: "${expectedText}"\n` +
`Full text: "${fullText}"\n` +
`First line: "${firstLine}"\n`
);
}
} catch (error) {
console.error('Detailed error during validation:', error);
throw error; //Re-throw after logging
}
}
},
//Publisher label
{
description: 'Validate Publisher label',
action: async () => {
const elementText = await driver.findElement(By.css('#divpublisher > .form-label')).getText();
if (elementText !== 'Publisher') {
throw new Error(`Expected: "Publisher" label; Actual: "${elementText}"`);
}
console.log('Passed: Publisher label matched as expected');
}
},
//Publisher value
{
description: 'Validate Publisher value',
action: async () => {
try {
const element = await driver.findElement(By.css('#divpublisher'));
//Get different versions of the text for debugging
const fullText = await element.getText();
//Check for the expected text in different ways
const expectedText = 'Publishers Clearing House';
const trimmedFullText = fullText.trim();
const firstLine = trimmedFullText.split('\n')[0].trim();
//Try multiple matching strategies
if (firstLine.includes(expectedText)) {
console.log(`Passed: "${expectedText}" text in first line`);
} else if (trimmedFullText.includes(expectedText)) {
console.log(`Passed: "${expectedText}" text within full text`);
} else {
throw new Error(
`Text validation failed.\nExpected: "${expectedText}"\n` +
`Full text: "${fullText}"\n` +
`First line: "${firstLine}"\n`
);
}
} catch (error) {
console.error('Detailed error during validation:', error);
throw error; //Re-throw after logging
}
}
},
//Status label
{
description: 'Validate Status label',
action: async () => {
const elementText = await driver.findElement(By.css('#divstatus > .form-label')).getText();
if (elementText !== 'Status') {
throw new Error(`Expected: "Status" label; Actual: "${elementText}"`);
}
console.log('Passed: Status label matched as expected');
}
},
//Status value
{
description: 'Validate Status value',
action: async () => {
try {
const element = await driver.findElement(By.css('#divstatus'));
//Get different versions of the text for debugging
const fullText = await element.getText();
//Check for the expected text in different ways
const expectedText = 'Draft';
const trimmedFullText = fullText.trim();
const firstLine = trimmedFullText.split('\n')[0].trim();
//Try multiple matching strategies
if (firstLine.includes(expectedText)) {
console.log(`Passed: "${expectedText}" text in first line`);
} else if (trimmedFullText.includes(expectedText)) {
console.log(`Passed: "${expectedText}" text within full text`);
} else {
throw new Error(
`Text validation failed.\nExpected: "${expectedText}"\n` +
`Full text: "${fullText}"\n` +
`First line: "${firstLine}"\n`
);
}
} catch (error) {
console.error('Detailed error during validation:', error);
throw error; //Re-throw after logging
}
}
},
//Effective Date label
{
description: 'Validate Effective Date label',
action: async () => {
const elementText = await driver.findElement(By.css('#diveffective > .form-label')).getText();
if (elementText !== 'Effective Date') {
throw new Error(`Expected: "Effective Date" label; Actual: "${elementText}"`);
}
console.log('Passed: Effective Date label matched as expected');
}
},
//Effective Date value
{
description: 'Validate Effective Date value',
action: async () => {
try {
const element = await driver.findElement(By.css('#diveffective'));
//Get different versions of the text for debugging
const fullText = await element.getText();
//Check for the expected text in different ways
const expectedText = '12/02/2022';
const trimmedFullText = fullText.trim();
const firstLine = trimmedFullText.split('\n')[0].trim();
//Try multiple matching strategies
if (firstLine.includes(expectedText)) {
console.log(`Passed: "${expectedText}" text in first line`);
} else if (trimmedFullText.includes(expectedText)) {
console.log(`Passed: "${expectedText}" text within full text`);
} else {
throw new Error(
`Text validation failed.\nExpected: "${expectedText}"\n` +
`Full text: "${fullText}"\n` +
`First line: "${firstLine}"\n`
);
}
} catch (error) {
console.error('Detailed error during validation:', error);
throw error; //Re-throw after logging
}
}
},
//Language label
{
description: 'Validate Language label',
action: async () => {
const elementText = await driver.findElement(By.css('#divlang > .form-label')).getText();
if (elementText !== 'Language') {
throw new Error(`Expected: "Language" label; Actual: "${elementText}"`);
}
console.log('Passed: Language label matched as expected');
}
},
//Language value
{
description: 'Validate Language value',
action: async () => {
try {
const element = await driver.findElement(By.css('#divlang'));
//Get different versions of the text for debugging
const fullText = await element.getText();
//Check for the expected text in different ways
const expectedText = 'English';
const trimmedFullText = fullText.trim();
const firstLine = trimmedFullText.split('\n')[0].trim();
//Try multiple matching strategies
if (firstLine.includes(expectedText)) {
console.log(`Passed: "${expectedText}" text in first line`);
} else if (trimmedFullText.includes(expectedText)) {
console.log(`Passed: "${expectedText}" text within full text`);
} else {
throw new Error(
`Text validation failed.\nExpected: "${expectedText}"\n` +
`Full text: "${fullText}"\n` +
`First line: "${firstLine}"\n`
);
}
} catch (error) {
console.error('Detailed error during validation:', error);
throw error; //Re-throw after logging
}
}
},
//Version label
{
description: 'Validate Version label',
action: async () => {
const elementText = await driver.findElement(By.css('#divversion > .form-label')).getText();
if (elementText !== 'Version') {
throw new Error(`Expected: "Version" label; Actual: "${elementText}"`);
}
console.log('Passed: Version label matched as expected');
}
},
//Version value
{
description: 'Validate Version value',
action: async () => {
try {
const element = await driver.findElement(By.css('#divversion'));
//Get different versions of the text for debugging
const fullText = await element.getText();
//Check for the expected text in different ways
const expectedText = '2022.1.1';
const trimmedFullText = fullText.trim();
const firstLine = trimmedFullText.split('\n')[0].trim();
//Try multiple matching strategies
if (firstLine.includes(expectedText)) {
console.log(`Passed: "${expectedText}" text in first line`);
} else if (trimmedFullText.includes(expectedText)) {
console.log(`Passed: "${expectedText}" text within full text`);
} else {
throw new Error(
`Text validation failed.\nExpected: "${expectedText}"\n` +
`Full text: "${fullText}"\n` +
`First line: "${firstLine}"\n`
);
}
} catch (error) {
console.error('Detailed error during validation:', error);
throw error; //Re-throw after logging
}
}
},
//Notes label
{
description: 'Validate Notes label',
action: async () => {
const elementText = await driver.findElement(By.css('#divnotes > .form-label')).getText();
if (elementText !== 'Notes') {
throw new Error(`Expected: "Notes" label; Actual: "${elementText}"`);
}
console.log('Passed: Notes label matched as expected');
}
},
//Notes value
{
description: 'Validate Notes value',
action: async () => {
try {
const element = await driver.findElement(By.css('#divnotes'));
//Get different versions of the text for debugging
const fullText = await element.getText();
//Check for the expected text in different ways
const expectedText = 'This only contains Kindergarten for now.';
const trimmedFullText = fullText.trim();
const firstLine = trimmedFullText.split('\n')[0].trim();
//Try multiple matching strategies
if (firstLine.includes(expectedText)) {
console.log(`Passed: "${expectedText}" text in first line`);
} else if (trimmedFullText.includes(expectedText)) {
console.log(`Passed: "${expectedText}" text within full text`);
} else {
throw new Error(
`Text validation failed.\nExpected: "${expectedText}"\n` +
`Full text: "${fullText}"\n` +
`First line: "${firstLine}"\n`
);
}
} catch (error) {
console.error('Detailed error during validation:', error);
throw error; //Re-throw after logging
}
}
},
//Created label
{
description: 'Validate Created label',
action: async () => {
const elementText = await driver.findElement(By.css('.form-row:nth-child(4) > #divsource > .form-label')).getText();
if (elementText !== 'Created') {
throw new Error(`Expected: "Created" label; Actual: "${elementText}"`);
}
console.log('Passed: Created label matched as expected');
}
},
//Created value
{
description: 'Validate Created value',
action: async () => {
try {
const element = await driver.findElement(By.css('.form-row:nth-child(4) > #divsource'));
//Get different versions of the text for debugging
const fullText = await element.getText();
//Check for the expected text in different ways
const expectedText = 'Wed, 23 Nov 2022 21:05:03 -0800';
const trimmedFullText = fullText.trim();
const firstLine = trimmedFullText.split('\n')[0].trim();
//Try multiple matching strategies
if (firstLine.includes(expectedText)) {
console.log(`Passed: "${expectedText}" text in first line`);
} else if (trimmedFullText.includes(expectedText)) {
console.log(`Passed: "${expectedText}" text within full text`);
} else {
throw new Error(
`Text validation failed.\nExpected: "${expectedText}"\n` +
`Full text: "${fullText}"\n` +
`First line: "${firstLine}"\n`
);
}
} catch (error) {
console.error('Detailed error during validation:', error);
throw error; //Re-throw after logging
}
}
},
//Last Modified label
{
description: 'Validate Last Modified label',
action: async () => {
const elementText = await driver.findElement(By.css('.form-row:nth-child(4) > #divparent > .form-label')).getText();
if (elementText !== 'Last Modified') {
throw new Error(`Expected: "Last Modified" label; Actual: "${elementText}"`);
}
console.log('Passed: Last Modified label matched as expected');
}
},
//Last Modified value
{
description: 'Validate Last Modified value',
action: async () => {
try {
const element = await driver.findElement(By.css('.form-row:nth-child(4) > #divparent'));
//Get different versions of the text for debugging
const fullText = await element.getText();
//Check for the expected text in different ways
const expectedText = 'Wed, 26 Feb 2025 15:50:11 -0800';
const trimmedFullText = fullText.trim();
const firstLine = trimmedFullText.split('\n')[1].trim();
//Try multiple matching strategies
if (firstLine.includes(expectedText)) {
console.log(`Passed: "${expectedText}" text in first line`);
} else if (trimmedFullText.includes(expectedText)) {
console.log(`Passed: "${expectedText}" text within full text`);
} else {
throw new Error(
`Text validation failed.\nExpected: "${expectedText}"\n` +
`Full text: "${fullText}"\n` +
`First line: "${firstLine}"\n`
);
}
} catch (error) {
console.error('Detailed error during validation:', error);
throw error; //Re-throw after logging
}
}
},
//NEXT ACTION - Close DIV
{ description: 'Click Close button', action: async () => await driver.findElement(By.css('#modalclose')).click() },
{ description: 'Wait for action to complete', action: async () => await driver.sleep(2000) },
//NEXT ACTION - Click Juan Testing Again & Again file icon
{ description: 'Click Juan Testing Again & Again file icon', action: async () => await driver.findElement(By.css('.doc:nth-child(2) > .fa')).click() },
{ description: 'Wait for action to complete', action: async () => await driver.sleep(2000) },
//NEXT ACTION - Click Juan Testing Again & Again Edit Icon
{ description: 'Click Edit icon', action: async () => await driver.findElement(By.css('.list-group-item:nth-child(2) > .float-right .fa-pencil-square-o')).click() },
//Edit Framework DIV
{
description: 'Wait for Edit Framework DIV to open',
action: async () =>
{ const expectedIcon = await driver.wait(until.elementLocated(By.css('.modal-lg .modal-title')), 5000).catch(() => false);
if (!expectedIcon) {
throw new Error('Edit Framework DIV did not open');
}
console.log('Passed: Edit Framework DIV opened');
}
},
//Edit Framework title
{
description: 'Validate Edit Framework DIV title',
action: async () => {
const elementText = await driver.findElement(By.css('.modal-lg .modal-title')).getText();
if (elementText !== 'Edit Framework') {
throw new Error(`Expected: "Edit Framework" DIV title text; Actual: "${elementText}"`);
}
console.log('Passed: Edit Framework DIV title text matched as expected');
}
},
//X icon DIV color -red
{
description: 'Validate X icon color',
action: async () => {
const elementStyle = await driver.findElement(By.css('.modal-lg .modal-header span')).getCssValue('color');
if (elementStyle !== 'rgba(246, 60, 40, 1)') {
throw new Error(`DIV "X" icon color did not match; Actual: "${elementStyle}"`);
}
console.log('Passed: DIV X icon color matched as expected');
}
},
//Type label
{
description: 'Validate Type label',
action: async () => {
const elementText = await driver.findElement(By.css('#divtype > .form-label')).getText();
if (elementText !== 'Type') {
throw new Error(`Expected: "Type" label text; Actual: "${elementText}"`);
}
console.log('Passed: Type label text matched as expected');
}
},
//Type Info icon is present
{
description: 'Verify Type Info icon is present',
action: async () =>
{ const expectedIcon = await driver.wait(until.elementLocated(By.css('#divtype .fa')), 5000).catch(() => false);
if (!expectedIcon) {
throw new Error('Type Info icon is not present');
}
console.log('Passed: Type Info icon is present');
}
},
//Type value text
{
description: 'Validate Type value text',
action: async () => {
try {
const element = await driver.findElement(By.css('#divtype'));
//Get different versions of the text for debugging
const fullText = await element.getText();
//Check for the expected text in different ways
const expectedText = 'Framework';
const trimmedFullText = fullText.trim();
const firstLine = trimmedFullText.split('\n')[0].trim();
//Try multiple matching strategies
if (firstLine.includes(expectedText)) {
console.log(`Passed: "${expectedText}" text in first line`);
} else if (trimmedFullText.includes(expectedText)) {
console.log(`Passed: "${expectedText}" text within full text`);
} else {
throw new Error(
`Text validation failed.\nExpected: "${expectedText}"\n` +
`Full text: "${fullText}"\n` +
`First line: "${firstLine}"\n`
);
}
} catch (error) {
console.error('Detailed error during validation:', error);
throw error; //Re-throw after logging
}
}
},
//Name label
{
description: 'Validate Type label',
action: async () => {
const elementText = await driver.findElement(By.css('#divtype > .form-label')).getText();
if (elementText !== 'Type') {
throw new Error(`Expected: "Type" labele text; Actual: "${elementText}"`);
}
console.log('Passed: Type labele text matched as expected');
}
},
//Name textbox
{
description: 'Validate Name textbox value',
action: async () => {
const elementValue = await driver.findElement(By.css('#orgname')).getText();
if (elementValue !== '') {
throw new Error(`Expected: "Juan Testing Again & Again" Name textbox value; Actual: "${elementValue}"`);
}
console.log('Passed: Juan Testing Again & Again Name textbox value matched as expected');
}
},
//Source URL label
{
description: 'Validate Source URL label',
action: async () => {
const elementText = await driver.findElement(By.css('#divsource > .form-label')).getText();
if (elementText !== 'Source URL') {
throw new Error(`Expected: "Source URL" label text; Actual: "${elementText}"`);
}
console.log('Passed: Source URL label text matched as expected');
}
},
//Source URL textbox
{
description: 'Validate Source URL textbox value',
action: async () => {
const elementValue = await driver.findElement(By.css('#url')).getText();
if (elementValue !== '') {
throw new Error(`Expected: "https://www.espn.com" Source URL textbox value; Actual: "${elementValue}"`);
}
console.log('Passed: https://www.espn.com Source URL textbox value matched as expected');
}
},
//Parent label
{
description: 'Validate Parent label',
action: async () => {
const elementText = await driver.findElement(By.css('#divparent > .form-label')).getText();
if (elementText !== 'Parent') {
throw new Error(`Expected: "Parent" label text; Actual: "${elementText}"`);
}
console.log('Passed: Parent label text matched as expected');
}
},
//Parent Info icon is present
{
description: 'Verify Parent Info icon is present',
action: async () =>
{ const expectedIcon = await driver.wait(until.elementLocated(By.css('#divparent .fa')), 5000).catch(() => false);
if (!expectedIcon) {
throw new Error('Parent Info icon is not present');
}
console.log('Passed: Parent Info icon is present');
}
},
//Parent dropdown "My Latest Organization For Now" (873617737)
{
description: 'Validate Parent dropdown option',
action: async () => {
const elementOption = await driver.findElement(By.css('#parent')).getAttribute('value');
if (elementOption !== '873617737') {
throw new Error(`Expected: "My Latest Organization For Now"; Actual: "${elementOption}"`);
}
console.log('Passed: My Latest Organization For Now dropdown option matched as expected');
}
},
//Description label
{
description: 'Validate Description label',
action: async () => {
const elementText = await driver.findElement(By.css('#divdescription > .form-label')).getText();
if (elementText !== 'Description') {
throw new Error(`Expected: "Description" label text; Actual: "${elementText}"`);
}
console.log('Passed: Description label text matched as expected');
}
},
//Description textbox value
{
description: 'Validate Description textbox value',
action: async () => {
const elementValue = await driver.findElement(By.css('#description')).getText();
if (elementValue !== 'This is my Framework testing description.') {
throw new Error(`Expected: "This is my Framework testing description." Description textbox value; Actual: "${elementValue}"`);
}
console.log('Passed: Description textbox value matched as expected');
}
},
//Creator label
{
description: 'Validate Creator label',
action: async () => {
const elementText = await driver.findElement(By.css('#divcreator > .form-label')).getText();
if (elementText !== 'Creator') {
throw new Error(`Expected: "Creator" label text; Actual: "${elementText}"`);
}
console.log('Passed: Creator label text matched as expected');
}
},
//Creator Info icon is present
{
description: 'Verify Creator Info icon is present',
action: async () =>
{ const expectedIcon = await driver.wait(until.elementLocated(By.css('#divcreator .fa')), 5000).catch(() => false);
if (!expectedIcon) {
throw new Error('Creator Info icon is not present');
}
console.log('Passed: Creator Info icon is present');
}
},
//Creator textbox value
{
description: 'Validate Creator textbox value',
action: async () => {
const elementValue = await driver.findElement(By.css('#creator')).getAttribute('value');
if (elementValue !== 'Juancho') {
throw new Error(`Expected: "Juancho" Creator textbox value; Actual: "${elementValue}"`);
}
console.log('Passed: Creator textbox value matched as expected');
}
},
//Publisher label
{
description: 'Validate Publisher label',
action: async () => {
const elementText = await driver.findElement(By.css('#divpublisher > .form-label')).getText();
if (elementText !== 'Publisher') {
throw new Error(`Expected: "Publisher" label text; Actual: "${elementText}"`);
}
console.log('Passed: Publisher label text matched as expected');
}
},
//Publisher Info icon is present
{
description: 'Verify Publisher Info icon is present',
action: async () =>
{ const expectedIcon = await driver.wait(until.elementLocated(By.css('#divpublisher .fa')), 5000).catch(() => false);
if (!expectedIcon) {
throw new Error('Publisher Info icon is not present');
}
console.log('Passed: Publisher Info icon is present');
}
},
//Publisher textbox value
{
description: 'Validate Publisher textbox value',
action: async () => {
const elementValue = await driver.findElement(By.css('#creator')).getAttribute('value');
if (elementValue !== 'Juancho') {
throw new Error(`Expected: "Juancho" Publisher textbox value; Actual: "${elementValue}"`);
}
console.log('Passed: Publisher textbox value matched as expected');
}
},
//Status label
{
description: 'Validate Status label',
action: async () => {
const elementText = await driver.findElement(By.css('#divstatus > .form-label')).getText();
if (elementText !== 'Status') {
throw new Error(`Expected: "Status" label text; Actual: "${elementText}"`);
}
console.log('Passed: Status label text matched as expected');
}
},
//Status dropdown
{
description: 'Validate Status dropdown option',
action: async () => {
const elementText = await driver.findElement(By.css('#status > option:nth-child(1)')).getText();
if (elementText !== 'Draft') {
throw new Error(`Expected: "Draft" Status value text; Actual: "${elementText}"`);
}
console.log('Passed: Draft Status value text matched as expected');
}
},
//Effective Date label
{
description: 'Validate Effective Date label',
action: async () => {
const elementText = await driver.findElement(By.css('#diveffective > .form-label')).getText();
if (elementText !== 'Effective Date') {
throw new Error(`Expected: "Effective Date" label text; Actual: "${elementText}"`);
}
console.log('Passed: Effective Date label text matched as expected');
}
},
//Effective Date textbox
{
description: 'Validate Effective Date textbox value',
action: async () => {
const elementValue = await driver.findElement(By.css('#effective')).getAttribute('value');
if (elementValue !== '12/02/2022') {
throw new Error(`Expected: "12/02/2022" Effective Date textbox value; Actual: "${elementValue}"`);
}
console.log('Passed: 12/02/2022 Effective Date textbox value matched as expected');
}
},
//Language label
{
description: 'Validate Language label',
action: async () => {
const elementText = await driver.findElement(By.css('#divlang > .form-label')).getText();
if (elementText !== 'Language') {
throw new Error(`Expected: "Language" label text; Actual: "${elementText}"`);
}
console.log('Passed: Language label text matched as expected');
}
},
//Language dropdown
{
description: 'Validate Language dropdown option',
action: async () => {
const elementOption = await driver.findElement(By.css('#lang')).getAttribute('value');
if (elementOption !== 'en') {
throw new Error(`Expected: "English"; Actual: "${elementOption}"`);
}
console.log('Passed: English dropdown option matched as expected');
}
},
//Version label
{
description: 'Validate Version label',
action: async () => {
const elementText = await driver.findElement(By.css('#divversion > .form-label')).getText();
if (elementText !== 'Version') {
throw new Error(`Expected: "Version" label text; Actual: "${elementText}"`);
}
console.log('Passed: Version label text matched as expected');
}
},
//Version textbox
{
description: 'Validate Version textbox value',
action: async () => {
const elementValue = await driver.findElement(By.css('#version')).getAttribute('value');
if (elementValue !== '2022.1.1') {
throw new Error(`Expected: "2022.1.1" Version textbox value; Actual: "${elementValue}"`);
}
console.log('Passed: 2022.1.1 Version textbox value matched as expected');
}
},
//Notes label
{
description: 'Validate Notes label',
action: async () => {
const elementText = await driver.findElement(By.css('#divnotes > .form-label')).getText();
if (elementText !== 'Notes') {
throw new Error(`Expected: "Notes" label text; Actual: "${elementText}"`);
}
console.log('Passed: Notes label text matched as expected');
}
},
//Notes textbox value
{
description: 'Validate Notes textbox value',
action: async () => {
const elementValue = await driver.findElement(By.css('#notes')).getText();
if (elementValue !== 'This only contains Kindergarten for now.') {
throw new Error(`Expected: "This only contains Kindergarten for now." Notes textbox value; Actual: "${elementValue}"`);
}
console.log('Passed: Notes textbox value matched as expected');
}
},
//Delete button text
{
description: 'Validate Delete button text',
action: async () => {
const elementText = await driver.findElement(By.css('#orgdelete')).getText();
if (elementText !== 'Delete') {
throw new Error(`Expected: "Delete" button text; Actual: "${elementText}"`);
}
console.log('Passed: Delete button text matched as expected');
}
},
//Delete button color -red
{
description: 'Validate Delete button color',
action: async () => {
const elementStyle = await driver.findElement(By.css('#orgdelete')).getCssValue('background-color');
if (elementStyle !== 'rgba(220, 53, 69, 1)') {
throw new Error(`Delete button color did not match; Actual: "${elementStyle}"`);
}
console.log('Passed: Delete button color matched as expected');
}
},
//Save button text
{
description: 'Validate Save button text',
action: async () => {
const elementText = await driver.findElement(By.css('#modalop')).getAttribute('value');
if (elementText !== 'Save') {
throw new Error(`Expected: "Save" button text; Actual: "${elementText}"`);
}
console.log('Passed: Save button text matched as expected');
}
},
//Save button color -green
{
description: 'Validate Save button color',
action: async () => {
const elementStyle = await driver.findElement(By.css('#modalop')).getCssValue('background-color');
if (elementStyle !== 'rgba(48, 200, 172, 1)') {
throw new Error(`Save button color did not match; Actual: "${elementStyle}"`);
}
console.log('Passed: Save button color matched as expected');
}
},
//Close button text
{
description: 'Validate Close button text',
action: async () => {
const elementText = await driver.findElement(By.css('#modalclose')).getText();
if (elementText !== 'Close') {
throw new Error(`Expected: "Close" button text; Actual: "${elementText}"`);
}
console.log('Passed: Close button text matched as expected');
}
},
//Close button color -white
{
description: 'Validate Close button color',
action: async () => {
const elementStyle = await driver.findElement(By.css('#modalclose')).getCssValue('background-color');
if (elementStyle !== 'rgba(0, 0, 0, 0)') {
throw new Error(`Close button color did not match; Actual: "${elementStyle}"`);
}
console.log('Passed: Close button color matched as expected');
}
},
//NEXT ACTION - Close DIV
{ description: 'Click Close button', action: async () => await driver.findElement(By.css('#modalclose')).click() },
{ description: 'Wait for action to complete', action: async () => await driver.sleep(2000) },
//LOG OUT
//NEXT ACTION - Log out
{ description: 'Click Username dropdown', action: async () => await driver.findElement(By.css('#navbarDropdown > span')).click() },
{ description: 'Wait for action to complete', action: async () => await driver.sleep(2000) },
//Log Out icon
{
description: 'Verify Log Out icon is present',
action: async () =>
{ const expectedIcon = await driver.wait(until.elementLocated(By.css('.fa-sign-out')), 5000).catch(() => false);
if (!expectedIcon) {
throw new Error('Log Out icon not found');
}
console.log('Passed: Log Out icon present');
}
},
{ description: 'Click Log Out link', action: async () => await driver.findElement(By.linkText('Log Out')).click() },
//Wait for login screen to load
{
description: 'Wait for log out process to complete',
action: async () => {
return await driver.wait(until.elementLocated(By.css('.login')), 10000).catch(() => false);
}
},
//Log Out button
{
description: 'Verify Log Out button is present',
action: async () =>
{ const expectedIcon = await driver.wait(until.elementLocated(By.css('.login')), 5000).catch(() => false);
if (!expectedIcon) {
throw new Error('Log Out button not found');
}
console.log('Passed: Log Out button present; Script completed');
}
},
];
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', 'frameworkManagementPage');
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', 'frameworkManagementPage');
if (fs.existsSync(screenshotDir)) {
fs.rmSync(screenshotDir, { recursive: true, force: true });
}
fs.mkdirSync(screenshotDir, { recursive: true });
// Remove old Excel file
if (fs.existsSync('frameworkManagementPageResults.xlsx')) {
fs.unlinkSync('frameworkManagementPageResults.xlsx');
}
};
try {
// Initialize workbook and worksheet
clearOldResults();
// Initialize workbook and worksheet
workbook = XLSX.utils.book_new();
worksheet = XLSX.utils.aoa_to_sheet([
['Step Number', 'Step Description', 'Status', 'Timestamp', 'Screenshot']
]);
XLSX.utils.book_append_sheet(workbook, worksheet, 'Sheet1');
// Log test start time
worksheet = logStep(worksheet, 'Test Start', 'Started', '', startTime, '');
let allStepsPassed = true;
for (const step of steps) {
const stepIndex = steps.indexOf(step) + 1;
const timestamp = new Date().toISOString();
try {
await step.action();
const screenshotPath = await takeScreenshot(driver, stepIndex, step.description);
worksheet = logStep(worksheet, step.description, 'Passed', stepIndex, timestamp, screenshotPath);
} catch (error) {
const screenshotPath = await takeScreenshot(driver, stepIndex, `${step.description}_Failed`);
worksheet = logStep(worksheet, step.description, 'Failed', stepIndex, timestamp, screenshotPath);
console.error(`Step ${stepIndex} FAILED: ${error.message}`);
testStatus = 'Failed';
allStepsPassed = false;
}
}
//Check if log out was successful
const loginButton = await driver.wait(until.elementLocated(By.css('.login')), 5000).catch(() => false);
if (loginButton && allStepsPassed) {
console.log('PASSED: Framework Management Page(ExACT_frameworkManagementPage); All test steps completed successfully');
testStatus = 'Passed';
} else {
console.log('FAILED: Framework Management Page(ExACT_frameworkManagementPage); One or more test steps failed');
testStatus = 'Failed';
}
// Log test end time
const endTime = new Date().toISOString();
worksheet = logStep(worksheet, 'Test End', testStatus, '', endTime, '');
// Write the updated worksheet back to the workbook and save it
workbook.Sheets['Sheet1'] = worksheet;
XLSX.writeFile(workbook, 'frameworkManagementPageResults.xlsx');
} finally {
await driver.quit();
}
})();
}
export default ExACT_frameworkManagementPage;