From 7c399ee06d1c3bf551729b3b7b26d0e6051555ed Mon Sep 17 00:00:00 2001 From: jhuerta Date: Wed, 7 May 2025 15:14:53 -0700 Subject: [PATCH] Added LogOut and updated test results --- tests/ExACT_alignConceptsPage.js | 59 +++++++++++- tests/ExACT_alignContentPage.js | 106 +++++++++++++-------- tests/ExACT_alignStandardsPage.js | 29 ++++-- tests/ExACT_contentPage.js | 125 ++++++++++++++++++++----- tests/ExACT_dashboardMyContent.js | 125 ++++++++++++++----------- tests/ExACT_editItem.js | 29 ++++-- tests/ExACT_editItemAddConcept.js | 3 +- tests/ExACT_frameworkManagementPage.js | 2 +- tests/ExACT_login.js | 66 ++++++++----- 9 files changed, 386 insertions(+), 158 deletions(-) diff --git a/tests/ExACT_alignConceptsPage.js b/tests/ExACT_alignConceptsPage.js index b7160f0..ab617ea 100644 --- a/tests/ExACT_alignConceptsPage.js +++ b/tests/ExACT_alignConceptsPage.js @@ -2688,6 +2688,24 @@ 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(); + 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'); + } + }, + //Applications of Linear Systems content set label { description: 'Validate Applications of Linear Systems content set label', @@ -2700,6 +2718,24 @@ const steps = [ } }, + + + { + description: 'Validate Applications of Linear Systems content set label', + action: async () => { + const elementText = await driver.findElement(By.css('.card:nth-child(6) em')).getText(); + const expectedText = 'Content Set:'; + + // Trim the element text to avoid mismatch due to extra spaces or appended text + if (elementText.trim() !== expectedText) { + throw new Error(`Expected: Applications of Linear Systems "Content Set:" label; Actual: "${elementText}"`); + } + + console.log('Passed: Applications of Linear Systems Content Set label matched as expected'); + } + }, + + //Applications of Linear Systems alignment icon { description: 'Verify Applications of Linear Systems alignment icon is present', @@ -2988,6 +3024,20 @@ const steps = [ } }, + //LOG OUT + //NEXT ACTION - Log out + { description: 'Click Username dropdown', action: async () => await driver.findElement(By.css('#navbarDropdown > span')).click() }, + { description: 'Wait for action to complete', action: async () => await driver.sleep(2000) }, + { description: 'Click Log Out link', action: async () => await driver.findElement(By.linkText('Log Out')).click() }, + { description: 'Wait for action to complete', action: async () => await driver.sleep(2000) }, + + //Wait for login screen to load + { + description: 'Wait for log out process to complete', + action: async () => { + return await driver.wait(until.elementLocated(By.css('.login')), 10000).catch(() => false); + } + }, ]; const logStep = (worksheet, stepDescription, status, stepIndex, timestamp, screenshotPath) => { @@ -3035,6 +3085,8 @@ try { // Log test start time worksheet = logStep(worksheet, 'Test Start', 'Started', '', startTime, ''); + let allStepsPassed = true; + for (const step of steps) { const stepIndex = steps.indexOf(step) + 1; const timestamp = new Date().toISOString(); @@ -3048,13 +3100,14 @@ try { worksheet = logStep(worksheet, step.description, 'Failed', stepIndex, timestamp, screenshotPath); console.error(`Step ${stepIndex} FAILED: ${error.message}`); testStatus = 'Failed'; + allStepsPassed = false; } } - //Check if login was successful - const usernameValidation = await driver.wait(until.elementLocated(By.css('#navbarDropdown > span')), 5000).catch(() => false); + //Check if log out was successful + const loginButton = await driver.wait(until.elementLocated(By.css('.login')), 5000).catch(() => false); - if (usernameValidation) { + if (loginButton && allStepsPassed) { console.log('PASSED: System logged in as expected'); testStatus = 'Passed'; } else { diff --git a/tests/ExACT_alignContentPage.js b/tests/ExACT_alignContentPage.js index e43aa63..373e25d 100644 --- a/tests/ExACT_alignContentPage.js +++ b/tests/ExACT_alignContentPage.js @@ -4,7 +4,7 @@ import XLSX from 'xlsx'; import path from 'path'; const ExACT_alignContentPage = (req, res) => { - res.send('

ExACT Automated Test Script - Align Content Page: Initiated

'); + res.send('

ExACT Automated Test Script: Align Content Page(ExACT_alignContentPage); Initiated

