Completed login script
This commit is contained in:
Binary file not shown.
@@ -40,6 +40,10 @@ const expectedDontHaveAccountText = `DON'T HAVE AN ACCOUNT?`;
|
|||||||
const expectedFreeTrialButtonText = '30 Day';
|
const expectedFreeTrialButtonText = '30 Day';
|
||||||
const expectedFreeTrialButtonColor = 'rgba(0, 0, 0, 0)'; //white
|
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 = [
|
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: '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() },
|
{ description: 'Expand browser', action: async () => await driver.manage().window().maximize() },
|
||||||
@@ -217,7 +221,7 @@ const steps = [
|
|||||||
|
|
||||||
//Free trial button text
|
//Free trial button text
|
||||||
{ description: 'Validate Free trial button text', action: async () =>
|
{ 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)
|
if (elementText === expectedFreeTrialButtonText)
|
||||||
{console.log('Passed: Free trial button text matched as expected');}
|
{console.log('Passed: Free trial button text matched as expected');}
|
||||||
else
|
else
|
||||||
@@ -247,6 +251,46 @@ const steps = [
|
|||||||
|
|
||||||
//Validation
|
//Validation
|
||||||
{ description: 'Click Login button', action: async () => await driver.findElement(By.css('.login')).click() },
|
{ 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) => {
|
const logStep = (worksheet, stepDescription, status, stepIndex, timestamp, screenshotPath) => {
|
||||||
@@ -302,14 +346,14 @@ try {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Check if landing page username validation was successful
|
//Check if login was successful
|
||||||
const usernameValidation = await driver.wait(until.elementLocated(By.css('.form-group:nth-child(5) > label')), 5000).catch(() => false);
|
const usernameValidation = await driver.wait(until.elementLocated(By.css('#navbarDropdown > span')), 5000).catch(() => false);
|
||||||
|
|
||||||
if (usernameValidation) {
|
if (usernameValidation) {
|
||||||
console.log('Passed: Username validation');
|
console.log('PASSED: System logged in as expected');
|
||||||
testStatus = 'Passed';
|
testStatus = 'Passed';
|
||||||
} else {
|
} else {
|
||||||
console.log('FAILED: Username validation not triggered');
|
console.log('FAILED: Unable to log in');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Log test end time
|
// Log test end time
|
||||||
|
|||||||
Reference in New Issue
Block a user