Added LogOut and updated test results
This commit is contained in:
@@ -4,7 +4,7 @@ import XLSX from 'xlsx';
|
||||
import path from 'path';
|
||||
|
||||
const ExACT_alignStandardsPage = (req, res) => {
|
||||
res.send('<h2>ExACT Automated Test Script - Align Standards Page: Initiated</h2>');
|
||||
res.send('<h2>ExACT Automated Test Script - Align Standards Page(ExACT_alignStandardsPage): Initiated</h2>');
|
||||
(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';
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user