'); (async function example() { let driver = await new Builder().forBrowser('chrome').build(); let testStatus = 'Failed'; @@ -639,15 +639,15 @@ const steps = [ } }, - //Subject: Mathematics (2011) label + //Subject: Mathematics (2012) label { - description: 'Validate Subject Mathematics (2011) label', + description: 'Validate Subject Mathematics (2012) label', action: async () => { const elementText = await driver.findElement(By.css('.show > li:nth-child(3) .checkbox')).getText(); - if (elementText !== 'Mathematics (2011)') { - throw new Error(`Expected: Subject: "Mathematics (2011)" checkbox label; Actual: "${elementText}"`); + if (elementText !== 'Mathematics (2012)') { + throw new Error(`Expected: Subject: "Mathematics (2012)" checkbox label; Actual: "${elementText}"`); } - console.log('Passed: Subject Mathematics (2011) checkbox label matched as expected'); + console.log('Passed: Subject Mathematics (2012) checkbox label matched as expected'); } }, @@ -663,15 +663,15 @@ const steps = [ } }, - //Subject: Science (1064) label + //Subject: Science (1066) label { - description: 'Validate Subject Science (1064) label', + description: 'Validate Subject Science (1066) label', action: async () => { const elementText = await driver.findElement(By.css('.show > li:nth-child(4) .checkbox')).getText(); - if (elementText !== 'Science (1064)') { - throw new Error(`Expected: Subject: "Science (2384)" checkbox label; Actual: "${elementText}"`); + if (elementText !== 'Science (1066)') { + throw new Error(`Expected: Subject: "Science (1066)" checkbox label; Actual: "${elementText}"`); } - console.log('Passed: Subject Science (1064) checkbox label matched as expected'); + console.log('Passed: Subject Science (1066) checkbox label matched as expected'); } }, @@ -687,15 +687,15 @@ const steps = [ } }, - //Subject: Language Arts (414) label + //Subject: Language Arts (416) label { - description: 'Validate Subject Language Arts (414) label', + description: 'Validate Subject Language Arts (416) label', action: async () => { const elementText = await driver.findElement(By.css('.show > li:nth-child(5) .checkbox')).getText(); - if (elementText !== 'Language Arts (414)') { - throw new Error(`Expected: Subject: "Language Arts (414)" checkbox label; Actual: "${elementText}"`); + if (elementText !== 'Language Arts (416)') { + throw new Error(`Expected: Subject: "Language Arts (416)" checkbox label; Actual: "${elementText}"`); } - console.log('Passed: Subject Language Arts (414) checkbox label matched as expected'); + console.log('Passed: Subject Language Arts (416) checkbox label matched as expected'); } }, @@ -711,15 +711,15 @@ const steps = [ } }, - //Subject: Social Studies (75) label + //Subject: Social Studies (77) label { - description: 'Validate Subject Social Studies (75) label', + description: 'Validate Subject Social Studies (77) label', action: async () => { const elementText = await driver.findElement(By.css('.show > li:nth-child(6) .checkbox')).getText(); - if (elementText !== 'Social Studies (75)') { - throw new Error(`Expected: Subject: "Social Studies (75)" checkbox label; Actual: "${elementText}"`); + if (elementText !== 'Social Studies (77)') { + throw new Error(`Expected: Subject: "Social Studies (77)" checkbox label; Actual: "${elementText}"`); } - console.log('Passed: Subject Social Studies (75) checkbox label matched as expected'); + console.log('Passed: Subject Social Studies (77) checkbox label matched as expected'); } }, @@ -803,15 +803,15 @@ const steps = [ } }, - //Alignment Status:Not Aligned (3260) label + //Alignment Status:Not Aligned (3261) label { - description: 'Validate Alignment Status Not Aligned (3260) label', + description: 'Validate Alignment Status Not Aligned (3261) label', action: async () => { const elementText = await driver.findElement(By.css('.show > li:nth-child(3) .checkbox')).getText(); - if (elementText !== 'Not Aligned (3260)') { - throw new Error(`Expected: Alignment Status: "Not Aligned (3260)" checkbox label; Actual: "${elementText}"`); + if (elementText !== 'Not Aligned (3261)') { + throw new Error(`Expected: Alignment Status: "Not Aligned (3261)" checkbox label; Actual: "${elementText}"`); } - console.log('Passed: Alignment Status Not Aligned (3260) checkbox label matched as expected'); + console.log('Passed: Alignment Status Not Aligned (3261) checkbox label matched as expected'); } }, @@ -851,15 +851,15 @@ const steps = [ } }, - //Alignment Status: Pending (16) label + //Alignment Status: Pending (13) label { - description: 'Validate Alignment Status Pending (16) label', + description: 'Validate Alignment Status Pending (13) label', action: async () => { const elementText = await driver.findElement(By.css('.show > li:nth-child(5) .checkbox')).getText(); - if (elementText !== 'Pending (16)') { - throw new Error(`Expected: Alignment Status: "Pending (16)" checkbox label; Actual: "${elementText}"`); + if (elementText !== 'Pending (13)') { + throw new Error(`Expected: Alignment Status: "Pending (13)" checkbox label; Actual: "${elementText}"`); } - console.log('Passed: Alignment Status Pending (16) checkbox label matched as expected'); + console.log('Passed: Alignment Status Pending (13) checkbox label matched as expected'); } }, @@ -875,15 +875,15 @@ const steps = [ } }, - //Alignment Status: Aligned (6) label + //Alignment Status: Aligned (8) label { - description: 'Validate Alignment Status Aligned (6) label', + description: 'Validate Alignment Status Aligned (8) label', action: async () => { const elementText = await driver.findElement(By.css('.show > li:nth-child(6) .checkbox')).getText(); - if (elementText !== 'Aligned (6)') { - throw new Error(`Expected: Alignment Status: "Aligned (6)" checkbox label; Actual: "${elementText}"`); + if (elementText !== 'Aligned (8)') { + throw new Error(`Expected: Alignment Status: "Aligned (8)" checkbox label; Actual: "${elementText}"`); } - console.log('Passed: Alignment Status Aligned (6) checkbox label matched as expected'); + console.log('Passed: Alignment Status Aligned (8) checkbox label matched as expected'); } }, @@ -1966,6 +1966,27 @@ const steps = [ } }, + + + + + + + + //LOG OUT + //NEXT ACTION - Log out + { description: 'Click Username dropdown', action: async () => await driver.findElement(By.css('#navbarDropdown > span')).click() }, + { description: 'Wait for action to complete', action: async () => await driver.sleep(2000) }, + { description: 'Click Log Out link', action: async () => await driver.findElement(By.linkText('Log Out')).click() }, + { description: 'Wait for action to complete', action: async () => await driver.sleep(2000) }, + + //Wait for login screen to load + { + description: 'Wait for log out process to complete', + action: async () => { + return await driver.wait(until.elementLocated(By.css('.login')), 10000).catch(() => false); + } + }, ]; const logStep = (worksheet, stepDescription, status, stepIndex, timestamp, screenshotPath) => { @@ -2013,6 +2034,8 @@ try { // Log test start time worksheet = logStep(worksheet, 'Test Start', 'Started', '', startTime, ''); + let allStepsPassed = true; + for (const step of steps) { const stepIndex = steps.indexOf(step) + 1; const timestamp = new Date().toISOString(); @@ -2026,17 +2049,18 @@ try { worksheet = logStep(worksheet, step.description, 'Failed', stepIndex, timestamp, screenshotPath); console.error(`Step ${stepIndex} FAILED: ${error.message}`); testStatus = 'Failed'; + allStepsPassed = false; } } - //Check if login was successful - const usernameValidation = await driver.wait(until.elementLocated(By.css('#navbarDropdown > span')), 5000).catch(() => false); + //Check if log out was successful + const loginButton = await driver.wait(until.elementLocated(By.css('.login')), 5000).catch(() => false); - if (usernameValidation) { - console.log('PASSED: System logged in as expected'); + if (loginButton && allStepsPassed) { + console.log('PASSED: Align - Edit Content and Align Concept(ExACT_alignContentPage); All test steps completed successfully'); testStatus = 'Passed'; } else { - console.log('FAILED: Unable to log in'); + console.log('FAILED: Align - Edit Content and Align Concept(ExACT_alignContentPage); One or more test steps failed'); testStatus = 'Failed'; } diff --git a/tests/ExACT_alignStandardsPage.js b/tests/ExACT_alignStandardsPage.js index 80037af..aa2fcb4 100644 --- a/tests/ExACT_alignStandardsPage.js +++ b/tests/ExACT_alignStandardsPage.js @@ -4,7 +4,7 @@ import XLSX from 'xlsx'; import path from 'path'; const ExACT_alignStandardsPage = (req, res) => { - res.send('

