Added split row validation fix

This commit is contained in:
2025-05-19 15:13:38 -07:00
parent fdeebd91e1
commit 0c5017801d
2 changed files with 95 additions and 26 deletions

View File

@@ -1028,19 +1028,7 @@ const steps = [
}
},
//Biology - QA Total Items label
{
description: 'Validate Biology - QA Totals DIV - Total Items label',
action: async () => {
const elementText = await driver.findElement(By.css('#total')).getText();
if (elementText !== 'My Content Totals') {
throw new Error(`Expected: "My Content Totals"; Actual: "${elementText}"`);
}
console.log('Passed: Biology - QA Totals DIV - Total Items label matched as expected');
}
},
//Biology - QA Total Items Count "1046"?
//Biology - QA Total Items Count "1046"
{
description: 'Validate Biology - QA Totals DIV - Total Items Count',
action: async () => {
@@ -1048,7 +1036,7 @@ const steps = [
if (elementText !== '1046') {
throw new Error(`Expected: "1046"; Actual: "${elementText}"`);
}
console.log('Passed: Biology - QA Totals DIV - Total Items Count matched as expected');
console.log('Passed: 1046 - Total Items Count matched as expected');
}
},
@@ -1064,15 +1052,38 @@ const steps = [
}
},
//Biology - QA Unique Titles label
//Biology - QA Total Items label
{
description: 'Validate Biology - QA Totals DIV - Unique Titles label',
description: 'Validate Biology - QA Totals DIV - Total Items label',
action: async () => {
const elementText = await driver.findElement(By.css('#total_titles')).getText();
if (elementText !== 'Unique Titles') {
throw new Error(`Expected: "Unique Titles"; Actual: "${elementText}"`);
try {
const element = await driver.findElement(By.css('#total'));
//Get different versions of the text for debugging
const fullText = await element.getText();
//Check for the expected text in different ways
const expectedText = 'Total Items';
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: Biology - QA Totals DIV - Unique Titles label matched as expected');
}
},
@@ -1100,15 +1111,38 @@ const steps = [
}
},
//Biology - QA Unique IDs label
//Biology - QA Unique Titles label
{
description: 'Validate Biology - QA Totals DIV - Unique IDs',
description: 'Validate Biology - QA Totals DIV - Unique Titles label',
action: async () => {
const elementText = await driver.findElement(By.css('#total_pubtotalids')).getText();
if (elementText !== 'Unique IDs') {
throw new Error(`Expected: "Unique IDs"; Actual: "${elementText}"`);
try {
const element = await driver.findElement(By.css('#total_titles'));
//Get different versions of the text for debugging
const fullText = await element.getText();
//Check for the expected text in different ways
const expectedText = 'Unique Titles';
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: Biology - QA Totals DIV - Unique IDs label matched as expected');
}
},
@@ -1136,6 +1170,41 @@ const steps = [
}
},
//Biology - QA Unique IDs label
{
description: 'Validate Biology - QA Totals DIV - Unique IDs',
action: async () => {
try {
const element = await driver.findElement(By.css('#total_pubtotalids'));
//Get different versions of the text for debugging
const fullText = await element.getText();
//Check for the expected text in different ways
const expectedText = 'Unique IDs';
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
}
}
},
//My Content; My Content Totals DIV - Close button
{
description: 'Validate My Content Totals DIV - Close button',