Added LogOut and updated test results
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user