ExACT Automated Test Script - Align Standards Page: Initiated

'); + res.send('

ExACT Automated Test Script - Align Standards Page(ExACT_alignStandardsPage): Initiated

'); (async function example() { let driver = await new Builder().forBrowser('chrome').build(); let testStatus = 'Failed'; @@ -5361,6 +5361,20 @@ const steps = [ { description: 'Click Add Direct Alighment DIV - Done button', action: async () => await driver.findElement(By.css('.modal-footer > .btn')).click() }, { description: 'Browser sleep', action: async () => await driver.sleep(2000) }, + //LOG OUT + //NEXT ACTION - Log out + { description: 'Click Username dropdown', action: async () => await driver.findElement(By.css('#navbarDropdown > span')).click() }, + { description: 'Wait for action to complete', action: async () => await driver.sleep(2000) }, + { description: 'Click Log Out link', action: async () => await driver.findElement(By.linkText('Log Out')).click() }, + { description: 'Wait for action to complete', action: async () => await driver.sleep(2000) }, + + //Wait for login screen to load + { + description: 'Wait for log out process to complete', + action: async () => { + return await driver.wait(until.elementLocated(By.css('.login')), 10000).catch(() => false); + } + }, ]; const logStep = (worksheet, stepDescription, status, stepIndex, timestamp, screenshotPath) => { @@ -5408,6 +5422,8 @@ try { // Log test start time worksheet = logStep(worksheet, 'Test Start', 'Started', '', startTime, ''); + let allStepsPassed = true; + for (const step of steps) { const stepIndex = steps.indexOf(step) + 1; const timestamp = new Date().toISOString(); @@ -5421,17 +5437,18 @@ try { worksheet = logStep(worksheet, step.description, 'Failed', stepIndex, timestamp, screenshotPath); console.error(`Step ${stepIndex} FAILED: ${error.message}`); testStatus = 'Failed'; + allStepsPassed = false; } } - //Check if login was successful - const usernameValidation = await driver.wait(until.elementLocated(By.css('#navbarDropdown > span')), 5000).catch(() => false); + //Check if log out was successful + const loginButton = await driver.wait(until.elementLocated(By.css('.login')), 5000).catch(() => false); - if (usernameValidation) { - console.log('PASSED: System logged in as expected'); + if (loginButton && allStepsPassed) { + console.log('PASSED: Align Standards Page(ExACT_alignStandardsPage); All test steps completed successfully'); testStatus = 'Passed'; } else { - console.log('FAILED: Unable to log in'); + console.log('FAILED: Align Standards Page(ExACT_alignStandardsPage); One or more test steps failed'); testStatus = 'Failed'; } diff --git a/tests/ExACT_contentPage.js b/tests/ExACT_contentPage.js index 55534fd..99814a5 100644 --- a/tests/ExACT_contentPage.js +++ b/tests/ExACT_contentPage.js @@ -4,7 +4,7 @@ import XLSX from 'xlsx'; import path from 'path'; const ExACT_contentPage = (req, res) => { - res.send('

