Completed landing page script

This commit is contained in:
2024-10-04 15:41:21 -07:00
parent 326afca1c6
commit c54ea37907
2 changed files with 334 additions and 66 deletions

Binary file not shown.

View File

@@ -13,31 +13,74 @@ const ExACT_landingPage = (req, res) => {
let worksheet;
const startTime = new Date().toISOString();
//Text to be verified
//Left Panel:
//Title
const expectedTitleText = 'Empowering publishers with the ability to correlate their unique content to standards.';
const expectedTitleFont = '32px';
//Description
const expectedDescriptiveText1 = 'The ExACT platform is the education industry’s most trusted source to globally correlate content to standards and produce content alignment reports.';
const expectedDescriptiveText2 = 'With access to over five million learning outcomes, ExACT’s robust toolset allows end users to discover new markets for their content, find gaps, and adjust alignments for specific opportunities.';
//Sign Up
const expectedSignUpText = 'Sign Up For A 30 Day Free Trial';
const expectedFreeTrialLink = '30 Day Free Trial';
const expectedBulletPoint1 = 'Learn more about ExACT AutoAlign, the AI-based alignment tool.';
const expectedBulletPointLink1 = 'ExACT AutoAlign,';
const expectedBulletPoint2 = 'See your Correlation Analytics.';
const expectedBulletPointLink2 = 'Correlation Analytics.';
const expectedBulletPoint3 = 'Explore how your Content maps to International Standards.';
const expectedBulletPointLink3 = 'International Standards.';
const expectedFreeTrialLinkColor = 'rgba(255, 111, 97, 1)'; //Red/Orange
//Bullet Points
const expectedBulletPointText1 = 'Learn more about ExACT AutoAlign, the AI-based alignment tool.';
const expectedBulletPointLinkColor1 = 'rgba(48, 200, 172, 1)'; //teal
const expectedBulletPointText2 = 'See your Correlation Analytics.';
const expectedBulletPointLinkColor2 = 'rgba(48, 200, 172, 1)'; //teal
const expectedBulletPointText3 = 'Explore how your Content maps to International Standards.';
const expectedBulletPointLinkColor3 = 'rgba(48, 200, 172, 1)'; //teal
//Right Panel:
//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
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() },
//LEFT PANEL
//Title text
{ description: 'Wait for title text to be present', action: async () => await driver.wait(until.elementLocated(By.css('h2:nth-child(1)')), 5000) },
{ description: 'Validate title text', action: async () =>
{ const elementText = await driver.findElement(By.css('h2:nth-child(1)')).getText();
if (elementText === expectedTitleText)
{console.log('Passed: Title matched as expected');}
{console.log('Passed: Title text matched as expected');}
else
{console.log(`FAILED: Expected: "${expectedTitleText}", but found "${elementText}"`);}
{console.log(`FAILED: Expected: "${expectedTitleText}"; Actual: "${elementText}"`);}
}
},
//Title text font
{ description: 'Validate Title text font size', action: async () =>
{ const elementStyle = await driver.findElement(By.css('h2:nth-child(3)')).getCssValue('font-size');
if (elementStyle === expectedTitleFont)
{console.log('Passed: Title text font-size matched as expected');}
else
{console.log(`FAILED: Title text font-size Expected: "${expectedTitleFont}"; Actual: "${elementStyle}"`);}
}
},
@@ -47,7 +90,7 @@ const steps = [
if (elementText === expectedDescriptiveText1)
{console.log('Passed: Descriptive text 1 matched as expected');}
else
{console.log(`FAILED: Expected: "${expectedDescriptiveText1}", but found "${elementText}"`);}
{console.log(`FAILED: Expected: "${expectedDescriptiveText1}"; Actual: "${elementText}"`);}
}
},
@@ -57,7 +100,7 @@ const steps = [
if (elementText === expectedDescriptiveText2)
{console.log('Passed: Descriptive text 2 matched as expected');}
else
{console.log(`FAILED: Expected: "${expectedDescriptiveText2}", but found "${elementText}"`);}
{console.log(`FAILED: Expected: "${expectedDescriptiveText2}"; Actual: "${elementText}"`);}
}
},
@@ -67,80 +110,314 @@ const steps = [
if (elementText === expectedSignUpText)
{console.log('Passed: Sign up text matched as expected');}
else
{console.log(`FAILED: Expected: "${expectedSignUpText}", but found "${elementText}"`);}
{console.log(`FAILED: Expected: "${expectedSignUpText}"; Actual: "${elementText}"`);}
}
},
//Free trial link
{ description: 'Validate free trial link', action: async () =>
{ const elementText = await driver.findElement(By.linkText('30 Day Free Trial')).getText();
if (elementText === expectedFreeTrialLink)
{console.log('Passed: Free trial link matched as expected');}
//Free trial link text color
{ description: 'Validate free trial link color', action: async () =>
{ const elementStyle = await driver.findElement(By.linkText('30 Day Free Trial')).getCssValue('color');
if (elementStyle === expectedFreeTrialLinkColor)
{console.log('Passed: Free trial link text color matched as expected');}
else
{console.log(`FAILED: Expected: "${expectedFreeTrialLink}", but found "${elementText}"`);}
{console.log(`FAILED: Free trial link text color Expected: "${expectedFreeTrialLinkColor}"; Actual: "${elementStyle}"`);}
}
},
//Bullet Point 1
{ description: 'Validate bullet point 1', action: async () =>
//Bullet Point Icon 1
{ description: 'Verify bullet point icon 1 is present', action: async () =>
{ const expectedbulletPointIcon = await driver.wait(until.elementLocated(By.css('li:nth-child(1) img')), 5000).catch(() => false);
if (expectedbulletPointIcon)
{console.log('Passed: Bullet Point Icon 1 present');}
else
{console.log('FAILED: Bullet Point Icon 1 not found');}
}
},
//Bullet Point 1 text
{ description: 'Validate bullet point 1 text', action: async () =>
{ const elementText = await driver.findElement(By.css('li:nth-child(1) > .list-flex')).getText();
if (elementText === expectedBulletPoint1)
{console.log('Passed: Bullet point 1 matched as expected');}
if (elementText === expectedBulletPointText1)
{console.log('Passed: Bullet point 1 text matched as expected');}
else
{console.log(`FAILED: Expected: "${expectedBulletPoint1}", but found "${elementText}"`);}
{console.log(`FAILED: Expected: "${expectedBulletPointText1}"; Actual: "${elementText}"`);}
}
},
//Bullet Point link 1
{ description: 'Validate bullet point link 1', action: async () =>
{ const elementText = await driver.findElement(By.linkText('ExACT AutoAlign,')).getText();
if (elementText === expectedBulletPointLink1)
{console.log('Passed: Bullet pont link 1 matched as expected');}
//Bullet Point link 1 text color
{ description: 'Validate bullet point link 1 text color', action: async () =>
{ const elementStyle = await driver.findElement(By.linkText('ExACT AutoAlign,')).getCssValue('color');
if (elementStyle === expectedBulletPointLinkColor1)
{console.log('Passed: Bullet point link 1 text color matched as expected');}
else
{console.log(`FAILED: Expected: "${expectedBulletPointLink1}", but found "${elementText}"`);}
{console.log(`FAILED: Bullet point link 1 text color Expected: "${expectedBulletPointLinkColor1}"; Actual: "${elementStyle}"`);}
}
},
//Bullet Point 2
{ description: 'Validate bullet point 2', action: async () =>
//Bullet Point Icon 2
{ description: 'Verify bullet point icon 2 is present', action: async () =>
{ const expectedbulletPointIcon = await driver.wait(until.elementLocated(By.css('li:nth-child(2) img')), 5000).catch(() => false);
if (expectedbulletPointIcon)
{console.log('Passed: Bullet Point Icon 2 present');}
else
{console.log('FAILED: Bullet Point Icon 2 not found');}
}
},
//Bullet Point 2 text
{ description: 'Validate bullet point 2 text', action: async () =>
{ const elementText = await driver.findElement(By.css('li:nth-child(2) > .list-flex')).getText();
if (elementText === expectedBulletPoint2)
{console.log('Passed: Bullet point 2 matched as expected');}
if (elementText === expectedBulletPointText2)
{console.log('Passed: Bullet point 2 text matched as expected');}
else
{console.log(`FAILED: Expected: "${expectedBulletPoint2}", but found "${elementText}"`);}
{console.log(`FAILED: Expected: "${expectedBulletPointText2}"; Actual: "${elementText}"`);}
}
},
//Bullet Point link 2
{ description: 'Validate bullet point link 2', action: async () =>
{ const elementText = await driver.findElement(By.linkText('Correlation Analytics.')).getText();
if (elementText === expectedBulletPointLink2)
{console.log('Passed: Bullet pont link 2 matched as expected');}
//Bullet Point link 2 text color
{ description: 'Validate bullet point link 2 text color', action: async () =>
{ const elementStyle = await driver.findElement(By.linkText('Correlation Analytics.')).getCssValue('color');
if (elementStyle === expectedBulletPointLinkColor2)
{console.log('Passed: Bullet point link 2 text color matched as expected');}
else
{console.log(`FAILED: Expected: "${expectedBulletPointLink2}", but found "${elementText}"`);}
{console.log(`FAILED: Bullet point link 2 text color Expected: "${expectedBulletPointLinkColor2}"; Actual: "${elementStyle}"`);}
}
},
//Bullet Point 3
{ description: 'Validate bullet point 3', action: async () =>
//Bullet Point Icon 3
{ description: 'Verify bullet point icon 3 is present', action: async () =>
{ const expectedbulletPointIcon = await driver.wait(until.elementLocated(By.css('li:nth-child(3) img')), 5000).catch(() => false);
if (expectedbulletPointIcon)
{console.log('Passed: Bullet Point Icon 3 present');}
else
{console.log('FAILED: Bullet Point Icon 3 not found');}
}
},
//Bullet Point 3 text
{ description: 'Validate bullet point 3 text', action: async () =>
{ const elementText = await driver.findElement(By.css('li:nth-child(3) > .list-flex')).getText();
if (elementText === expectedBulletPoint3)
{console.log('Passed: Bullet point 3 matched as expected');}
if (elementText === expectedBulletPointText3)
{console.log('Passed: Bullet point 3 text matched as expected');}
else
{console.log(`FAILED: Expected: "${expectedBulletPoint3}", but found "${elementText}"`);}
{console.log(`FAILED: Expected: "${expectedBulletPointText3}"; Actual: "${elementText}"`);}
}
},
//Bullet Point link 3
{ description: 'Validate bullet point link 3', action: async () =>
{ const elementText = await driver.findElement(By.linkText('International Standards.')).getText();
if (elementText === expectedBulletPointLink3)
{console.log('Passed: Bullet pont link 3 matched as expected');}
//Bullet Point link 3 text color
{ description: 'Validate bullet point link 3 text color', action: async () =>
{ const elementStyle = await driver.findElement(By.linkText('International Standards.')).getCssValue('color');
if (elementStyle === expectedBulletPointLinkColor3)
{console.log('Passed: Bullet point link 3 text color matched as expected');}
else
{console.log(`FAILED: Expected: "${expectedBulletPointLink3}", but found "${elementText}"`);}
{console.log(`FAILED: Bullet point link 3 text color Expected: "${expectedBulletPointLinkColor3}"; Actual: "${elementStyle}"`);}
}
},
//RIGHT PANEL
//ExACT logo
{ description: 'Verify ExACT logo is present', action: async () =>
{ const expectedExactLogo = await driver.wait(until.elementLocated(By.css('.logo')), 5000).catch(() => false);
if (expectedExactLogo)
{console.log('Passed: ExACT logo present');}
else
{console.log('FAILED: ExACT logo not found');}
}
},
//Welcome back text
{ description: 'Validate Welcome back text', action: async () =>
{ const elementText = await driver.findElement(By.css('#formLogin > p')).getText();
if (elementText === expectedWelcomeBackText)
{console.log('Passed: Welcome Back! text matched as expected');}
else
{console.log(`FAILED: Expected: "${expectedWelcomeBackText}"; Actual: "${elementText}"`);}
}
},
//Welcome back text color
{ description: 'Validate Welcome back text color', action: async () =>
{ const elementStyle = await driver.findElement(By.css('#formLogin > p')).getCssValue('color');
if (elementStyle === expectedWelcomeBackColor)
{console.log('Passed: Welcome back text color matched as expected');}
else
{console.log(`FAILED: Welcome back text color Expected: "${expectedWelcomeBackColor}"; Actual: "${elementStyle}"`);}
}
},
//Welcome back icon
{ description: 'Verify Welcome back icon is present', action: async () =>
{ const expectedWelcomeBackIcon = await driver.wait(until.elementLocated(By.css('p > img')), 5000).catch(() => false);
if (expectedWelcomeBackIcon)
{console.log('Passed: Welcome back icon present');}
else
{console.log('FAILED: Welcome back icon not found');}
}
},
//Login title text
{ description: 'Validate Login title text', action: async () =>
{ const elementText = await driver.findElement(By.css('h2:nth-child(3)')).getText();
if (elementText === expectedLoginTitleText)
{console.log('Passed: Login title text matched as expected');}
else
{console.log(`FAILED: Expected: "${expectedLoginTitleText}"; Actual: "${elementText}"`);}
}
},
//Login title text color
{ description: 'Validate Login title text color', action: async () =>
{ const elementStyle = await driver.findElement(By.css('h2:nth-child(3)')).getCssValue('color');
if (elementStyle === expectedLoginTitleColor)
{console.log('Passed: Login title text color matched as expected');}
else
{console.log(`FAILED: Login title text color Expected: "${expectedLoginTitleColor}"; Actual: "${elementStyle}"`);}
}
},
//Login title text font
{ 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)
{console.log('Passed: Login title text font-size matched as expected');}
else
{console.log(`FAILED: Login title text font-size Expected: "${expectedLoginTitleFont}"; Actual: "${elementStyle}"`);}
}
},
//Username label text
{ description: 'Validate Username label text', action: async () =>
{ const elementText = await driver.findElement(By.css('.form-group:nth-child(4) > label')).getText();
if (elementText === expectedUsernameLabel)
{console.log('Passed: Username label text matched as expected');}
else
{console.log(`FAILED: Expected: "${expectedUsernameLabel}"; Actual: "${elementText}"`);}
}
},
//Username label text color
{ 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)
{console.log('Passed: Username label text color matched as expected');}
else
{console.log(`FAILED: Username label text color Expected: "${expectedUsernameColor}"; Actual: "${elementStyle}"`);}
}
},
//Username textbox placeholder
{ description: 'Validate Username placeholder text', action: async () =>
{ const elementValue = await driver.findElement(By.css('.form-control:nth-child(2)')).getAttribute('placeholder');
if (elementValue === expectedUsernamePlaceholder)
{console.log('Passed: Username placeholder text matched as expected');}
else
{console.log(`FAILED: Username placeholder text Expected: "${expectedUsernamePlaceholder}"; Actual: "${elementValue}"`);}
}
},
//Password label text
{ description: 'Validate Password label text', action: async () =>
{ const elementText = await driver.findElement(By.css('.form-group:nth-child(5) > label')).getText();
if (elementText === expectedPasswordLabel)
{console.log('Passed: Password label text matched as expected');}
else
{console.log(`FAILED: Expected: "${expectedPasswordLabel}"; Actual: "${elementText}"`);}
}
},
//Password label text color
{ 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)
{console.log('Passed: Password label text color matched as expected');}
else
{console.log(`FAILED: Password label text color Expected: "${expectedPasswordColor}"; Actual: "${elementStyle}"`);}
}
},
//Password textbox placeholder
{ description: 'Validate Password placeholder text', action: async () =>
{ const elementValue = await driver.findElement(By.css('.passfield')).getAttribute('placeholder');
if (elementValue === expectedPasswordPlaceholder)
{console.log('Passed: Password placeholder text matched as expected');}
else
{console.log(`FAILED: Password placeholder text Expected: "${expectedPasswordPlaceholder}"; Actual: "${elementValue}"`);}
}
},
//Forgot password text link color
{ description: 'Validate Forgot Password link text color', action: async () =>
{ const elementStyle = await driver.findElement(By.linkText('Forgot Password?')).getCssValue('color');
if (elementStyle === expectedForgotPasswordLinkColor)
{console.log('Passed: Forgot password link text color matched as expected');}
else
{console.log(`FAILED: Forgot password link text color Expected: "${expectedForgotPasswordLinkColor}"; Actual: "${elementStyle}"`);}
}
},
//Login button text
{ description: 'Validate Login button text', action: async () =>
{ const elementText = await driver.findElement(By.css('.login')).getAttribute('value');
if (elementText === expectedLoginButtonText)
{console.log('Passed: Login button text matched as expected');}
else
{console.log(`FAILED: Expected: "${expectedLoginButtonText}"; Actual: "${elementText}"`);}
}
},
//Login button background color
{ description: 'Validate Login button background color', action: async () =>
{ const elementStyle = await driver.findElement(By.css('.login')).getCssValue('background-color');
if (elementStyle === expectedLoginButtonColor)
{console.log('Passed: Login button background color matched as expected');}
else
{console.log(`FAILED: Login button background color Expected: "${expectedLoginButtonColor}"; Actual: "${elementStyle}"`);}
}
},
//Don't have an account? text
{ description: 'Validate Dont have account text', action: async () =>
{ const elementText = await driver.findElement(By.css('p:nth-child(1)')).getText();
if (elementText === expectedDontHaveAccountText)
{console.log('Passed: Dont have an account text matched as expected');}
else
{console.log(`FAILED: Expected: "${expectedDontHaveAccountText}"; Actual: "${elementText}"`);}
}
},
//Free trial button text
{ description: 'Validate Free trial button text', action: async () =>
{ const elementText = await driver.findElement(By.css('.btn > span')).getText();//attribute
if (elementText === expectedFreeTrialButtonText)
{console.log('Passed: Free trial button text matched as expected');}
else
{console.log(`FAILED: Expected: "${expectedFreeTrialButtonText}"; Actual: "${elementText}"`);}
}
},
//Free trial button background color
{ description: 'Validate Free trial button background color', action: async () =>
{ const elementStyle = await driver.findElement(By.css('.btn > span')).getCssValue('background-color');
if (elementStyle === expectedFreeTrialButtonColor)
{console.log('Passed: Free trial button background color matched as expected');}
else
{console.log(`FAILED: Free trial button background color Expected: "${expectedFreeTrialButtonColor}"; Actual: "${elementStyle}"`);}
}
},
//EdGate copyright image
{ description: 'Verify EdGate copyright image is present', action: async () =>
{ const expectedEdGateCopyright = await driver.wait(until.elementLocated(By.css('.logincopyright > img')), 5000).catch(() => false);
if (expectedEdGateCopyright)
{console.log('Passed: EdGate copyright image present');}
else
{console.log('FAILED: EdGate copyright not found');}
}
},
//Validation
{ description: 'Click Login button', action: async () => await driver.findElement(By.css('.login')).click() },
/*
{ description: 'Enter username', action: async () => await driver.findElement(By.id('txtU')).sendKeys('gnight147', Key.RETURN) },
{ description: 'Wait for password field to be present', action: async () => await driver.sleep(3000) },
@@ -201,23 +478,14 @@ try {
}
}
// Check if landing page test was successful
const loginButton = await driver.wait(until.elementLocated(By.css('.login')), 5000).catch(() => false);
//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);
if (loginButton) {
console.log('Login button present');
if (usernameValidation) {
console.log('Passed: Username validation');
testStatus = 'Passed';
} else {
console.log('Login button not found');
}
const freeTialButton = await driver.wait(until.elementLocated(By.css('.btn > span')), 5000).catch(() => false);
if (freeTialButton) {
console.log('Free Trial button present');
testStatus = 'Passed';
} else {
console.log('Free Trial button not found');
console.log('FAILED: Username validation not triggered');
}
// Log test end time