Updated scripts
This commit is contained in:
@@ -2,7 +2,6 @@ import { Builder, By, Key, until } from 'selenium-webdriver';
|
||||
import fs from 'fs';
|
||||
import XLSX from 'xlsx';
|
||||
import path from 'path';
|
||||
import { assert } from 'console';
|
||||
|
||||
const ExACT_login = (req, res) => {
|
||||
res.send('<h2>ExACT Automated Test Script - Login: Initiated</h2>');
|
||||
@@ -13,36 +12,25 @@ const ExACT_login = (req, res) => {
|
||||
let worksheet;
|
||||
const startTime = new Date().toISOString();
|
||||
|
||||
//Right Panel:
|
||||
//Welcome back
|
||||
//Welcome back
|
||||
const expectedWelcomeBackText = 'WELCOME BACK!';
|
||||
const expectedWelcomeBackColor = 'rgba(117, 117, 117, 1)' //gray
|
||||
//Login
|
||||
const expectedLoginTitleText = 'Login to your account';
|
||||
const expectedLoginTitleColor = 'rgba(40, 39, 90, 1)'; //navy blue
|
||||
const expectedLoginTitleFont = '32px';
|
||||
//Username
|
||||
const expectedUsernameLabel = 'Username';
|
||||
const expectedUsernameColor = 'rgba(40, 39, 90, 1)'; //navy blue
|
||||
const expectedUsernamePlaceholder = 'Username';
|
||||
//Password
|
||||
const expectedPasswordLabel = 'Password';
|
||||
const expectedPasswordColor = 'rgba(40, 39, 90, 1)'; //navy blue
|
||||
const expectedPasswordPlaceholder = 'Password';
|
||||
//Forgot password link
|
||||
const expectedForgotPasswordLinkColor = 'rgba(40, 39, 90, 1)'; //navy blue
|
||||
//Login button
|
||||
const expectedLoginButtonText = 'Login';
|
||||
const expectedLoginButtonColor = 'rgba(48, 200, 172, 1)'; //teal
|
||||
//Don't have account text
|
||||
const expectedDontHaveAccountText = `DON'T HAVE AN ACCOUNT?`;
|
||||
//Free trial button
|
||||
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
|
||||
|
||||
//Signed in Username
|
||||
const expectedUsername = 'JuanIsThe BestAdmin';
|
||||
@@ -76,13 +64,13 @@ const steps = [
|
||||
}
|
||||
},
|
||||
|
||||
//Welcome back text color
|
||||
//Welcome back text color -gray
|
||||
{
|
||||
description: 'Validate Welcome back text color',
|
||||
action: async () => {
|
||||
const elementStyle = await driver.findElement(By.css('#formLogin > p')).getCssValue('color');
|
||||
if (elementStyle !== expectedWelcomeBackColor) {
|
||||
throw new Error(`Welcome back text color Expected: "${expectedWelcomeBackColor}"; Actual: "${elementStyle}"`);
|
||||
if (elementStyle !== 'rgba(117, 117, 117, 1)') {
|
||||
throw new Error(`Welcome back text color did not match; Actual: "${elementStyle}"`);
|
||||
}
|
||||
console.log('Passed: Welcome back text color matched as expected');
|
||||
}
|
||||
@@ -112,13 +100,13 @@ const steps = [
|
||||
}
|
||||
},
|
||||
|
||||
//Login title text color
|
||||
//Login title text color -navy blue
|
||||
{
|
||||
description: 'Validate Login title text color',
|
||||
action: async () => {
|
||||
const elementStyle = await driver.findElement(By.css('h2:nth-child(3)')).getCssValue('color');
|
||||
if (elementStyle !== expectedLoginTitleColor) {
|
||||
throw new Error(`Login title text color Expected: "${expectedLoginTitleColor}"; Actual: "${elementStyle}"`);
|
||||
if (elementStyle !== 'rgba(40, 39, 90, 1)') {
|
||||
throw new Error(`Login title text color did not match; Actual: "${elementStyle}"`);
|
||||
}
|
||||
console.log('Passed: Login title text color matched as expected');
|
||||
}
|
||||
@@ -129,8 +117,8 @@ const steps = [
|
||||
description: 'Validate Login title text font size',
|
||||
action: async () => {
|
||||
const elementStyle = await driver.findElement(By.css('h2:nth-child(3)')).getCssValue('font-size');
|
||||
if (elementStyle !== expectedLoginTitleFont) {
|
||||
throw new Error(`Login title text font-size Expected: "${expectedLoginTitleFont}"; Actual: "${elementStyle}"`);
|
||||
if (elementStyle !== '32px') {
|
||||
throw new Error(`Login title text font-size did not match; Actual: "${elementStyle}"`);
|
||||
}
|
||||
console.log('Passed: Login title text font-size matched as expected');
|
||||
}
|
||||
@@ -148,13 +136,13 @@ const steps = [
|
||||
}
|
||||
},
|
||||
|
||||
//Username label text color
|
||||
//Username label text color -navy blue
|
||||
{
|
||||
description: 'Validate Username label text color',
|
||||
action: async () => {
|
||||
const elementStyle = await driver.findElement(By.css('.form-group:nth-child(4) > label')).getCssValue('color');
|
||||
if (elementStyle !== expectedUsernameColor) {
|
||||
throw new Error(`Username label text color Expected: "${expectedUsernameColor}"; Actual: "${elementStyle}"`);
|
||||
if (elementStyle !== 'rgba(40, 39, 90, 1)') {
|
||||
throw new Error(`Username label text color did not match; Actual: "${elementStyle}"`);
|
||||
}
|
||||
console.log('Passed: Username label text color matched as expected');
|
||||
}
|
||||
@@ -184,13 +172,13 @@ const steps = [
|
||||
}
|
||||
},
|
||||
|
||||
//Password label text color
|
||||
//Password label text color -navy blue
|
||||
{
|
||||
description: 'Validate Password label text color',
|
||||
action: async () => {
|
||||
const elementStyle = await driver.findElement(By.css('.form-group:nth-child(5) > label')).getCssValue('color');
|
||||
if (elementStyle !== expectedPasswordColor) {
|
||||
throw new Error(`Password label text color Expected: "${expectedPasswordColor}"; Actual: "${elementStyle}"`);
|
||||
if (elementStyle !== 'rgba(40, 39, 90, 1)') {
|
||||
throw new Error(`Password label text color did not match; Actual: "${elementStyle}"`);
|
||||
}
|
||||
console.log('Passed: Password label text color matched as expected');
|
||||
}
|
||||
@@ -208,13 +196,13 @@ const steps = [
|
||||
}
|
||||
},
|
||||
|
||||
//Forgot password text link color
|
||||
//Forgot password text link color -navy blue
|
||||
{
|
||||
description: 'Validate Forgot Password link text color',
|
||||
action: async () => {
|
||||
const elementStyle = await driver.findElement(By.linkText('Forgot Password?')).getCssValue('color');
|
||||
if (elementStyle !== expectedForgotPasswordLinkColor) {
|
||||
throw new Error(`Forgot password link text color Expected: "${expectedForgotPasswordLinkColor}"; Actual: "${elementStyle}"`);
|
||||
if (elementStyle !== 'rgba(40, 39, 90, 1)') {
|
||||
throw new Error(`Forgot password link text color did not match; Actual: "${elementStyle}"`);
|
||||
}
|
||||
console.log('Passed: Forgot password link text color matched as expected');
|
||||
}
|
||||
@@ -232,13 +220,13 @@ const steps = [
|
||||
}
|
||||
},
|
||||
|
||||
//Login button background color
|
||||
//Login button background color -teal
|
||||
{
|
||||
description: 'Validate Login button background color',
|
||||
action: async () => {
|
||||
const elementStyle = await driver.findElement(By.css('.login')).getCssValue('background-color');
|
||||
if (elementStyle !== expectedLoginButtonColor) {
|
||||
throw new Error(`Login button background color Expected: "${expectedLoginButtonColor}"; Actual: "${elementStyle}"`);
|
||||
if (elementStyle !== 'rgba(48, 200, 172, 1)') {
|
||||
throw new Error(`Login button background color did not match; Actual: "${elementStyle}"`);
|
||||
}
|
||||
console.log('Passed: Login button background color matched as expected');
|
||||
}
|
||||
@@ -268,13 +256,13 @@ const steps = [
|
||||
}
|
||||
},
|
||||
|
||||
//Free trial button background color
|
||||
//Free trial button background color -white
|
||||
{
|
||||
description: 'Validate Free trial button background color',
|
||||
action: async () => {
|
||||
const elementStyle = await driver.findElement(By.css('.btn > span')).getCssValue('background-color');
|
||||
if (elementStyle !== expectedFreeTrialButtonColor) {
|
||||
throw new Error(`Free trial button background color Expected: "${expectedFreeTrialButtonColor}"; Actual: "${elementStyle}"`);
|
||||
if (elementStyle !== 'rgba(0, 0, 0, 0)') {
|
||||
throw new Error(`Free trial button background color did not match; Actual: "${elementStyle}"`);
|
||||
}
|
||||
console.log('Passed: Free trial button background color matched as expected');
|
||||
}
|
||||
@@ -325,13 +313,13 @@ const steps = [
|
||||
}
|
||||
},
|
||||
|
||||
//Authentication validation text background color
|
||||
//Authentication validation text background color -red/orange
|
||||
{
|
||||
description: 'Validate authentication alert background color',
|
||||
action: async () => {
|
||||
const elementStyle = await driver.findElement(By.css('.alert')).getCssValue('background-color');
|
||||
if (elementStyle !== expectedAuthenticationColor) {
|
||||
throw new Error(`Authentication alert background color Expected: "${expectedAuthenticationColor}"; Actual: "${elementStyle}"`);
|
||||
if (elementStyle !== 'rgba(231, 76, 60, 0.88)') {
|
||||
throw new Error(`Authentication alert background color did not match; Actual: "${elementStyle}"`);
|
||||
}
|
||||
console.log('Passed: Authentication alert background color matched as expected');
|
||||
}
|
||||
@@ -414,7 +402,7 @@ try {
|
||||
} catch (error) {
|
||||
const screenshotPath = await takeScreenshot(driver, stepIndex, `${step.description}_Failed`);
|
||||
worksheet = logStep(worksheet, step.description, 'Failed', stepIndex, timestamp, screenshotPath);
|
||||
console.error(`Step ${stepIndex} failed: ${error.message}`);
|
||||
console.error(`Step ${stepIndex} FAILED: ${error.message}`);
|
||||
testStatus = 'Failed';
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user