ExACT Automated Test Script - Content Page: Initiated

'); + res.send('

ExACT Automated Test Script - Content Page(ExACT_contentPage): Initiated

'); (async function example() { let driver = await new Builder().forBrowser('chrome').build(); let testStatus = 'Failed'; @@ -586,11 +586,59 @@ const steps = [ } }, - //Social and Emotional Learning checkbox + //Language Arts checkbox (added?) + { + description: 'Verify Language Arts checkbox icon is present', + action: async () => + { const expectedIcon = await driver.wait(until.elementLocated(By.css('#metasubjectsLanguage\\ Arts')), 5000).catch(() => false); + if (!expectedIcon) { + throw new Error('Expected: Language Arts checkbox icon not found'); + } + console.log('Passed: Language Arts checkbox icon present'); + } + }, + + //Language Arts label (added?) + { + description: 'Validate Language Arts label', + action: async () => { + const elementText = await driver.findElement(By.css('.form-group:nth-child(6) > label:nth-child(10)')).getText(); + if (elementText !== 'Language Arts') { + throw new Error(`Expected: "Language Arts"; Actual: "${elementText}"`); + } + console.log('Passed: Language Arts label matched as expected'); + } + }, + + //Social Studies checkbox (added?) + { + description: 'Verify Social Studies checkbox icon is present', + action: async () => + { const expectedIcon = await driver.wait(until.elementLocated(By.css('#metasubjectsSocial\\ Studies')), 5000).catch(() => false); + if (!expectedIcon) { + throw new Error('Expected: Social Studies checkbox icon not found'); + } + console.log('Passed: Social Studies checkbox icon present'); + } + }, + + //Social Studies label (added?) + { + description: 'Validate Social Studies label', + action: async () => { + const elementText = await driver.findElement(By.css('.form-group:nth-child(6) > label:nth-child(13)')).getText(); + if (elementText !== 'Social Studies') { + throw new Error(`Expected: "Social Studies"; Actual: "${elementText}"`); + } + console.log('Passed: Social Studies label matched as expected'); + } + }, + + //Social and Emotional Learning checkbox (pushed down) { description: 'Verify Social and Emotional Learning checkbox icon is present', action: async () => - { const expectedIcon = await driver.wait(until.elementLocated(By.id('metasubjectsSocial and Emotional Learning')), 5000).catch(() => false); + { const expectedIcon = await driver.wait(until.elementLocated(By.css('#metasubjectsSocial\\ and\\ Emotional\\ Learning')), 5000).catch(() => false); if (!expectedIcon) { throw new Error('Expected: Social and Emotional Learning checkbox icon not found'); } @@ -598,11 +646,11 @@ const steps = [ } }, - //Social and Emotional Learning label + //Social and Emotional Learning label (pushed down) { description: 'Validate Social and Emotional Learning label', action: async () => { - const elementText = await driver.findElement(By.css('.form-group:nth-child(6) > label:nth-child(10)')).getText(); + const elementText = await driver.findElement(By.css('.form-group:nth-child(6) > label:nth-child(16)')).getText(); if (elementText !== 'Social and Emotional Learning') { throw new Error(`Expected: "Social and Emotional Learning"; Actual: "${elementText}"`); } @@ -2048,15 +2096,15 @@ const steps = [ } }, - //Filtered Content 2 alignment label + //Filtered Content 2 ECS Alignment (reset) label (previously Not Aligned) { - description: 'Validate Filtered Content 2 Not Aligned label', + description: 'Validate Filtered Content 2 ECS Alignment (reset) label', action: async () => { const elementText = await driver.findElement(By.css('#alignstatuslink873578655 > .display-alignment')).getText(); - if (elementText !== 'Not Aligned') { - throw new Error(`Expected: Filtered Content 2 Not Aligned label did not match; Actual: "${elementText}"`); + if (elementText !== 'ECS Alignment (reset)') { + throw new Error(`Expected: Filtered Content 2 "ECS Alignment (reset)" label did not match; Actual: "${elementText}"`); } - console.log('Passed: Filtered Content 2 Not Aligned label matched as expected'); + console.log('Passed: Filtered Content 2 ECS Alignment (reset) label matched as expected'); } }, @@ -2099,7 +2147,7 @@ const steps = [ //NEXT ACTION - VIEW EDIT MODE { description: 'Click Edit View button', action: async () => await driver.findElement(By.linkText('Edit View')).click() }, - //Wait for dashboard to load - Correlation Coverages View Details button + //Wait for page to load - Correlation Coverages View Details button { description: 'Wait for Actions button to load', action: async () => { @@ -2323,15 +2371,15 @@ const steps = [ } }, - //Second content item alignment pending text + //Second content item ECS Alignment (reset) text (previously Not Aligned) { - description: 'Validate Altered Elephant Behavior alignment pending text', + description: 'Validate Altered Elephant Behavior ECS Alignment (reset) text', action: async () => { const elementText = await driver.findElement(By.css('#alignstatuslink873578655 > .display-alignment')).getText(); - if (elementText !== 'Not Aligned') { - throw new Error(`Expected: Altered Elephant Behavior "Not Aligned" text; Actual: "${elementText}"`); + if (elementText !== 'ECS Alignment (reset)') { + throw new Error(`Expected: Altered Elephant Behavior "ECS Alignment (reset)" text; Actual: "${elementText}"`); } - console.log('Passed: Altered Elephant Behavior "Not Aligned" text matched as expected'); + console.log('Passed: Altered Elephant Behavior ECS Alignment (reset) text matched as expected'); } }, @@ -2417,12 +2465,40 @@ const steps = [ action: async () => { const elementStyle = await driver.findElement(By.linkText('Delete')).getCssValue('color'); if (elementStyle !== 'rgba(220, 53, 69, 1)') { - throw new Error(`Expected: Actions Delete text color did not match; Actual: "${elementStyle}"`); + throw new Error(`Expected: ECS-2920 | Actions Delete text color did not match; Actual: "${elementStyle}"`); } - console.log('Passed: Delete text color matched as expected'); + console.log('Passed: ECS-2920 | Delete text color matched as expected'); } }, + //NEXT ACTION - Reset | ECS-2920 + { description: 'Click Actions button', action: async () => await driver.findElement(By.linkText('Actions')).click() }, + { description: 'Wait for action to complete', action: async () => await driver.sleep(2000) }, + { description: 'Click Detail View button', action: async () => await driver.findElement(By.linkText('Detail View')).click() }, + { description: 'Wait for action to complete', action: async () => await driver.sleep(2000) }, + + //Wait for page to load - Content 1 edit button + { + description: 'Wait for Content 1 edit button to load', + action: async () => { + return await driver.wait(until.elementLocated(By.css('.card:nth-child(8) .lo-title .fa')), 10000).catch(() => false); + } + }, + + //LOG OUT + //NEXT ACTION - Log out + { description: 'Click Username dropdown', action: async () => await driver.findElement(By.css('#navbarDropdown > span')).click() }, + { description: 'Wait for action to complete', action: async () => await driver.sleep(2000) }, + { description: 'Click Log Out link', action: async () => await driver.findElement(By.linkText('Log Out')).click() }, + { description: 'Wait for action to complete', action: async () => await driver.sleep(2000) }, + + //Wait for login screen to load + { + description: 'Wait for log out process to complete', + action: async () => { + return await driver.wait(until.elementLocated(By.css('.login')), 10000).catch(() => false); + } + }, ]; const logStep = (worksheet, stepDescription, status, stepIndex, timestamp, screenshotPath) => { @@ -2470,6 +2546,8 @@ try { // Log test start time worksheet = logStep(worksheet, 'Test Start', 'Started', '', startTime, ''); + let allStepsPassed = true; + for (const step of steps) { const stepIndex = steps.indexOf(step) + 1; const timestamp = new Date().toISOString(); @@ -2483,17 +2561,18 @@ try { worksheet = logStep(worksheet, step.description, 'Failed', stepIndex, timestamp, screenshotPath); console.error(`Step ${stepIndex} FAILED: ${error.message}`); testStatus = 'Failed'; + allStepsPassed = false; } } - //Check if login was successful - const usernameValidation = await driver.wait(until.elementLocated(By.css('#navbarDropdown > span')), 5000).catch(() => false); + //Check if log out was successful + const loginButton = await driver.wait(until.elementLocated(By.css('.login')), 5000).catch(() => false); - if (usernameValidation) { - console.log('PASSED: System logged in as expected'); + if (loginButton && allStepsPassed) { + console.log('PASSED: Content Page(ExACT_contentPage); All test steps completed successfully'); testStatus = 'Passed'; } else { - console.log('FAILED: Unable to log in'); + console.log('FAILED: Content Page(ExACT_contentPage); One or more test steps failed'); testStatus = 'Failed'; } diff --git a/tests/ExACT_dashboardMyContent.js b/tests/ExACT_dashboardMyContent.js index 7fadc96..3e990e3 100644 --- a/tests/ExACT_dashboardMyContent.js +++ b/tests/ExACT_dashboardMyContent.js @@ -4,7 +4,7 @@ import XLSX from 'xlsx'; import path from 'path'; const ExACT_dashboardMyContent = (req, res) => { - res.send('

