Added split row validation fix

This commit is contained in:
2025-05-19 13:44:43 -07:00
parent 4a2e737929
commit dbaa521358
2 changed files with 483 additions and 146 deletions

Binary file not shown.

View File

@@ -741,7 +741,7 @@ const steps = [
{ {
description: 'Validate Advanced Search button text', description: 'Validate Advanced Search button text',
action: async () => { action: async () => {
const elementText = await driver.findElement(By.css('.bg-green')).getText(); const elementText = await driver.findElement(By.css('div:nth-child(4) > .btn')).getText();
if (elementText !== 'Advanced Search') { if (elementText !== 'Advanced Search') {
throw new Error(`Expected: "Advanced Search" button text; Actual: "${elementText}"`); throw new Error(`Expected: "Advanced Search" button text; Actual: "${elementText}"`);
} }
@@ -749,20 +749,20 @@ const steps = [
} }
}, },
//Advanced Search button color -green (ECS-2894) //Advanced Search button color -green
{ {
description: 'Validate Advanced Search button color', description: 'Validate Advanced Search button color',
action: async () => { action: async () => {
const elementStyle = await driver.findElement(By.css('.bg-green')).getCssValue('background-color'); const elementStyle = await driver.findElement(By.css('div:nth-child(4) > .btn')).getCssValue('background-color');
if (elementStyle !== 'rgba(48, 200, 172, 1)') { if (elementStyle !== 'rgba(48, 200, 172, 1)') {
throw new Error(`ECS-2894 Advanced Search button color did not match; Actual: "${elementStyle}"`); throw new Error(`Advanced Search button color did not match; Actual: "${elementStyle}"`);
} }
console.log('Passed: ECS-2894 Advanced Search button color matched as expected'); console.log('Passed: Advanced Search button color matched as expected');
} }
}, },
//NEXT ACTION - Advanced Search button //NEXT ACTION - Advanced Search button
{ description: 'Click Advanced Search button', action: async () => await driver.findElement(By.css('.bg-green')).click() }, { description: 'Click Advanced Search button', action: async () => await driver.findElement(By.css('div:nth-child(4) > .btn')).click() },
//Advanced Search DIV //Advanced Search DIV
{ {
@@ -782,7 +782,7 @@ const steps = [
action: async () => { action: async () => {
const elementText = await driver.findElement(By.css('#exampleModalCenterTitle')).getText(); const elementText = await driver.findElement(By.css('#exampleModalCenterTitle')).getText();
if (elementText !== 'Advance Framework Search') { if (elementText !== 'Advance Framework Search') {
throw new Error(`Expected: "Advance Framework Searchh" DIV title text; Actual: "${elementText}"`); throw new Error(`Expected: "Advance Framework Search" DIV title text; Actual: "${elementText}"`);
} }
console.log('Passed: Advance Framework Search DIV title text matched as expected'); console.log('Passed: Advance Framework Search DIV title text matched as expected');
} }
@@ -848,15 +848,15 @@ const steps = [
} }
}, },
//Match exact phrase label (ECS-2893) //Match exact phrase label
{ {
description: 'Validate Match exact phrase label', description: 'Validate Match exact phrase label',
action: async () => { action: async () => {
const elementText = await driver.findElement(By.css('.ml-2:nth-child(2)')).getText(); const elementText = await driver.findElement(By.css('.ml-2:nth-child(2)')).getText();
if (elementText !== 'Match exact phrase') { if (elementText !== 'Match exact phrase') {
throw new Error(`Expected: ECS-2893 "Match exact phrase" label; Actual: "${elementText}"`); throw new Error(`Expected: "Match exact phrase" label; Actual: "${elementText}"`);
} }
console.log('Passed: ECS-2893 Match exact phrase label matched as expected'); console.log('Passed: Match exact phrase label matched as expected');
} }
}, },
@@ -1408,54 +1408,69 @@ const steps = [
{ {
description: 'Validate Organization label', description: 'Validate Organization label',
action: async () => { action: async () => {
const elementText = await driver.findElement(By.css('#divtype')).getText(); try {
if (elementText !== 'Organization') { const element = await driver.findElement(By.css('#divtype'));
throw new Error(`Expected: "Organization" label text; Actual: "${elementText}"`);
}
console.log('Passed: Organization label text matched as expected');
}
},
//Fixes are made for text comparison for description text //Get different versions of the text for debugging
{ const fullText = await element.getText();
description: 'Validate Applications of Linear Systems description text',
action: async () => { //Check for the expected text in different ways
const elementText = await driver.findElement(By.css('#divtype')).getText();
const expectedText = 'Organization'; const expectedText = 'Organization';
const trimmedFullText = fullText.trim();
const firstLine = trimmedFullText.split('\n')[0].trim();
// Trim the element text to avoid mismatch due to extra spaces or appended text //Try multiple matching strategies
if (elementText.trimEnd() !== expectedText) { if (firstLine.includes(expectedText)) {
throw new Error(`Expected: "${expectedText}" text; Actual: "${elementText}"`); 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`
);
} }
console.log('Passed: text matched as expected'); } catch (error) {
console.error('Detailed error during validation:', error);
throw error; //Re-throw after logging
}
} }
}, },
//Organization value
//Organization label
{ {
description: 'Validate Organization label', description: 'Validate Organization value',
action: async () => { action: async () => {
const elementText = await driver.findElement(By.css('#divname')).getText(); try {
const expectedText = 'Ogranization'; const element = await driver.findElement(By.css('#divname > .form-label'));
//Trim expected text
if (elementText.trimStart() !== expectedText) {
throw new Error(`Expected: "${expectedText}" label text; Actual: "${elementText}"`);
}
console.log(`Passed: "${expectedText}" label text matched as expected`);
}
},
//Name label //Get different versions of the text for debugging
{ const fullText = await element.getText();
description: 'Validate Name label',
action: async () => { //Check for the expected text in different ways
const elementText = await driver.findElement(By.css('#divname > .form-label')).getText(); const expectedText = 'Name';
if (elementText !== 'Name') { const trimmedFullText = fullText.trim();
throw new Error(`Expected: "Name" label text; Actual: "${elementText}"`); 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
} }
console.log('Passed: Name label text matched as expected');
} }
}, },
@@ -1938,15 +1953,15 @@ const steps = [
} }
}, },
//Asterisk icons //Asterisk icons is present
{ {
description: 'Validate Asterisk icons', description: 'Validate Asterisk icons',
action: async () => { action: async () =>
const elementText = await driver.findElement(By.css('#divcreator')).getText(); { const expectedIcon = await driver.wait(until.elementLocated(By.css('#divcreator')), 5000).catch(() => false);
if (elementText !== 'This option also allows access to this framework via CASE compliant API') { if (!expectedIcon) {
throw new Error(`Expected: "This option also allows access to this framework via CASE compliant API" label text; Actual: "${elementText}"`); throw new Error('Asterisk icon is not present');
} }
console.log('Passed: This option also allows access to this framework via CASE compliant API label text matched as expected'); console.log('Passed: Asterisk icon is present');
} }
}, },
@@ -2066,7 +2081,7 @@ const steps = [
if (elementStyle !== 'rgba(48, 200, 172, 1)') { if (elementStyle !== 'rgba(48, 200, 172, 1)') {
throw new Error(`Publish button color did not match; Actual: "${elementStyle}"`); throw new Error(`Publish button color did not match; Actual: "${elementStyle}"`);
} }
console.log('Passed: SPublish button color matched as expected'); console.log('Passed: Publish button color matched as expected');
} }
}, },
@@ -2978,15 +2993,38 @@ const steps = [
} }
}, },
//Type description //Type value
{ {
description: 'Validate Type description', description: 'Validate Type value',
action: async () => { action: async () => {
const elementText = await driver.findElement(By.css('#divtype')).getText(); try {
if (elementText !== 'Framework') { const element = await driver.findElement(By.css('#divtype'));
throw new Error(`Expected: "Framework" type description text; Actual: "${elementText}"`);
//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
} }
console.log('Passed: Framework type description text matched as expected');
} }
}, },
@@ -3002,15 +3040,38 @@ const steps = [
} }
}, },
//Name description //Name value
{ {
description: 'Validate Name description', description: 'Validate Name value',
action: async () => { action: async () => {
const elementText = await driver.findElement(By.css('#divname')).getText(); try {
if (elementText !== 'Juan Testing Again & Again') { const element = await driver.findElement(By.css('#divname'));
throw new Error(`Expected: "Juan Testing Again & Again" name description text; Actual: "${elementText}"`);
//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
} }
console.log('Passed: Juan Testing Again & Again name description text matched as expected');
} }
}, },
@@ -3026,15 +3087,15 @@ const steps = [
} }
}, },
//Source URL description //Source URL value
{ {
description: 'Validate Source URL description', description: 'Validate Source URL value',
action: async () => { action: async () => {
const elementText = await driver.findElement(By.linkText('https://www.espn.com')).getText(); const elementText = await driver.findElement(By.linkText('https://www.espn.com')).getText();
if (elementText !== 'https://www.espn.com') { if (elementText !== 'https://www.espn.com') {
throw new Error(`Expected: "https://www.espn.com" source URL description text; Actual: "${elementText}"`); throw new Error(`Expected: "https://www.espn.com" source URL valuen text; Actual: "${elementText}"`);
} }
console.log('Passed: https://www.espn.com source URL description text matched as expected'); console.log('Passed: https://www.espn.com source URL value text matched as expected');
} }
}, },
@@ -3050,15 +3111,38 @@ const steps = [
} }
}, },
//Parent description //Parent value
{ {
description: 'Validate Parent description', description: 'Validate Parent value',
action: async () => { action: async () => {
const elementText = await driver.findElement(By.css('.form-row:nth-child(1) > #divparent')).getText(); try {
if (elementText !== 'Parent') { const element = await driver.findElement(By.css('.form-row:nth-child(1) > #divparent'));
throw new Error(`Expected: "Parent" parent description text; Actual: "${elementText}"`);
//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
} }
console.log('Passed: Parent parent description text matched as expected');
} }
}, },
@@ -3074,15 +3158,38 @@ const steps = [
} }
}, },
//Description description //Description value
{ {
description: 'Validate Description description', description: 'Validate Description value',
action: async () => { action: async () => {
const elementText = await driver.findElement(By.css('#divdescription')).getText(); try {
if (elementText !== 'Parent') { const element = await driver.findElement(By.css('#divdescription'));
throw new Error(`Expected: "1" parent description text; Actual: "${elementText}"`);
//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
} }
console.log('Passed: Parent parent description text matched as expected');
} }
}, },
@@ -3098,15 +3205,38 @@ const steps = [
} }
}, },
//Creator description //Creator value
{ {
description: 'Validate Creator description', description: 'Validate Creator value',
action: async () => { action: async () => {
const elementText = await driver.findElement(By.css('#divcreator')).getText(); try {
if (elementText !== 'Parent') { const element = await driver.findElement(By.css('#divcreator'));
throw new Error(`Expected: "2" creator description text; Actual: "${elementText}"`);
//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
} }
console.log('Passed: Parent creator description text matched as expected');
} }
}, },
@@ -3122,15 +3252,38 @@ const steps = [
} }
}, },
//Publisher description //Publisher value
{ {
description: 'Validate Publisher description', description: 'Validate Publisher value',
action: async () => { action: async () => {
const elementText = await driver.findElement(By.css('#divpublisher')).getText(); try {
if (elementText !== 'Parent') { const element = await driver.findElement(By.css('#divpublisher'));
throw new Error(`Expected: "3" publisher description text; Actual: "${elementText}"`);
//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
} }
console.log('Passed: Parent publisher description text matched as expected');
} }
}, },
@@ -3146,15 +3299,38 @@ const steps = [
} }
}, },
//Status description //Status value
{ {
description: 'Validate Status description', description: 'Validate Status value',
action: async () => { action: async () => {
const elementText = await driver.findElement(By.css('#divstatus')).getText(); try {
if (elementText !== 'Parent') { const element = await driver.findElement(By.css('#divstatus'));
throw new Error(`Expected: "4" Status description text; Actual: "${elementText}"`);
//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
} }
console.log('Passed: Parent Status description text matched as expected');
} }
}, },
@@ -3170,15 +3346,38 @@ const steps = [
} }
}, },
//Effective Date description //Effective Date value
{ {
description: 'Validate Effective Date description', description: 'Validate Effective Date value',
action: async () => { action: async () => {
const elementText = await driver.findElement(By.css('#diveffective')).getText(); try {
if (elementText !== 'Parent') { const element = await driver.findElement(By.css('#diveffective'));
throw new Error(`Expected: "5" effective date description text; Actual: "${elementText}"`);
//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
} }
console.log('Passed: Parent effective date description text matched as expected');
} }
}, },
@@ -3194,15 +3393,38 @@ const steps = [
} }
}, },
//Language description //Language value
{ {
description: 'Validate Language description', description: 'Validate Language value',
action: async () => { action: async () => {
const elementText = await driver.findElement(By.css('#divlang')).getText(); try {
if (elementText !== 'Parent') { const element = await driver.findElement(By.css('#divlang'));
throw new Error(`Expected: "5" language description text; Actual: "${elementText}"`);
//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
} }
console.log('Passed: Parent language description text matched as expected');
} }
}, },
@@ -3218,15 +3440,38 @@ const steps = [
} }
}, },
//Version description //Version value
{ {
description: 'Validate Version description', description: 'Validate Version value',
action: async () => { action: async () => {
const elementText = await driver.findElement(By.css('#divversion')).getText(); try {
if (elementText !== 'Parent') { const element = await driver.findElement(By.css('#divversion'));
throw new Error(`Expected: "6" version description text; Actual: "${elementText}"`);
//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
} }
console.log('Passed: Parent version description text matched as expected');
} }
}, },
@@ -3242,15 +3487,38 @@ const steps = [
} }
}, },
//Notes description //Notes value
{ {
description: 'Validate Notes description', description: 'Validate Notes value',
action: async () => { action: async () => {
const elementText = await driver.findElement(By.css('#divnotes')).getText(); try {
if (elementText !== 'Parent') { const element = await driver.findElement(By.css('#divnotes'));
throw new Error(`Expected: "6" notes description text; Actual: "${elementText}"`);
//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
} }
console.log('Passed: Parent notes description text matched as expected');
} }
}, },
@@ -3266,15 +3534,38 @@ const steps = [
} }
}, },
//Created description //Created value
{ {
description: 'Validate Created description', description: 'Validate Created value',
action: async () => { action: async () => {
const elementText = await driver.findElement(By.css('.form-row:nth-child(4) > #divsource')).getText(); try {
if (elementText !== 'Parent') { const element = await driver.findElement(By.css('.form-row:nth-child(4) > #divsource'));
throw new Error(`Expected: "7" created description text; Actual: "${elementText}"`);
//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
} }
console.log('Passed: Parent created description text matched as expected');
} }
}, },
@@ -3290,15 +3581,38 @@ const steps = [
} }
}, },
//Last Modified description //Last Modified value
{ {
description: 'Validate Last Modified description', description: 'Validate Last Modified value',
action: async () => { action: async () => {
const elementText = await driver.findElement(By.css('.form-row:nth-child(4) > #divparent')).getText(); try {
if (elementText !== 'Parent') { const element = await driver.findElement(By.css('.form-row:nth-child(4) > #divparent'));
throw new Error(`Expected: "8" last modified description text; Actual: "${elementText}"`);
//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
} }
console.log('Passed: Parent last modified description text matched as expected');
} }
}, },
@@ -3377,11 +3691,34 @@ const steps = [
{ {
description: 'Validate Type value text', description: 'Validate Type value text',
action: async () => { action: async () => {
const elementText = await driver.findElement(By.css('#divtype')).getText(); try {
if (elementText !== 'Framework') { const element = await driver.findElement(By.css('#divtype'));
throw new Error(`Expected: "Framework" Type value text; Actual: "${elementText}"`);
//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
} }
console.log('Passed: "Framework" Type value text matched as expected');
} }
}, },
@@ -3869,7 +4206,7 @@ try {
//Check if log out was successful //Check if log out was successful
const loginButton = await driver.wait(until.elementLocated(By.css('.login')), 5000).catch(() => false); const loginButton = await driver.wait(until.elementLocated(By.css('.login')), 5000).catch(() => false);
if (loginButton & allStepsPassed) { if (loginButton && allStepsPassed) {
console.log('PASSED: Framework Management Page(ExACT_frameworkManagementPage); All test steps completed successfully'); console.log('PASSED: Framework Management Page(ExACT_frameworkManagementPage); All test steps completed successfully');
testStatus = 'Passed'; testStatus = 'Passed';
} else { } else {