From 9f1cbb7b2eed53fedc54a802402720a10e9e5ad0 Mon Sep 17 00:00:00 2001 From: jhuerta Date: Fri, 16 Oct 2026 11:32:25 -0700 Subject: [PATCH] Cleaned up Log Out script --- tests/frameworkManagementPage.js | 75 +++++++++++++++++--------------- 1 file changed, 40 insertions(+), 35 deletions(-) diff --git a/tests/frameworkManagementPage.js b/tests/frameworkManagementPage.js index 8741dda..34a94d6 100644 --- a/tests/frameworkManagementPage.js +++ b/tests/frameworkManagementPage.js @@ -2508,45 +2508,51 @@ 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) }, - - //Log Out icon - { - description: 'Verify Log Out icon is present', - action: async () => - { const expectedIcon = await driver.wait(until.elementLocated(By.css('.fa-sign-out')), 5000).catch(() => false); - if (!expectedIcon) { - throw new Error('Log Out icon not found'); - } - console.log('Passed: Log Out icon present'); - } - }, - - { description: 'Click Log Out link', action: async () => await driver.findElement(By.linkText('Log Out')).click() }, - - //Wait for login screen to load + //NEXT ACTION { - description: 'Wait for log out process to complete', + description: 'Log Out', action: async () => { - return await driver.wait(until.elementLocated(By.css('.login')), 10000).catch(() => false); - } - }, + const multipleChecks = 'Log Out'; + + //Track all errors + const errors = []; - //Log Out button - { - description: 'Verify Log Out button is present', - action: async () => - { const expectedIcon = await driver.wait(until.elementLocated(By.css('.login')), 5000).catch(() => false); - if (!expectedIcon) { - throw new Error('Log Out button not found'); + await driver.findElement(By.css('#navbarDropdown > span')).click(); + await driver.sleep(2000); + await driver.findElement(By.linkText('Log Out')).click(); + console.log('----->| NEXT ACTION: Clicked User Profile and Logged Out'); + + //Wait until the element exists in the DOM + const exactLogo = await driver.wait( + until.elementLocated(By.css('.logo')), + 30000 + ); + + //Wait until it becomes visible + await driver.wait( + until.elementIsVisible(exactLogo), + 30000 + ); + + //Wait for page to load completely + await driver.wait(async () => { + const readyState = await driver.executeScript('return document.readyState'); + return readyState === 'complete'; + }, 30000, 'ExACT Langing page did not fully load within 30 seconds'); + console.log('Passed: ExACT Landing Page loaded successfully'); + + //Throw summary if any validation failed + if (errors.length > 0) { + //Add summary line only when multiple checks failed + if (errors.length > 1) { + errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); + } + + //Throw collected messages — catch() will prefix with "FAILED:" + throw new Error(errors.join('\n')); } - console.log('Passed: Log Out button present; Script completed'); } }, - ]; const logStep = (worksheet, stepDescription, status, stepIndex, timestamp, screenshotPath) => { @@ -2641,8 +2647,7 @@ try { } //Check if log out was successful - //const loginButton = await driver.wait(until.elementLocated(By.css('.login')), 5000).catch(() => false); - + if (allStepsPassed) { console.log('------------->| THE END |<-------------'); console.log('PASSED: Framework Management Page(frameworkManagementPage); All test steps completed successfully');