ExACT Automated Test Script - Dashboard - My Content widget: Initiated

'); + res.send('

ExACT Automated Test Script - Dashboard - My Content Widget(ExACT_dashboardMyContent): Initiated

'); (async function example() { let driver = await new Builder().forBrowser('chrome').build(); let testStatus = 'Failed'; @@ -2596,62 +2596,76 @@ const steps = [ await alert.accept(); await driver.sleep(2000); } -}, + }, -//Validate confirmation message -{ - description: 'Validate confirmation message', - action: async () => { - const elementText = await driver.findElement(By.css('strong')).getText(); - if (elementText !== 'The content set was successfuly deleted') { - throw new Error(`Expected: Alert banner deleted confirmation message did not match; Actual: "${elementText}"`); + //Validate confirmation message + { + description: 'Validate confirmation message', + action: async () => { + const elementText = await driver.findElement(By.css('strong')).getText(); + if (elementText !== 'The content set was successfuly deleted') { + throw new Error(`Expected: Alert banner deleted confirmation message did not match; Actual: "${elementText}"`); + } + console.log('Passed: Alert banner deleted confirmation message displayed as expected'); } - console.log('Passed: Alert banner deleted confirmation message displayed as expected'); - } -}, + }, -//Validate confirmation message background color -green -{ - description: 'Validate confirmation message background color', - action: async () => { - const elementStyle = await driver.findElement(By.css('#statalert')).getCssValue('background-color'); - if (elementStyle !== 'rgba(40, 167, 69, 1)') { - throw new Error(`Expected: Alert banner background color did not match; Actual: "${elementStyle}"`); + //Validate confirmation message background color -green + { + description: 'Validate confirmation message background color', + action: async () => { + const elementStyle = await driver.findElement(By.css('#statalert')).getCssValue('background-color'); + if (elementStyle !== 'rgba(40, 167, 69, 1)') { + throw new Error(`Expected: Alert banner background color did not match; Actual: "${elementStyle}"`); + } + console.log('Passed: Alert banner background color matched as expected'); } - console.log('Passed: Alert banner background color matched as expected'); - } -}, + }, -//Wait for dashboard to load -{ - description: 'Wait for dashboard load to completely', - action: async () => { - return await driver.wait(until.elementLocated(By.linkText('View Details')), 10000).catch(() => false); - } -}, + //Wait for dashboard to load + { + description: 'Wait for dashboard load to completely', + action: async () => { + return await driver.wait(until.elementLocated(By.linkText('View Details')), 10000).catch(() => false); + } + }, -//Verify content was deleted -{ - description: 'Verify content set deletion', - action: async () => { - const filterSearch = await driver.wait( - until.elementLocated(By.css('#content-org-filter')), - 5000 - ); - await filterSearch.clear(); - await filterSearch.sendKeys('QA'); - await driver.sleep(2000); - - const createdContentSet = await driver.findElements( - By.linkText(createContentSetName) - ); - - if (createdContentSet.length > 0) { - throw new Error('Content set was not deleted successfully'); + //Verify content was deleted + { + description: 'Verify content set deletion', + action: async () => { + const filterSearch = await driver.wait( + until.elementLocated(By.css('#content-org-filter')), + 5000 + ); + await filterSearch.clear(); + await filterSearch.sendKeys('QA'); + await driver.sleep(2000); + + const createdContentSet = await driver.findElements( + By.linkText(createContentSetName) + ); + + if (createdContentSet.length > 0) { + throw new Error('Content set was not deleted successfully'); + } } - } -} + }, + //LOG OUT + //NEXT ACTION - Log out + { description: 'Click Username dropdown', action: async () => await driver.findElement(By.css('#navbarDropdown > span')).click() }, + { description: 'Wait for action to complete', action: async () => await driver.sleep(2000) }, + { description: 'Click Log Out link', action: async () => await driver.findElement(By.linkText('Log Out')).click() }, + { description: 'Wait for action to complete', action: async () => await driver.sleep(2000) }, + + //Wait for login screen to load + { + description: 'Wait for log out process to complete', + action: async () => { + return await driver.wait(until.elementLocated(By.css('.login')), 10000).catch(() => false); + } + }, ]; const logStep = (worksheet, stepDescription, status, stepIndex, timestamp, screenshotPath) => { @@ -2699,6 +2713,8 @@ try { // Log test start time worksheet = logStep(worksheet, 'Test Start', 'Started', '', startTime, ''); + let allStepsPassed = true; + for (const step of steps) { const stepIndex = steps.indexOf(step) + 1; const timestamp = new Date().toISOString(); @@ -2712,17 +2728,18 @@ try { worksheet = logStep(worksheet, step.description, 'Failed', stepIndex, timestamp, screenshotPath); console.error(`Step ${stepIndex} FAILED: ${error.message}`); testStatus = 'Failed'; + allStepsPassed = false; } } - //Check if login was successful - const usernameValidation = await driver.wait(until.elementLocated(By.css('#navbarDropdown > span')), 5000).catch(() => false); + //Check if log out was successful + const loginButton = await driver.wait(until.elementLocated(By.css('.login')), 5000).catch(() => false); - if (usernameValidation) { - console.log('PASSED: System logged in as expected'); + if (loginButton && allStepsPassed) { + console.log('PASSED: My Content widget(ExACT_dashboardMyContent); All test steps completed successfully'); testStatus = 'Passed'; } else { - console.log('FAILED: Unable to log in'); + console.log('FAILED: My Content widget(ExACT_dashboardMyContent); One or more test steps failed'); testStatus = 'Failed'; } diff --git a/tests/ExACT_editItem.js b/tests/ExACT_editItem.js index 00dcee6..0350224 100644 --- a/tests/ExACT_editItem.js +++ b/tests/ExACT_editItem.js @@ -4,7 +4,7 @@ import XLSX from 'xlsx'; import path from 'path'; const ExACT_editItem = (req, res) => { - res.send('

