diff --git a/alignConceptsPageResults.xlsx b/alignConceptsPageResults.xlsx index 30a23d8..8761f43 100644 Binary files a/alignConceptsPageResults.xlsx and b/alignConceptsPageResults.xlsx differ diff --git a/tests/ExACT_alignConceptsPage.js b/tests/ExACT_alignConceptsPage.js index 2c0ee15..a32fe99 100644 --- a/tests/ExACT_alignConceptsPage.js +++ b/tests/ExACT_alignConceptsPage.js @@ -416,11 +416,34 @@ const steps = [ { description: 'Validate Language Arts concepts label', action: async () => { - const elementText = await driver.findElement(By.css('.concept-item:nth-child(1) > a')).getText(); - if (elementText !== 'Language Arts') { - throw new Error(`Expected: "Language Arts"; Actual: "${elementText}"`); + try { + const element = await driver.findElement(By.css('.concept-item:nth-child(1) > a')); + + //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'; + const trimmedFullText = fullText.trim(); + const firstLine = trimmedFullText.split('\n')[0].trim(); + + //Try multiple matching strategies + if (firstLine.includes(expectedText)) { + console.log(`Passed: "${expectedText}" text found in first line`); + } else if (trimmedFullText.includes(expectedText)) { + console.log(`Passed: "${expectedText}" text found 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: Language Arts concepts label matched as expected'); } }, @@ -464,11 +487,34 @@ const steps = [ { description: 'Validate Mathematics concepts label', action: async () => { - const elementText = await driver.findElement(By.css('.concept-item:nth-child(2) > a')).getText(); - if (elementText !== 'Mathematics') { - throw new Error(`Expected: "Mathematics"; Actual: "${elementText}"`); + try { + const element = await driver.findElement(By.css('.concept-item:nth-child(2) > a')); + + //Get different versions of the text for debugging + const fullText = await element.getText(); + + //Check for the expected text in different ways + const expectedText = 'Mathematics'; + const trimmedFullText = fullText.trim(); + const firstLine = trimmedFullText.split('\n')[0].trim(); + + //Try multiple matching strategies + if (firstLine.includes(expectedText)) { + console.log(`Passed: "${expectedText}" text found in first line`); + } else if (trimmedFullText.includes(expectedText)) { + console.log(`Passed: "${expectedText}" text found 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: Mathematics concepts label matched as expected'); } }, @@ -512,11 +558,34 @@ const steps = [ { description: 'Validate Science concepts label', action: async () => { - const elementText = await driver.findElement(By.css('.concept-item:nth-child(3) > a')).getText(); - if (elementText !== 'Science') { - throw new Error(`Expected: "Science"; Actual: "${elementText}"`); + try { + const element = await driver.findElement(By.css('.concept-item:nth-child(3) > a')); + + //Get different versions of the text for debugging + const fullText = await element.getText(); + + //Check for the expected text in different ways + const expectedText = 'Science'; + const trimmedFullText = fullText.trim(); + const firstLine = trimmedFullText.split('\n')[0].trim(); + + //Try multiple matching strategies + if (firstLine.includes(expectedText)) { + console.log(`Passed: "${expectedText}" text found in first line`); + } else if (trimmedFullText.includes(expectedText)) { + console.log(`Passed: "${expectedText}" text found 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: Science concepts label matched as expected'); } }, @@ -560,11 +629,34 @@ const steps = [ { description: 'Validate Social Studies concepts label', action: async () => { - const elementText = await driver.findElement(By.css('.concept-item:nth-child(4) > a')).getText(); - if (elementText !== 'Social Studies') { - throw new Error(`Expected: "Social Studies"; Actual: "${elementText}"`); + try { + const element = await driver.findElement(By.css('.concept-item:nth-child(4) > a')); + + //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'; + const trimmedFullText = fullText.trim(); + const firstLine = trimmedFullText.split('\n')[0].trim(); + + //Try multiple matching strategies + if (firstLine.includes(expectedText)) { + console.log(`Passed: "${expectedText}" text found in first line`); + } else if (trimmedFullText.includes(expectedText)) { + console.log(`Passed: "${expectedText}" text found 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: Social Studies concepts label matched as expected'); } }, @@ -608,11 +700,34 @@ const steps = [ { description: 'Validate World Languages concepts label', action: async () => { - const elementText = await driver.findElement(By.css('.concept-item:nth-child(5) > a')).getText(); - if (elementText !== 'World Languages') { - throw new Error(`Expected: "World Languages"; Actual: "${elementText}"`); + try { + const element = await driver.findElement(By.css('.concept-item:nth-child(5) > a')); + + //Get different versions of the text for debugging + const fullText = await element.getText(); + + //Check for the expected text in different ways + const expectedText = 'World Languages'; + const trimmedFullText = fullText.trim(); + const firstLine = trimmedFullText.split('\n')[0].trim(); + + //Try multiple matching strategies + if (firstLine.includes(expectedText)) { + console.log(`Passed: "${expectedText}" text found in first line`); + } else if (trimmedFullText.includes(expectedText)) { + console.log(`Passed: "${expectedText}" text found 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: World Languages concepts label matched as expected'); } }, @@ -852,11 +967,34 @@ const steps = [ { description: 'Validate Algebra label', action: async () => { - const elementText = await driver.findElement(By.css('.list-group-item:nth-child(1) > .clickable')).getText(); - if (elementText !== 'Algebra') { - throw new Error(`Expected: "Algebra"; Actual: "${elementText}"`); + try { + const element = await driver.findElement(By.css('.list-group-item:nth-child(1) > .clickable')); + + //Get different versions of the text for debugging + const fullText = await element.getText(); + + //Check for the expected text in different ways + const expectedText = 'Algebra'; + const trimmedFullText = fullText.trim(); + const firstLine = trimmedFullText.split('\n')[0].trim(); + + //Try multiple matching strategies + if (firstLine.includes(expectedText)) { + console.log(`Passed: "${expectedText}" text found in first line`); + } else if (trimmedFullText.includes(expectedText)) { + console.log(`Passed: "${expectedText}" text found 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: Algebra label matched as expected'); } }, @@ -1020,11 +1158,34 @@ const steps = [ { description: 'Validate General Mathematics label', action: async () => { - const elementText = await driver.findElement(By.css('.list-group-item:nth-child(4) > .clickable')).getText(); - if (elementText !== 'General Mathematics') { - throw new Error(`Expected: "General Mathematics"; Actual: "${elementText}"`); + try { + const element = await driver.findElement(By.css('.list-group-item:nth-child(4) > .clickable')); + + //Get different versions of the text for debugging + const fullText = await element.getText(); + + //Check for the expected text in different ways + const expectedText = 'General Mathematics'; + const trimmedFullText = fullText.trim(); + const firstLine = trimmedFullText.split('\n')[0].trim(); + + //Try multiple matching strategies + if (firstLine.includes(expectedText)) { + console.log(`Passed: "${expectedText}" text found in first line`); + } else if (trimmedFullText.includes(expectedText)) { + console.log(`Passed: "${expectedText}" text found 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: General Mathematics label matched as expected'); } }, @@ -1128,11 +1289,34 @@ const steps = [ { description: 'Validate Math Process Standards label', action: async () => { - const elementText = await driver.findElement(By.css('.list-group-item:nth-child(6) > .clickable')).getText(); - if (elementText !== 'Math Process Standards') { - throw new Error(`Expected: "Math Process Standards"; Actual: "${elementText}"`); + try { + const element = await driver.findElement(By.css('.list-group-item:nth-child(6) > .clickable')); + + //Get different versions of the text for debugging + const fullText = await element.getText(); + + //Check for the expected text in different ways + const expectedText = 'Math Process Standards'; + const trimmedFullText = fullText.trim(); + const firstLine = trimmedFullText.split('\n')[0].trim(); + + //Try multiple matching strategies + if (firstLine.includes(expectedText)) { + console.log(`Passed: "${expectedText}" text found in first line`); + } else if (trimmedFullText.includes(expectedText)) { + console.log(`Passed: "${expectedText}" text found 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: Math Process Standards label matched as expected'); } }, @@ -1296,11 +1480,34 @@ const steps = [ { description: 'Validate Process Standards label', action: async () => { - const elementText = await driver.findElement(By.css('.list-group-item:nth-child(9) > .clickable')).getText(); - if (elementText !== 'Process Standards') { - throw new Error(`Expected: "Process Standards"; Actual: "${elementText}"`); + try { + const element = await driver.findElement(By.css('.list-group-item:nth-child(9) > .clickable')); + + //Get different versions of the text for debugging + const fullText = await element.getText(); + + //Check for the expected text in different ways + const expectedText = 'Process Standards'; + const trimmedFullText = fullText.trim(); + const firstLine = trimmedFullText.split('\n')[0].trim(); + + //Try multiple matching strategies + if (firstLine.includes(expectedText)) { + console.log(`Passed: "${expectedText}" text found in first line`); + } else if (trimmedFullText.includes(expectedText)) { + console.log(`Passed: "${expectedText}" text found 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: Process Standards label matched as expected'); } }, @@ -1672,11 +1879,34 @@ const steps = [ { description: 'Validate Concept - Change of Parameter-Constant-Coefficient label', action: async () => { - const elementText = await driver.findElement(By.css('.list-group-item:nth-child(1) > .clickable')).getText(); - if (elementText !== 'Change of Parameter/Constant/Coefficient') { - throw new Error(`Expected: Concept - "Change of Parameter/Constant/Coefficient"; Actual: "${elementText}"`); + try { + const element = await driver.findElement(By.css('.list-group-item:nth-child(1) > .clickable')); + + //Get different versions of the text for debugging + const fullText = await element.getText(); + + //Check for the expected text in different ways + const expectedText = 'Change of Parameter/Constant/Coefficient'; + const trimmedFullText = fullText.trim(); + const firstLine = trimmedFullText.split('\n')[0].trim(); + + //Try multiple matching strategies + if (firstLine.includes(expectedText)) { + console.log(`Passed: "${expectedText}" text found in first line`); + } else if (trimmedFullText.includes(expectedText)) { + console.log(`Passed: "${expectedText}" text found 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: Concept - Change of Parameter/Constant/Coefficient label matched as expected'); } }, @@ -1720,11 +1950,34 @@ const steps = [ { description: 'Validate Concept - Equations 1 label', action: async () => { - const elementText = await driver.findElement(By.css('.list-group-item:nth-child(2) > .clickable')).getText(); - if (elementText !== 'Equations/Inequalities & Functions') { - throw new Error(`Expected: Concept - "Equations/Inequalities & Functions"; Actual: "${elementText}"`); + try { + const element = await driver.findElement(By.css('.list-group-item:nth-child(2) > .clickable')); + + //Get different versions of the text for debugging + const fullText = await element.getText(); + + //Check for the expected text in different ways + const expectedText = 'Equations/Inequalities & Functions'; + const trimmedFullText = fullText.trim(); + const firstLine = trimmedFullText.split('\n')[0].trim(); + + //Try multiple matching strategies + if (firstLine.includes(expectedText)) { + console.log(`Passed: "${expectedText}" text found in first line`); + } else if (trimmedFullText.includes(expectedText)) { + console.log(`Passed: "${expectedText}" text found 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: Concept - Equations/Inequalities & Functions label matched as expected'); } }, @@ -1768,11 +2021,34 @@ const steps = [ { description: 'Validate Concept - Equations-Inequalities & Functions-Solving label', action: async () => { - const elementText = await driver.findElement(By.css('.list-group-item:nth-child(3) > .clickable')).getText(); - if (elementText !== 'Equations/Inequalities & Functions/Solving') { - throw new Error(`Expected: Concept - "Equations/Inequalities & Functions/Solving"; Actual: "${elementText}"`); + try { + const element = await driver.findElement(By.css('.list-group-item:nth-child(3) > .clickable')); + + //Get different versions of the text for debugging + const fullText = await element.getText(); + + //Check for the expected text in different ways + const expectedText = 'Equations/Inequalities & Functions/Solving'; + const trimmedFullText = fullText.trim(); + const firstLine = trimmedFullText.split('\n')[0].trim(); + + //Try multiple matching strategies + if (firstLine.includes(expectedText)) { + console.log(`Passed: "${expectedText}" text found in first line`); + } else if (trimmedFullText.includes(expectedText)) { + console.log(`Passed: "${expectedText}" text found 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: Concept - Equations/Inequalities & Functions/Solving label matched as expected'); } }, @@ -1816,11 +2092,34 @@ const steps = [ { description: 'Validate Concept - Inequalities label', action: async () => { - const elementText = await driver.findElement(By.css('.list-group-item:nth-child(4) > .clickable')).getText(); - if (elementText !== 'Inequalities') { - throw new Error(`Expected: Concept - "Inequalities"; Actual: "${elementText}"`); + try { + const element = await driver.findElement(By.css('.list-group-item:nth-child(4) > .clickable')); + + //Get different versions of the text for debugging + const fullText = await element.getText(); + + //Check for the expected text in different ways + const expectedText = 'Inequalities'; + const trimmedFullText = fullText.trim(); + const firstLine = trimmedFullText.split('\n')[0].trim(); + + //Try multiple matching strategies + if (firstLine.includes(expectedText)) { + console.log(`Passed: "${expectedText}" text found in first line`); + } else if (trimmedFullText.includes(expectedText)) { + console.log(`Passed: "${expectedText}" text found 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: Concept - Inequalities label matched as expected'); } }, @@ -1872,17 +2171,17 @@ const steps = [ } }, - //Systems of Inequalities font size - { - description: 'Validate Systems of Inequalities font size', - action: async () => { - const elementText = await driver.findElement(By.linkText('Systems of Inequalities')).getCssValue('font-size'); - if (elementText !== '14.3px') { - throw new Error(`Expected: Systems of Inequalities font size to be "14.3px"; Actual: "${elementText}"`); - } - console.log('Passed: Systems of Inequalities font size matched as expected'); + //Systems of Inequalities font size + { + description: 'Validate Systems of Inequalities font size', + action: async () => { + const elementText = await driver.findElement(By.linkText('Systems of Inequalities')).getCssValue('font-size'); + if (elementText !== '14.3px') { + throw new Error(`Expected: Systems of Inequalities font size to be "14.3px"; Actual: "${elementText}"`); } - }, + console.log('Passed: Systems of Inequalities font size matched as expected'); + } + }, //NEXT ACTION - Click Inequalities label { description: 'Click Inequalities label', action: async () => await driver.findElement(By.css('.list-group-item:nth-child(4) > .clickable')).click() }, @@ -2106,13 +2405,36 @@ const steps = [ //Writing label { - description: 'Validate Inequalities label', + description: 'Validate Writing label', action: async () => { - const elementText = await driver.findElement(By.css('.clickable')).getText(); - if (elementText !== 'Writing') { - throw new Error(`Expected: "Writing" label; Actual: "${elementText}"`); + try { + const element = await driver.findElement(By.css('.clickable')); + + //Get different versions of the text for debugging + const fullText = await element.getText(); + + //Check for the expected text in different ways + const expectedText = 'Writing'; + const trimmedFullText = fullText.trim(); + const firstLine = trimmedFullText.split('\n')[0].trim(); + + //Try multiple matching strategies + if (firstLine.includes(expectedText)) { + console.log(`Passed: "${expectedText}" text found in first line`); + } else if (trimmedFullText.includes(expectedText)) { + console.log(`Passed: "${expectedText}" text found 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: Writing label matched as expected'); } }, @@ -2680,29 +3002,47 @@ const steps = [ { description: 'Validate Applications of Linear Systems description text', action: async () => { - const elementText = await driver.findElement(By.css('.card:nth-child(6) .lo-descr')).getText(); - if (elementText !== 'Unit: Systems of Equations and Inequalities') { - throw new Error(`Expected: "Unit: Systems of Equations and Inequalities" text; Actual: "${elementText}"`); + try { + const element = await driver.findElement(By.css('.card:nth-child(6) .lo-descr')); + + //Get different versions of the text for debugging + const fullText = await element.getText(); + + //Try XPath approach + let xpathText; + try { + xpathText = await driver.findElement( + By.xpath('//*[contains(@class, "card")][6]//*[contains(@class, "lo-descr")]/text()[normalize-space()]') + ).getText(); + } catch (e) { + xpathText = "XPath method failed: " + e.message; + } + + //Check for the expected text in different ways + const expectedText = 'Unit: Systems of Equations and Inequalities'; + const trimmedFullText = fullText.trim(); + const firstLine = trimmedFullText.split('\n')[0].trim(); + + //Try multiple matching strategies + if (firstLine.includes(expectedText)) { + console.log(`Passed: "${expectedText}" text found in first line`); + } else if (trimmedFullText.includes(expectedText)) { + console.log(`Passed: "${expectedText}" text found within full text`); + } else if (xpathText.includes(expectedText)) { + console.log(`Passed: "${expectedText}" text found via XPath method`); + } else { + throw new Error( + `Text validation failed.\nExpected: "${expectedText}"\n` + + `Full text: "${fullText}"\n` + + `First line: "${firstLine}"\n` + + `XPath result: "${xpathText}"` + ); + } + + } catch (error) { + console.error('Detailed error during validation:', error); + throw error; //Re-throw after logging } - console.log('Passed: Unit: Systems of Equations and Inequalities text matched as expected'); - } - }, - - - - - { - description: 'Validate Applications of Linear Systems description text', - action: async () => { - const elementText = await driver.findElement(By.css('.card:nth-child(6) .lo-descr')).getText(); - const expectedText = 'Unit: Systems of Equations and Inequalities'; - - // Trim the element text to avoid mismatch due to extra spaces or appended text - if (elementText.trim() !== expectedText) { - throw new Error(`Expected: "${expectedText}" text; Actual: "${elementText}"`); - } - - console.log('Passed: Unit: Systems of Equations and Inequalities text matched as expected'); } }, @@ -2718,8 +3058,7 @@ const steps = [ } }, - - + //Content Set label { description: 'Validate Applications of Linear Systems content set label', action: async () => { @@ -2735,7 +3074,6 @@ const steps = [ } }, - //Applications of Linear Systems alignment icon { description: 'Verify Applications of Linear Systems alignment icon is present', @@ -2884,11 +3222,34 @@ const steps = [ { description: 'Validate Direct Variation description text', action: async () => { - const elementText = await driver.findElement(By.css('.card:nth-child(7) .lo-descr')).getText(); - if (elementText !== 'Unit: Linear Functions') { - throw new Error(`Expected: "Unit: Linear Functions" text; Actual: "${elementText}"`); + try { + const element = await driver.findElement(By.css('.card:nth-child(7) .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 = 'Unit: Linear Functions'; + const trimmedFullText = fullText.trim(); + const firstLine = trimmedFullText.split('\n')[0].trim(); + + //Try multiple matching strategies + if (firstLine.includes(expectedText)) { + console.log(`Passed: "${expectedText}" text found in first line`); + } else if (trimmedFullText.includes(expectedText)) { + console.log(`Passed: "${expectedText}" text found 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: Unit: Linear Functions text matched as expected'); } },