diff --git a/landingPageResults.xlsx b/landingPageResults.xlsx index ed4d70e..d0cd458 100644 Binary files a/landingPageResults.xlsx and b/landingPageResults.xlsx differ diff --git a/loginResults.xlsx b/loginResults.xlsx index b697c53..412d9e5 100644 Binary files a/loginResults.xlsx and b/loginResults.xlsx differ diff --git a/tests/ExACT_login.js b/tests/ExACT_login.js index 5705e63..0c42f3f 100644 --- a/tests/ExACT_login.js +++ b/tests/ExACT_login.js @@ -45,9 +45,12 @@ const expectedAuthenticationText = 'Authentication Failed. Please check the user const expectedAuthenticationColor = 'rgba(231, 76, 60, 0.88)'; //orange const steps = [ - { description: 'Navigate to ExACT Landing Page', action: async () => await driver.navigate().to('https://stage.edgate.com/exact/login.php') }, + { description: 'Navigate to ExACT Landing Page', action: async () => await driver.navigate().to('https://stage.edgate.com/exact/login.php') }, //PROD - https://correlation.edgate.com/exact/login.php { description: 'Expand browser', action: async () => await driver.manage().window().maximize() }, +//RIGHT PANEL + + //ExACT logo { description: 'Verify ExACT logo is present', action: async () => { @@ -59,6 +62,7 @@ const steps = [ } }, + //Welcome back text { description: 'Validate Welcome back text', action: async () => { @@ -70,6 +74,7 @@ const steps = [ } }, + //Welcome back text color { description: 'Validate Welcome back text color', action: async () => { @@ -81,6 +86,7 @@ const steps = [ } }, + //Welcome back icon { description: 'Verify Welcome back icon is present', action: async () => { @@ -92,6 +98,7 @@ const steps = [ } }, + //Login title text { description: 'Validate Login title text', action: async () => { @@ -103,6 +110,7 @@ const steps = [ } }, + //Login title text color { description: 'Validate Login title text color', action: async () => { @@ -114,6 +122,7 @@ const steps = [ } }, + //Login title text font { description: 'Validate Login title text font size', action: async () => { @@ -125,6 +134,7 @@ const steps = [ } }, + //Username label text { description: 'Validate Username label text', action: async () => { @@ -136,6 +146,7 @@ const steps = [ } }, + //Username label text color { description: 'Validate Username label text color', action: async () => { @@ -147,6 +158,7 @@ const steps = [ } }, + //Username textbox placeholder { description: 'Validate Username placeholder text', action: async () => { @@ -158,6 +170,8 @@ const steps = [ } }, + + //Password label text { description: 'Validate Password label text', action: async () => { @@ -169,6 +183,7 @@ const steps = [ } }, + //Password label text color { description: 'Validate Password label text color', action: async () => { @@ -180,6 +195,7 @@ const steps = [ } }, + //Password textbox placeholder { description: 'Validate Password placeholder text', action: async () => { @@ -191,6 +207,7 @@ const steps = [ } }, + //Forgot password text link color { description: 'Validate Forgot Password link text color', action: async () => { @@ -202,6 +219,7 @@ const steps = [ } }, + //Login button text { description: 'Validate Login button text', action: async () => { @@ -213,6 +231,7 @@ const steps = [ } }, + //Login button background color { description: 'Validate Login button background color', action: async () => { @@ -224,6 +243,7 @@ const steps = [ } }, + //Don't have an account? text { description: 'Validate Dont have account text', action: async () => { @@ -235,6 +255,7 @@ const steps = [ } }, + //Free trial button text { description: 'Validate Free trial button text', action: async () => { @@ -246,6 +267,7 @@ const steps = [ } }, + //Free trial button background color { description: 'Validate Free trial button background color', action: async () => { @@ -257,6 +279,7 @@ const steps = [ } }, + //EdGate copyright image { description: 'Verify EdGate copyright image is present', action: async () => { @@ -268,12 +291,29 @@ const steps = [ } }, + //Validation + { description: 'Click Login button', action: async () => await driver.findElement(By.css('.login')).click() }, + + /*Username validation + + { description: 'Validate username validadtion text', action: async () => + { const elementText = await driver.findElement(By.css('?')).getText(); + if (elementText === expectedUsernameValidationText) + {console.log('Passed: Username validation text matched as expected');} + else + {console.log(`FAILED: Expected: "${expectedUsernameValidationText}"; Actual: "${elementText}"`);} + } + },*/ + + { description: 'Enter username', action: async () => await driver.findElement(By.css('.form-control:nth-child(2)')).sendKeys('exact_juan') }, { description: 'Click Login button after entering username', action: async () => await driver.findElement(By.css('.login')).click() }, { description: 'Enter incorrect password', action: async () => await driver.findElement(By.css('.passfield')).sendKeys('Edgate1') }, { description: 'Click Login button after entering wrong password', action: async () => await driver.findElement(By.css('.login')).click() }, + //Confirm validation message + { description: 'Validate authentication failed validation text', action: async () => { @@ -285,6 +325,7 @@ const steps = [ } }, + //Authentication validation text background color { description: 'Validate authentication alert background color', action: async () => { @@ -295,7 +336,7 @@ const steps = [ console.log('Passed: Authentication alert background color matched as expected'); } }, - + { 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() }, @@ -312,30 +353,36 @@ const takeScreenshot = async (driver, stepIndex, stepDescription) => { const screenshot = await driver.takeScreenshot(); const dir = path.join('screenshots', 'loginScript'); - if (!fs.existsSync(dir)) { - fs.mkdirSync(dir, { recursive: true }); - } - const screenshotFileName = `step_${stepIndex}_${stepDescription.replace(/\s+/g, '_')}.png`; const screenshotPath = path.join(dir, screenshotFileName); fs.writeFileSync(screenshotPath, screenshot, 'base64'); return screenshotPath; }; + const clearOldResults = () => { + // Remove old screenshots + const screenshotDir = path.join('screenshots', 'loginScript'); + 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'); + } + }; + try { // Initialize workbook and worksheet - if (!fs.existsSync('loginResults.xlsx')) { - workbook = XLSX.utils.book_new(); - worksheet = XLSX.utils.aoa_to_sheet([ - ['Step Number', 'Step Description', 'Status', 'Timestamp', 'Screenshot'] - ]); - XLSX.utils.book_append_sheet(workbook, worksheet, 'Sheet1'); - XLSX.writeFile(workbook, 'loginResults.xlsx'); - } else { - workbook = XLSX.readFile('loginResults.xlsx', { cellStyles: true }); - const sheetName = workbook.SheetNames[0]; - worksheet = workbook.Sheets[sheetName]; - } + clearOldResults(); + + // Initialize workbook and worksheet + workbook = XLSX.utils.book_new(); + worksheet = XLSX.utils.aoa_to_sheet([ + ['Step Number', 'Step Description', 'Status', 'Timestamp', 'Screenshot'] + ]); + XLSX.utils.book_append_sheet(workbook, worksheet, 'Sheet1'); // Log test start time worksheet = logStep(worksheet, 'Test Start', 'Started', '', startTime, ''); @@ -355,6 +402,7 @@ try { testStatus = 'Failed'; } } + //Check if login was successful const usernameValidation = await driver.wait(until.elementLocated(By.css('#navbarDropdown > span')), 5000).catch(() => false); @@ -365,7 +413,7 @@ try { console.log('FAILED: Unable to log in'); testStatus = 'Failed'; } - + // Log test end time const endTime = new Date().toISOString(); worksheet = logStep(worksheet, 'Test End', testStatus, '', endTime, '');