ExACT Automated Test Script - Edit Item: Initiated

'); + res.send('

ExACT Automated Test Script - Edit Item(ExACT_editItem): Initiated

'); (async function example() { let driver = await new Builder().forBrowser('chrome').build(); let testStatus = 'Failed'; @@ -2447,6 +2447,20 @@ const steps = [ } }, + //LOG OUT + //NEXT ACTION - Log out + { description: 'Click Username dropdown', action: async () => await driver.findElement(By.css('#navbarDropdown > span')).click() }, + { description: 'Wait for action to complete', action: async () => await driver.sleep(2000) }, + { description: 'Click Log Out link', action: async () => await driver.findElement(By.linkText('Log Out')).click() }, + { description: 'Wait for action to complete', action: async () => await driver.sleep(2000) }, + + //Wait for login screen to load + { + description: 'Wait for log out process to complete', + action: async () => { + return await driver.wait(until.elementLocated(By.css('.login')), 10000).catch(() => false); + } + }, ]; const logStep = (worksheet, stepDescription, status, stepIndex, timestamp, screenshotPath) => { @@ -2494,6 +2508,8 @@ try { // Log test start time worksheet = logStep(worksheet, 'Test Start', 'Started', '', startTime, ''); + let allStepsPassed = true; + for (const step of steps) { const stepIndex = steps.indexOf(step) + 1; const timestamp = new Date().toISOString(); @@ -2507,17 +2523,18 @@ try { worksheet = logStep(worksheet, step.description, 'Failed', stepIndex, timestamp, screenshotPath); console.error(`Step ${stepIndex} FAILED: ${error.message}`); testStatus = 'Failed'; + allStepsPassed = false; } } - //Check if login was successful - const usernameValidation = await driver.wait(until.elementLocated(By.css('#navbarDropdown > span')), 5000).catch(() => false); + //Check if log out was successful + const loginButton = await driver.wait(until.elementLocated(By.css('.login')), 5000).catch(() => false); - if (usernameValidation) { - console.log('PASSED: System logged in as expected'); + if (loginButton && allStepsPassed) { + console.log('PASSED: Edit Item(ExACT_editItem); All test steps completed successfully'); testStatus = 'Passed'; } else { - console.log('FAILED: Unable to log in'); + console.log('FAILED: Edit Item(ExACT_editItem); One or more test steps failed'); testStatus = 'Failed'; } diff --git a/tests/ExACT_editItemAddConcept.js b/tests/ExACT_editItemAddConcept.js index b3b487f..2614adf 100644 --- a/tests/ExACT_editItemAddConcept.js +++ b/tests/ExACT_editItemAddConcept.js @@ -8794,7 +8794,6 @@ const steps = [ console.log('Passed: Log Out button present; Script completed'); } }, - ]; const logStep = (worksheet, stepDescription, status, stepIndex, timestamp, screenshotPath) => { @@ -8861,7 +8860,7 @@ try { } } - //Check if login was successful + //Check if log out was successful const loginButton = await driver.wait(until.elementLocated(By.css('.login')), 5000).catch(() => false); if (loginButton && allStepsPassed) { diff --git a/tests/ExACT_frameworkManagementPage.js b/tests/ExACT_frameworkManagementPage.js index a07bd40..6afae79 100644 --- a/tests/ExACT_frameworkManagementPage.js +++ b/tests/ExACT_frameworkManagementPage.js @@ -3866,7 +3866,7 @@ try { } } - //Check if login was successful + //Check if log out was successful const loginButton = await driver.wait(until.elementLocated(By.css('.login')), 5000).catch(() => false); if (loginButton & allStepsPassed) { diff --git a/tests/ExACT_login.js b/tests/ExACT_login.js index 43e960a..d7ef705 100644 --- a/tests/ExACT_login.js +++ b/tests/ExACT_login.js @@ -4,7 +4,7 @@ import XLSX from 'xlsx'; import path from 'path'; const ExACT_login = (req, res) => { - res.send('

