Cleaned up Log Out script
This commit is contained in:
@@ -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
|
||||
//NEXT ACTION
|
||||
{
|
||||
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
|
||||
{
|
||||
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 = [];
|
||||
|
||||
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'));
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
//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');
|
||||
}
|
||||
console.log('Passed: Log Out button present; Script completed');
|
||||
}
|
||||
},
|
||||
|
||||
];
|
||||
|
||||
const logStep = (worksheet, stepDescription, status, stepIndex, timestamp, screenshotPath) => {
|
||||
@@ -2641,7 +2647,6 @@ 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 |<-------------');
|
||||
|
||||
Reference in New Issue
Block a user