diff --git a/loginResults.xlsx b/loginResults.xlsx index 006bb00..7666b93 100644 Binary files a/loginResults.xlsx and b/loginResults.xlsx differ diff --git a/tests/ExACT_login.js b/tests/ExACT_login.js index 015d2fd..47d8389 100644 --- a/tests/ExACT_login.js +++ b/tests/ExACT_login.js @@ -40,6 +40,10 @@ const expectedDontHaveAccountText = `DON'T HAVE AN ACCOUNT?`; const expectedFreeTrialButtonText = '30 Day'; const expectedFreeTrialButtonColor = 'rgba(0, 0, 0, 0)'; //white +//Validation +const expectedAuthenticationText = 'Authentication Failed. Please check the username and password you entered and try again.'; +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') }, //PROD - https://correlation.edgate.com/exact/login.php { description: 'Expand browser', action: async () => await driver.manage().window().maximize() }, @@ -217,7 +221,7 @@ const steps = [ //Free trial button text { description: 'Validate Free trial button text', action: async () => - { const elementText = await driver.findElement(By.css('.btn > span')).getText();//attribute + { const elementText = await driver.findElement(By.css('.btn > span')).getText(); if (elementText === expectedFreeTrialButtonText) {console.log('Passed: Free trial button text matched as expected');} else @@ -247,6 +251,46 @@ 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 () => + { const elementText = await driver.findElement(By.css('.alert')).getText(); + if (elementText === expectedAuthenticationText) + {console.log('Passed: Authentication text matched as expected');} + else + {console.log(`FAILED: Expected: "${expectedAuthenticationText}"; Actual: "${elementText}"`);} + } + }, + + //Authentication validation text background color + { description: 'Validate authentication alert background color', action: async () => + { const elementStyle = await driver.findElement(By.css('.alert')).getCssValue('background-color'); + if (elementStyle === expectedAuthenticationColor) + {console.log('Passed: Authentication alert background color matched as expected');} + else + {console.log(`FAILED: Authentication alert background color Expected: "${expectedAuthenticationColor}"; Actual: "${elementStyle}"`);} + } + }, + + { 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() }, + { description: 'Wait for login process to complete', action: async () => await driver.sleep(10000) }, ]; const logStep = (worksheet, stepDescription, status, stepIndex, timestamp, screenshotPath) => { @@ -302,14 +346,14 @@ try { } } - //Check if landing page username validation was successful - const usernameValidation = await driver.wait(until.elementLocated(By.css('.form-group:nth-child(5) > label')), 5000).catch(() => false); + //Check if login was successful + const usernameValidation = await driver.wait(until.elementLocated(By.css('#navbarDropdown > span')), 5000).catch(() => false); if (usernameValidation) { - console.log('Passed: Username validation'); + console.log('PASSED: System logged in as expected'); testStatus = 'Passed'; } else { - console.log('FAILED: Username validation not triggered'); + console.log('FAILED: Unable to log in'); } // Log test end time