Added additional text checks

This commit is contained in:
2024-10-03 16:12:44 -07:00
parent 323b6ea094
commit 326afca1c6
2 changed files with 118 additions and 9 deletions

View File

@@ -5,7 +5,7 @@ import path from 'path';
import { assert } from 'console';
const ExACT_landingPage = (req, res) => {
res.send('<h2>ExACT Automated Test Script - Landing Page: Excecuted</h2>');
res.send('<h2>ExACT Automated Test Script - Landing Page: Initiated</h2>');
(async function example() {
let driver = await new Builder().forBrowser('chrome').build();
let testStatus = 'Failed';
@@ -14,23 +14,132 @@ const ExACT_landingPage = (req, res) => {
const startTime = new Date().toISOString();
//Text to be verified
const expectedText = 'Empowering publishers with the ability to correlate their unique content to standards.';
const expectedTitleText = 'Empowering publishers with the ability to correlate their unique content to standards.';
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.';
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 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() },
//Descriptive text 1
{ description: 'Wait for descriptive text 1 to be present', action: async () => await driver.wait(until.elementLocated(By.css('h2:nth-child(1)')), 5000) },
{ description: 'Validate descriptive text 1', action: async () =>
{ const elementTitle = await driver.findElement(By.css('h2:nth-child(1)')).getText();
if (elementTitle === expectedText)
{console.log('Title matched as expected, Passed');}
//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');}
else
{console.log(`Title text match FAILED, Expected: "${expectedText}", but found "${elementTitle}"`);}
{console.log(`FAILED: Expected: "${expectedTitleText}", but found "${elementText}"`);}
}
},
//Descriptive text 1
{ description: 'Validate descriptive text 1', action: async () =>
{ const elementText = await driver.findElement(By.css('.content-inner > p:nth-child(2)')).getText();
if (elementText === expectedDescriptiveText1)
{console.log('Passed: Descriptive text 1 matched as expected');}
else
{console.log(`FAILED: Expected: "${expectedDescriptiveText1}", but found "${elementText}"`);}
}
},
//Descriptive text 2
{ description: 'Validate descriptive text 2', action: async () =>
{ const elementText = await driver.findElement(By.css('p:nth-child(3)')).getText();
if (elementText === expectedDescriptiveText2)
{console.log('Passed: Descriptive text 2 matched as expected');}
else
{console.log(`FAILED: Expected: "${expectedDescriptiveText2}", but found "${elementText}"`);}
}
},
//Sign Up text
{ description: 'Validate sign up text', action: async () =>
{ const elementText = await driver.findElement(By.css('h4')).getText();
if (elementText === expectedSignUpText)
{console.log('Passed: Sign up text matched as expected');}
else
{console.log(`FAILED: Expected: "${expectedSignUpText}", but found "${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');}
else
{console.log(`FAILED: Expected: "${expectedFreeTrialLink}", but found "${elementText}"`);}
}
},
//Bullet Point 1
{ description: 'Validate bullet point 1', 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');}
else
{console.log(`FAILED: Expected: "${expectedBulletPoint1}", but found "${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');}
else
{console.log(`FAILED: Expected: "${expectedBulletPointLink1}", but found "${elementText}"`);}
}
},
//Bullet Point 2
{ description: 'Validate bullet point 2', 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');}
else
{console.log(`FAILED: Expected: "${expectedBulletPoint2}", but found "${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');}
else
{console.log(`FAILED: Expected: "${expectedBulletPointLink2}", but found "${elementText}"`);}
}
},
//Bullet Point 3
{ description: 'Validate bullet point 3', 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');}
else
{console.log(`FAILED: Expected: "${expectedBulletPoint3}", but found "${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');}
else
{console.log(`FAILED: Expected: "${expectedBulletPointLink3}", but found "${elementText}"`);}
}
},
/*
{ description: 'Enter username', action: async () => await driver.findElement(By.id('txtU')).sendKeys('gnight147', Key.RETURN) },