Added split row validation fix

This commit is contained in:
2025-05-20 13:42:30 -07:00
parent 0c5017801d
commit d3f0d6a2c9
2 changed files with 221 additions and 33 deletions

Binary file not shown.

View File

@@ -165,11 +165,34 @@ const steps = [
{
description: 'Validate Content 1 description',
action: async () => {
const elementText = await driver.findElement(By.css('.card:nth-child(8) .lo-descr')).getText();
if (elementText !== 'Yes, it should work! Perhaps') {
throw new Error(`Expected: Content 1 description text did not match; Actual: "${elementText}"`);
try {
const element = await driver.findElement(By.css('.card:nth-child(8) .lo-descr'));
//Get different versions of the text for debugging
const fullText = await element.getText();
//Check for the expected text in different ways
const expectedText = 'Yes, it should work! Perhaps';
const trimmedFullText = fullText.trim();
const firstLine = trimmedFullText.split('\n')[0].trim();
//Try multiple matching strategies
if (firstLine.includes(expectedText)) {
console.log(`Passed: Content 1 description "${expectedText}" text in first line`);
} else if (trimmedFullText.includes(expectedText)) {
console.log(`Passed: Content 1 description "${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: Content 1 description text matched as expected');
}
},
@@ -190,7 +213,7 @@ const steps = [
description: 'Validate Content 1 ECS Alignement label',
action: async () => {
const elementText = await driver.findElement(By.css('#alignstatuslink874454004 > .display-alignment')).getText();
if (elementText !== 'Aligned (reset)') {
if (elementText !== 'Alignment Pending (reset)') {
throw new Error(`Expected: Content 1 "ECS Alignement" label did not match; Actual: "${elementText}"`);
}
console.log('Passed: Content 1 ECS Alignement label matched as expected');
@@ -489,7 +512,7 @@ const steps = [
//Edit item Save button -green
{
description: 'Validate required label',
description: 'Validate Save button color',
action: async () => {
const elementStyle = await driver.findElement(By.css('.submit-content-button')).getCssValue('color');
if (elementStyle !== 'rgba(255, 255, 255, 1)') {
@@ -1079,6 +1102,18 @@ const steps = [
}
},
//Edit item Save button icon
{
description: 'Verify Save button icon is present',
action: async () =>
{ const expectedIcon = await driver.wait(until.elementLocated(By.css('.glyphicon-save')), 5000).catch(() => false);
if (!expectedIcon) {
throw new Error('Save button icon not found');
}
console.log('Passed: Save button icon present');
}
},
//Edit item Save button
{
description: 'Validate Save button text',
@@ -1091,9 +1126,9 @@ const steps = [
}
},
//Edit item Save button -green
//Edit item Save button color -green
{
description: 'Validate required label',
description: 'Validate Save button color',
action: async () => {
const elementStyle = await driver.findElement(By.css('.submit-content-button')).getCssValue('color');
if (elementStyle !== 'rgba(255, 255, 255, 1)') {
@@ -1215,7 +1250,7 @@ const steps = [
{
description: 'Validate Alignment title',
action: async () => {
const elementText = await driver.findElement(By.css('#me51861f7f132f814cec419806f86545e > td:nth-child(1)')).getText();
const elementText = await driver.findElement(By.css('#m7bc870b69c573f14118976177fc3fee7 > td:nth-child(1)')).getText();
if (elementText !== 'Alignment Status') {
throw new Error(`Expected: "Alignment Status" title did not match; Actual: "${elementText}"`);
}
@@ -1228,10 +1263,10 @@ const steps = [
description: 'Validate textbox value',
action: async () => {
const elementValue = await driver.findElement(By.css('td > .form-control')).getAttribute('value');
if (elementValue !== 'Aligned') {
throw new Error(`Expected: Alignment Status value "Aligned"; Actual: "${elementValue}"`);
if (elementValue !== 'Pending') {
throw new Error(`Expected: Alignment Status value "Pending"; Actual: "${elementValue}"`);
}
console.log('Passed: Alignment Status value Aligned text matched as expected');
console.log('Passed: Alignment Status value Pending text matched as expected');
}
},
@@ -1248,7 +1283,7 @@ const steps = [
},*/
//NEXT ACTION - CONCEPTS/CORRELTATE
{ description: 'Click Metadata tab link', action: async () => await driver.findElement(By.linkText('Concepts/Correlate')).click() },
{ description: 'Click Concepts Correlate tab link', action: async () => await driver.findElement(By.linkText('Concepts/Correlate')).click() },
{ description: 'Wait for action to complete', action: async () => await driver.sleep(5000) },
//Page title
@@ -1359,6 +1394,18 @@ const steps = [
}
},
//Edit item Save button icon
{
description: 'Verify Save button icon is present',
action: async () =>
{ const expectedIcon = await driver.wait(until.elementLocated(By.css('.glyphicon-save')), 5000).catch(() => false);
if (!expectedIcon) {
throw new Error('Save button icon not found');
}
console.log('Passed: Save button icon present');
}
},
//Edit item Save button
{
description: 'Validate Save button text',
@@ -1371,9 +1418,9 @@ const steps = [
}
},
//Edit item Save button -green
//Edit item Save button color -green
{
description: 'Validate required label',
description: 'Validate Save button color',
action: async () => {
const elementStyle = await driver.findElement(By.css('.submit-content-button')).getCssValue('color');
if (elementStyle !== 'rgba(255, 255, 255, 1)') {
@@ -1399,11 +1446,34 @@ const steps = [
{
description: 'Validate Tagged Concepts breadcrumb 1 text',
action: async () => {
const elementText = await driver.findElement(By.css('#k252821892')).getText();
if (elementText !== 'Mathematics | Number Operations | Exponents/Powers | Fractional - Note: includes negative fractional; relates to radicals Remove') {
throw new Error(`Expected: Tagged Concepts breadcrumb 1 text did not match; Actual: "${elementText}"`);
try {
const element = await driver.findElement(By.css('#k11532326'));
//Get different versions of the text for debugging
const fullText = await element.getText();
//Check for the expected text in different ways
const expectedText = 'Science | Physical Science | Chemistry | Scientists | General';
const trimmedFullText = fullText.trim();
const firstLine = trimmedFullText.split('\n')[0].trim();
//Try multiple matching strategies
if (firstLine.includes(expectedText)) {
console.log(`Passed: Content 1 description "${expectedText}" text in first line`);
} else if (trimmedFullText.includes(expectedText)) {
console.log(`Passed: Content 1 description "${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: Tagged Concepts breadcrumb 1 text matched as expected');
}
},
@@ -1411,7 +1481,7 @@ const steps = [
{
description: 'Verify remove button 1 icon is present',
action: async () =>
{ const expectedIcon = await driver.wait(until.elementLocated(By.css('#k252821892 .glyphicon')), 5000).catch(() => false);
{ const expectedIcon = await driver.wait(until.elementLocated(By.css('#k11532326 .glyphicon')), 5000).catch(() => false);
if (!expectedIcon) {
throw new Error('Tagged Concept "Remove" button 1 icon not found');
}
@@ -1423,7 +1493,7 @@ const steps = [
{
description: 'Validate Tagged Concepts delete button 1 text',
action: async () => {
const elementText = await driver.findElement(By.css('#k252821892 > .btn')).getText();
const elementText = await driver.findElement(By.css('#k11532326 > .btn')).getText();
if (elementText !== 'Remove') {
throw new Error(`Expected: Tagged Concept "Remove" button 1 text did not match; Actual: "${elementText}"`);
}
@@ -1435,7 +1505,7 @@ const steps = [
{
description: 'Validate remove button 1 label color',
action: async () => {
const elementStyle = await driver.findElement(By.css('#k252821892 > .btn')).getCssValue('background-color');
const elementStyle = await driver.findElement(By.css('#k11532326 > .btn')).getCssValue('background-color');
if (elementStyle !== 'rgba(246, 60, 40, 1)') {
throw new Error(`Expected: Tagged Concept "Remove" button 1 color did not match; Actual: "${elementStyle}"`);
}
@@ -1447,7 +1517,7 @@ const steps = [
{
description: 'Validate Tagged Concepts remove button 1 tooltip',
action: async () => {
const elementStyle = await driver.findElement(By.css('#k252821892 > .btn')).getAttribute('title');
const elementStyle = await driver.findElement(By.css('#k11532326 > .btn')).getAttribute('title');
if (elementStyle !== 'Remove Concept') {
throw new Error(`Expected: Tagged Concept "Remove Concept" button 1 tooltip did not match; Actual: "${elementStyle}"`);
}
@@ -1459,7 +1529,7 @@ const steps = [
{
description: 'Verify primary toggle button 1 is present',
action: async () =>
{ const expectedIcon = await driver.wait(until.elementLocated(By.css('#k252821892 .switch-primary')), 5000).catch(() => false);
{ const expectedIcon = await driver.wait(until.elementLocated(By.css('#k11532326 .switch-primary')), 5000).catch(() => false);
if (!expectedIcon) {
throw new Error('Tagged Concept "Primary" toggle button 1 icon not found');
}
@@ -1471,11 +1541,34 @@ const steps = [
{
description: 'Validate Tagged Concepts breadcrumb 2 text',
action: async () => {
const elementText = await driver.findElement(By.css('#k425604098')).getText();
if (elementText !== 'Mathematics | General Remove checkbox Toggle') {
throw new Error(`Expected: Tagged Concepts breadcrumb 2 text did not match; Actual: "${elementText}"`);
try {
const element = await driver.findElement(By.css('#k425604097'));
//Get different versions of the text for debugging
const fullText = await element.getText();
//Check for the expected text in different ways
const expectedText = 'Language Arts | General';
const trimmedFullText = fullText.trim();
const firstLine = trimmedFullText.split('\n')[0].trim();
//Try multiple matching strategies
if (firstLine.includes(expectedText)) {
console.log(`Passed: Content 1 description "${expectedText}" text in first line`);
} else if (trimmedFullText.includes(expectedText)) {
console.log(`Passed: Content 1 description "${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: Tagged Concepts breadcrumb 2 text matched as expected');
}
},
@@ -1483,7 +1576,7 @@ const steps = [
{
description: 'Verify remove button 2 icon is present',
action: async () =>
{ const expectedIcon = await driver.wait(until.elementLocated(By.css('#k425604098 .glyphicon')), 5000).catch(() => false);
{ const expectedIcon = await driver.wait(until.elementLocated(By.css('#k425604097 .glyphicon')), 5000).catch(() => false);
if (!expectedIcon) {
throw new Error('Tagged Concept "Remove" button 2 icon not found');
}
@@ -1495,7 +1588,7 @@ const steps = [
{
description: 'Validate Tagged Concepts delete button 2 text',
action: async () => {
const elementText = await driver.findElement(By.css('#k425604098 > .btn')).getText();
const elementText = await driver.findElement(By.css('#k425604097 > .btn')).getText();
if (elementText !== 'Remove') {
throw new Error(`Expected: Tagged Concept "Remove" button 2 text did not match; Actual: "${elementText}"`);
}
@@ -1507,7 +1600,7 @@ const steps = [
{
description: 'Validate remove button 2 color',
action: async () => {
const elementStyle = await driver.findElement(By.css('#k425604098 > .btn')).getCssValue('background-color');
const elementStyle = await driver.findElement(By.css('#k425604097 > .btn')).getCssValue('background-color');
if (elementStyle !== 'rgba(246, 60, 40, 1)') {
throw new Error(`Expected: Tagged Concept "Remove" button 2 text color did not match; Actual: "${elementStyle}"`);
}
@@ -1519,7 +1612,7 @@ const steps = [
{
description: 'Validate Tagged Concepts remove button 2 tooltip',
action: async () => {
const elementStyle = await driver.findElement(By.css('#k425604098 > .btn')).getAttribute('title');
const elementStyle = await driver.findElement(By.css('#k425604097 > .btn')).getAttribute('title');
if (elementStyle !== 'Remove Concept') {
throw new Error(`Expected: Tagged Concept "Remove Concept" button 2 tooltip did not match; Actual: "${elementStyle}"`);
}
@@ -1531,7 +1624,7 @@ const steps = [
{
description: 'Verify primary toggle button 2 is present',
action: async () =>
{ const expectedIcon = await driver.wait(until.elementLocated(By.css('#k425604098 .switch-primary')), 5000).catch(() => false);
{ const expectedIcon = await driver.wait(until.elementLocated(By.css('#k425604097 .switch-primary')), 5000).catch(() => false);
if (!expectedIcon) {
throw new Error('Tagged Concept "Primary" toggle button 2 icon not found');
}
@@ -1539,6 +1632,101 @@ const steps = [
}
},
//Tagged Concepts breadcrumb 3 text
{
description: 'Validate Tagged Concepts breadcrumb 3 text',
action: async () => {
try {
const element = await driver.findElement(By.css('#k425604100'));
//Get different versions of the text for debugging
const fullText = await element.getText();
//Check for the expected text in different ways
const expectedText = 'Social Studies | General';
const trimmedFullText = fullText.trim();
const firstLine = trimmedFullText.split('\n')[0].trim();
//Try multiple matching strategies
if (firstLine.includes(expectedText)) {
console.log(`Passed: Content 1 description "${expectedText}" text in first line`);
} else if (trimmedFullText.includes(expectedText)) {
console.log(`Passed: Content 1 description "${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
}
}
},
//Tagged Concepts remove button 3 icon
{
description: 'Verify remove button 3 icon is present',
action: async () =>
{ const expectedIcon = await driver.wait(until.elementLocated(By.css('#k425604100 .glyphicon')), 5000).catch(() => false);
if (!expectedIcon) {
throw new Error('Tagged Concept "Remove" button 3 icon not found');
}
console.log('Passed: Remove button 3 icon present');
}
},
//Tagged Concepts remove button 3 text
{
description: 'Validate Tagged Concepts delete button 3 text',
action: async () => {
const elementText = await driver.findElement(By.css('#k425604100 > .btn')).getText();
if (elementText !== 'Remove') {
throw new Error(`Expected: Tagged Concept "Remove" button 3 text did not match; Actual: "${elementText}"`);
}
console.log('Passed: Tagged Concept Remove button 3 text matched as expected');
}
},
//Tagged Concepts remove button 3 color -red
{
description: 'Validate remove button 3 color',
action: async () => {
const elementStyle = await driver.findElement(By.css('#k425604100 > .btn')).getCssValue('background-color');
if (elementStyle !== 'rgba(246, 60, 40, 1)') {
throw new Error(`Expected: Tagged Concept "Remove" button 3 text color did not match; Actual: "${elementStyle}"`);
}
console.log('Passed: Tagged Concept Remove button 3 text color matched as expected');
}
},
//Tagged Concepts remove button 3 -tooltip
{
description: 'Validate Tagged Concepts remove button 3 tooltip',
action: async () => {
const elementStyle = await driver.findElement(By.css('#k425604100 > .btn')).getAttribute('title');
if (elementStyle !== 'Remove Concept') {
throw new Error(`Expected: Tagged Concept "Remove Concept" button 3 tooltip did not match; Actual: "${elementStyle}"`);
}
console.log('Passed: Tagged Concept Remove Concept button 3 tooltip matched as expected');
}
},
//Tagged Concepts primary toggle button 3
{
description: 'Verify primary toggle button 3 is present',
action: async () =>
{ const expectedIcon = await driver.wait(until.elementLocated(By.css('#k425604100 .switch-primary')), 5000).catch(() => false);
if (!expectedIcon) {
throw new Error('Tagged Concept "Primary" toggle button 3 icon not found');
}
console.log('Passed: Tagged Concept Primary toggle button 3 icon present');
}
},
//Find Concepts title text
{
description: 'Validate Find Concepts title text',