ExACT Automated Test Script - Login: Initiated

'); + res.send('

ExACT Automated Test Script - Login(ExACT_login): Initiated

'); (async function example() { let driver = await new Builder().forBrowser('chrome').build(); let testStatus = 'Failed'; @@ -328,9 +328,17 @@ const steps = [ { description: 'Enter username', action: async () => await driver.findElement(By.css('.form-control:nth-child(2)')).sendKeys('exact_juan') }, { description: 'Enter correct password', action: async () => await driver.findElement(By.css('.passfield')).sendKeys('Edgate1!') }, { description: 'Click Login button after entering correct password', action: async () => await driver.findElement(By.css('.login')).click() }, - { description: 'Driver sleep', action: async () => await driver.sleep(10000) }, + { description: 'Wait for login process to complete', action: async () => await driver.sleep(10000) }, - //Check if log out was successful - username + //Wait for dashboard to load - Correlation Coverages View Details button + { + description: 'Wait for dashboard load to completely', + action: async () => { + return await driver.wait(until.elementLocated(By.linkText('View Details')), 10000).catch(() => false); + } + }, + + //Confirm username { description: 'Verify username', action: async () => { @@ -342,9 +350,20 @@ const steps = [ } }, - //Log Out - { description: 'Click the profile label', action: async () => await driver.findElement(By.css('#navbarDropdown > span')).click() }, - { description: 'Click Log out link', action: async () => await driver.findElement(By.linkText('Log Out')).click() }, + //LOG OUT + //NEXT ACTION - Log out + { description: 'Click Username dropdown', action: async () => await driver.findElement(By.css('#navbarDropdown > span')).click() }, + { description: 'Wait for action to complete', action: async () => await driver.sleep(2000) }, + { description: 'Click Log Out link', action: async () => await driver.findElement(By.linkText('Log Out')).click() }, + { description: 'Wait for action to complete', action: async () => await driver.sleep(2000) }, + + //Wait for login screen to load + { + description: 'Wait for log out process to complete', + action: async () => { + return await driver.wait(until.elementLocated(By.css('.login')), 10000).catch(() => false); + } + }, ]; const logStep = (worksheet, stepDescription, status, stepIndex, timestamp, screenshotPath) => { @@ -363,19 +382,19 @@ const takeScreenshot = async (driver, stepIndex, stepDescription) => { return screenshotPath; }; - const clearOldResults = () => { - // Remove old screenshots - const screenshotDir = path.join('screenshots', 'login'); - if (fs.existsSync(screenshotDir)) { - fs.rmSync(screenshotDir, { recursive: true, force: true }); - } - fs.mkdirSync(screenshotDir, { recursive: true }); +const clearOldResults = () => { + // Remove old screenshots + const screenshotDir = path.join('screenshots', 'login'); + if (fs.existsSync(screenshotDir)) { + fs.rmSync(screenshotDir, { recursive: true, force: true }); + } + fs.mkdirSync(screenshotDir, { recursive: true }); - // Remove old Excel file - if (fs.existsSync('loginResults.xlsx')) { - fs.unlinkSync('loginResults.xlsx'); - } - }; + // Remove old Excel file + if (fs.existsSync('loginResults.xlsx')) { + fs.unlinkSync('loginResults.xlsx'); + } +}; try { // Initialize workbook and worksheet @@ -391,6 +410,8 @@ try { // Log test start time worksheet = logStep(worksheet, 'Test Start', 'Started', '', startTime, ''); + let allStepsPassed = true; + for (const step of steps) { const stepIndex = steps.indexOf(step) + 1; const timestamp = new Date().toISOString(); @@ -404,17 +425,18 @@ try { worksheet = logStep(worksheet, step.description, 'Failed', stepIndex, timestamp, screenshotPath); console.error(`Step ${stepIndex} FAILED: ${error.message}`); testStatus = 'Failed'; + allStepsPassed = false; } } - //Script completed + //Check if log out was successful const loginButton = await driver.wait(until.elementLocated(By.css('.login')), 5000).catch(() => false); - if (loginButton) { - console.log('PASSED: Script completed'); + if (loginButton && allStepsPassed) { + console.log('PASSED: Login(ExACT_login); All test steps completed successfully'); testStatus = 'Passed'; } else { - console.log('FAILED: Script completed'); + console.log('FAILED: Login(ExACT_login); One or more test steps failed'); testStatus = 'Failed'; }