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',
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') {
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',
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)') {
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
{ 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
{
@@ -782,7 +782,7 @@ const steps = [
action: async () => {
const elementText = await driver.findElement(By.css('#exampleModalCenterTitle')).getText();
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');
}
@@ -848,15 +848,15 @@ const steps = [
}
},
//Match exact phrase label (ECS-2893)
//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: 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',
action: async () => {
const elementText = await driver.findElement(By.css('#divtype')).getText();
if (elementText !== 'Organization') {
throw new Error(`Expected: "Organization" label text; Actual: "${elementText}"`);
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
}
console.log('Passed: Organization label text matched as expected');
}
},
//Fixes are made for text comparison for description text
//Organization value
{
description: 'Validate Applications of Linear Systems description text',
description: 'Validate Organization value',
action: async () => {
const elementText = await driver.findElement(By.css('#divtype')).getText();
const expectedText = 'Organization';
try {
const element = await driver.findElement(By.css('#divname > .form-label'));
// Trim the element text to avoid mismatch due to extra spaces or appended text
if (elementText.trimEnd() !== expectedText) {
throw new Error(`Expected: "${expectedText}" 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 = '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
}
console.log('Passed: text matched as expected');
}
},
//Organization label
{
description: 'Validate Organization label',
action: async () => {
const elementText = await driver.findElement(By.css('#divname')).getText();
const expectedText = 'Ogranization';
//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
{
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');
}
},
@@ -1938,15 +1953,15 @@ const steps = [
}
},
//Asterisk icons
//Asterisk icons is present
{
description: 'Validate Asterisk icons',
action: async () => {
const elementText = await driver.findElement(By.css('#divcreator')).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}"`);
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: 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)') {
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 () => {
const elementText = await driver.findElement(By.css('#divtype')).getText();
if (elementText !== 'Framework') {
throw new Error(`Expected: "Framework" type description text; Actual: "${elementText}"`);
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
}
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 () => {
const elementText = await driver.findElement(By.css('#divname')).getText();
if (elementText !== 'Juan Testing Again & Again') {
throw new Error(`Expected: "Juan Testing Again & Again" name description text; Actual: "${elementText}"`);
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
}
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 () => {
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 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 () => {
const elementText = await driver.findElement(By.css('.form-row:nth-child(1) > #divparent')).getText();
if (elementText !== 'Parent') {
throw new Error(`Expected: "Parent" parent description text; Actual: "${elementText}"`);
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
}
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 () => {
const elementText = await driver.findElement(By.css('#divdescription')).getText();
if (elementText !== 'Parent') {
throw new Error(`Expected: "1" parent description text; Actual: "${elementText}"`);
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
}
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 () => {
const elementText = await driver.findElement(By.css('#divcreator')).getText();
if (elementText !== 'Parent') {
throw new Error(`Expected: "2" creator description text; Actual: "${elementText}"`);
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
}
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 () => {
const elementText = await driver.findElement(By.css('#divpublisher')).getText();
if (elementText !== 'Parent') {
throw new Error(`Expected: "3" publisher description text; Actual: "${elementText}"`);
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
}
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 () => {
const elementText = await driver.findElement(By.css('#divstatus')).getText();
if (elementText !== 'Parent') {
throw new Error(`Expected: "4" Status description text; Actual: "${elementText}"`);
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
}
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 () => {
const elementText = await driver.findElement(By.css('#diveffective')).getText();
if (elementText !== 'Parent') {
throw new Error(`Expected: "5" effective date description text; Actual: "${elementText}"`);
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
}
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 () => {
const elementText = await driver.findElement(By.css('#divlang')).getText();
if (elementText !== 'Parent') {
throw new Error(`Expected: "5" language description text; Actual: "${elementText}"`);
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
}
console.log('Passed: Parent language description text matched as expected');
}
},
@@ -3214,19 +3436,42 @@ const steps = [
if (elementText !== 'Version') {
throw new Error(`Expected: "Version" label; Actual: "${elementText}"`);
}
console.log('Passed:Version label matched as expected');
console.log('Passed: Version label matched as expected');
}
},
//Version description
//Version value
{
description: 'Validate Version description',
description: 'Validate Version value',
action: async () => {
const elementText = await driver.findElement(By.css('#divversion')).getText();
if (elementText !== 'Parent') {
throw new Error(`Expected: "6" version description text; Actual: "${elementText}"`);
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
}
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 () => {
const elementText = await driver.findElement(By.css('#divnotes')).getText();
if (elementText !== 'Parent') {
throw new Error(`Expected: "6" notes description text; Actual: "${elementText}"`);
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
}
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 () => {
const elementText = await driver.findElement(By.css('.form-row:nth-child(4) > #divsource')).getText();
if (elementText !== 'Parent') {
throw new Error(`Expected: "7" created description text; Actual: "${elementText}"`);
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
}
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 () => {
const elementText = await driver.findElement(By.css('.form-row:nth-child(4) > #divparent')).getText();
if (elementText !== 'Parent') {
throw new Error(`Expected: "8" last modified description text; Actual: "${elementText}"`);
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
}
console.log('Passed: Parent last modified description text matched as expected');
}
},
@@ -3377,11 +3691,34 @@ const steps = [
{
description: 'Validate Type value text',
action: async () => {
const elementText = await driver.findElement(By.css('#divtype')).getText();
if (elementText !== 'Framework') {
throw new Error(`Expected: "Framework" Type value text; Actual: "${elementText}"`);
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
}
console.log('Passed: "Framework" Type value text matched as expected');
}
},
@@ -3869,7 +4206,7 @@ try {
//Check if log out was successful
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');
testStatus = 'Passed';
} else {