Updated Excel sheet code
This commit is contained in:
Binary file not shown.
@@ -65,358 +65,426 @@ const steps = [
|
|||||||
//LEFT PANEL
|
//LEFT PANEL
|
||||||
//Title text
|
//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: '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 () =>
|
|
||||||
|
{
|
||||||
|
description: 'Validate title text',
|
||||||
|
action: async () =>
|
||||||
{ const elementText = await driver.findElement(By.css('h2:nth-child(1)')).getText();
|
{ const elementText = await driver.findElement(By.css('h2:nth-child(1)')).getText();
|
||||||
if (elementText === expectedTitleText)
|
if (elementText !== expectedTitleText) {
|
||||||
{console.log('Passed: Title text matched as expected');}
|
throw new Error(`Expected: "${expectedTitleText}"; Actual: "${elementText}"`);
|
||||||
else
|
}
|
||||||
{console.log(`FAILED: Expected: "${expectedTitleText}"; Actual: "${elementText}"`);}
|
console.log('Passed: Title text matched as expected');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
//Title text font
|
//Title text font
|
||||||
{ description: 'Validate Title text font size', action: async () =>
|
{
|
||||||
|
description: 'Validate Title text font size',
|
||||||
|
action: async () =>
|
||||||
{ const elementStyle = await driver.findElement(By.css('h2:nth-child(3)')).getCssValue('font-size');
|
{ const elementStyle = await driver.findElement(By.css('h2:nth-child(3)')).getCssValue('font-size');
|
||||||
if (elementStyle === expectedTitleFont)
|
if (elementStyle !== expectedTitleFont) {
|
||||||
{console.log('Passed: Title text font-size matched as expected');}
|
throw new Error(`Title text font-size Expected: "${expectedTitleFont}"; Actual: "${elementStyle}"`);
|
||||||
else
|
}
|
||||||
{console.log(`FAILED: Title text font-size Expected: "${expectedTitleFont}"; Actual: "${elementStyle}"`);}
|
console.log('Passed: Title text font-size matched as expected');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
//Descriptive text 1
|
//Descriptive text 1
|
||||||
{ description: 'Validate descriptive text 1', action: async () =>
|
{
|
||||||
|
description: 'Validate descriptive text 1',
|
||||||
|
action: async () =>
|
||||||
{ const elementText = await driver.findElement(By.css('.content-inner > p:nth-child(2)')).getText();
|
{ const elementText = await driver.findElement(By.css('.content-inner > p:nth-child(2)')).getText();
|
||||||
if (elementText === expectedDescriptiveText1)
|
if (elementText !== expectedDescriptiveText1) {
|
||||||
{console.log('Passed: Descriptive text 1 matched as expected');}
|
throw new Error(`Expected: "${expectedDescriptiveText1}"; Actual: "${elementText}"`);
|
||||||
else
|
}
|
||||||
{console.log(`FAILED: Expected: "${expectedDescriptiveText1}"; Actual: "${elementText}"`);}
|
console.log('Passed: Descriptive text 1 matched as expected');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
//Descriptive text 2
|
//Descriptive text 2
|
||||||
{ description: 'Validate descriptive text 2', action: async () =>
|
{
|
||||||
|
description: 'Validate descriptive text 2',
|
||||||
|
action: async () =>
|
||||||
{ const elementText = await driver.findElement(By.css('p:nth-child(3)')).getText();
|
{ const elementText = await driver.findElement(By.css('p:nth-child(3)')).getText();
|
||||||
if (elementText === expectedDescriptiveText2)
|
if (elementText !== expectedDescriptiveText2) {
|
||||||
{console.log('Passed: Descriptive text 2 matched as expected');}
|
throw new Error(`Expected: "${expectedDescriptiveText2}"; Actual: "${elementText}"`);
|
||||||
else
|
}
|
||||||
{console.log(`FAILED: Expected: "${expectedDescriptiveText2}"; Actual: "${elementText}"`);}
|
console.log('Passed: Descriptive text 2 matched as expected');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
//Sign Up text
|
//Sign Up text
|
||||||
{ description: 'Validate sign up text', action: async () =>
|
{
|
||||||
|
description: 'Validate sign up text',
|
||||||
|
action: async () =>
|
||||||
{ const elementText = await driver.findElement(By.css('h4')).getText();
|
{ const elementText = await driver.findElement(By.css('h4')).getText();
|
||||||
if (elementText === expectedSignUpText)
|
if (elementText !== expectedSignUpText) {
|
||||||
{console.log('Passed: Sign up text matched as expected');}
|
throw new Error(`Expected: "${expectedSignUpText}"; Actual: "${elementText}"`);
|
||||||
else
|
}
|
||||||
{console.log(`FAILED: Expected: "${expectedSignUpText}"; Actual: "${elementText}"`);}
|
console.log('Passed: Sign up text matched as expected');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
//Free trial link text color
|
//Free trial link text color
|
||||||
{ description: 'Validate free trial link color', action: async () =>
|
{
|
||||||
|
description: 'Validate free trial link color',
|
||||||
|
action: async () =>
|
||||||
{ const elementStyle = await driver.findElement(By.linkText('30 Day Free Trial')).getCssValue('color');
|
{ const elementStyle = await driver.findElement(By.linkText('30 Day Free Trial')).getCssValue('color');
|
||||||
if (elementStyle === expectedFreeTrialLinkColor)
|
if (elementStyle !== expectedFreeTrialLinkColor) {
|
||||||
{console.log('Passed: Free trial link text color matched as expected');}
|
throw new Error(`Free trial link text color Expected: "${expectedFreeTrialLinkColor}"; Actual: "${elementStyle}"`);
|
||||||
else
|
}
|
||||||
{console.log(`FAILED: Free trial link text color Expected: "${expectedFreeTrialLinkColor}"; Actual: "${elementStyle}"`);}
|
console.log('Passed: Free trial link text color matched as expected');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
//Bullet Point Icon 1
|
//Bullet Point Icon 1
|
||||||
{ description: 'Verify bullet point icon 1 is present', action: async () =>
|
{
|
||||||
|
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);
|
{ const expectedbulletPointIcon = await driver.wait(until.elementLocated(By.css('li:nth-child(1) img')), 5000).catch(() => false);
|
||||||
if (expectedbulletPointIcon)
|
if (!expectedbulletPointIcon) {
|
||||||
{console.log('Passed: Bullet Point Icon 1 present');}
|
throw new Error('Bullet Point Icon 1 not found');
|
||||||
else
|
}
|
||||||
{console.log('FAILED: Bullet Point Icon 1 not found');}
|
console.log('Passed: Bullet Point Icon 1 present');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
//Bullet Point 1 text
|
//Bullet Point 1 text
|
||||||
{ description: 'Validate bullet point 1 text', action: async () =>
|
{
|
||||||
|
description: 'Validate bullet point 1 text',
|
||||||
|
action: async () =>
|
||||||
{ const elementText = await driver.findElement(By.css('li:nth-child(1) > .list-flex')).getText();
|
{ const elementText = await driver.findElement(By.css('li:nth-child(1) > .list-flex')).getText();
|
||||||
if (elementText === expectedBulletPointText1)
|
if (elementText !== expectedBulletPointText1) {
|
||||||
{console.log('Passed: Bullet point 1 text matched as expected');}
|
throw new Error(`Expected: "${expectedBulletPointText1}"; Actual: "${elementText}"`);
|
||||||
else
|
}
|
||||||
{console.log(`FAILED: Expected: "${expectedBulletPointText1}"; Actual: "${elementText}"`);}
|
console.log('Passed: Bullet point 1 text matched as expected');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
//Bullet Point link 1 text color
|
//Bullet Point link 1 text color
|
||||||
{ description: 'Validate bullet point link 1 text color', action: async () =>
|
{
|
||||||
|
description: 'Validate bullet point link 1 text color',
|
||||||
|
action: async () =>
|
||||||
{ const elementStyle = await driver.findElement(By.linkText('ExACT AutoAlign,')).getCssValue('color');
|
{ const elementStyle = await driver.findElement(By.linkText('ExACT AutoAlign,')).getCssValue('color');
|
||||||
if (elementStyle === expectedBulletPointLinkColor1)
|
if (elementStyle !== expectedBulletPointLinkColor1) {
|
||||||
{console.log('Passed: Bullet point link 1 text color matched as expected');}
|
throw new Error(`Bullet point link 1 text color Expected: "${expectedBulletPointLinkColor1}"; Actual: "${elementStyle}"`);
|
||||||
else
|
}
|
||||||
{console.log(`FAILED: Bullet point link 1 text color Expected: "${expectedBulletPointLinkColor1}"; Actual: "${elementStyle}"`);}
|
console.log('Passed: Bullet point link 1 text color matched as expected');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
//Bullet Point Icon 2
|
//Bullet Point Icon 2
|
||||||
{ description: 'Verify bullet point icon 2 is present', action: async () =>
|
{
|
||||||
|
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);
|
{ const expectedbulletPointIcon = await driver.wait(until.elementLocated(By.css('li:nth-child(2) img')), 5000).catch(() => false);
|
||||||
if (expectedbulletPointIcon)
|
if (!expectedbulletPointIcon) {
|
||||||
{console.log('Passed: Bullet Point Icon 2 present');}
|
throw new Error('Bullet Point Icon 2 not found');
|
||||||
else
|
}
|
||||||
{console.log('FAILED: Bullet Point Icon 2 not found');}
|
console.log('Passed: Bullet Point Icon 2 present');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
//Bullet Point 2 text
|
//Bullet Point 2 text
|
||||||
{ description: 'Validate bullet point 2 text', action: async () =>
|
{
|
||||||
|
description: 'Validate bullet point 2 text',
|
||||||
|
action: async () =>
|
||||||
{ const elementText = await driver.findElement(By.css('li:nth-child(2) > .list-flex')).getText();
|
{ const elementText = await driver.findElement(By.css('li:nth-child(2) > .list-flex')).getText();
|
||||||
if (elementText === expectedBulletPointText2)
|
if (elementText !== expectedBulletPointText2) {
|
||||||
{console.log('Passed: Bullet point 2 text matched as expected');}
|
throw new Error(`Expected: "${expectedBulletPointText2}"; Actual: "${elementText}"`);
|
||||||
else
|
}
|
||||||
{console.log(`FAILED: Expected: "${expectedBulletPointText2}"; Actual: "${elementText}"`);}
|
console.log('Passed: Bullet point 2 text matched as expected');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
//Bullet Point link 2 text color
|
//Bullet Point link 2 text color
|
||||||
{ description: 'Validate bullet point link 2 text color', action: async () =>
|
{
|
||||||
|
description: 'Validate bullet point link 2 text color',
|
||||||
|
action: async () =>
|
||||||
{ const elementStyle = await driver.findElement(By.linkText('Correlation Analytics.')).getCssValue('color');
|
{ const elementStyle = await driver.findElement(By.linkText('Correlation Analytics.')).getCssValue('color');
|
||||||
if (elementStyle === expectedBulletPointLinkColor2)
|
if (elementStyle !== expectedBulletPointLinkColor2) {
|
||||||
{console.log('Passed: Bullet point link 2 text color matched as expected');}
|
throw new Error(`Bullet point link 2 text color Expected: "${expectedBulletPointLinkColor2}"; Actual: "${elementStyle}"`);
|
||||||
else
|
}
|
||||||
{console.log(`FAILED: Bullet point link 2 text color Expected: "${expectedBulletPointLinkColor2}"; Actual: "${elementStyle}"`);}
|
console.log('Passed: Bullet point link 2 text color matched as expected');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
//Bullet Point Icon 3
|
//Bullet Point Icon 3
|
||||||
{ description: 'Verify bullet point icon 3 is present', action: async () =>
|
{
|
||||||
|
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);
|
{ const expectedbulletPointIcon = await driver.wait(until.elementLocated(By.css('li:nth-child(3) img')), 5000).catch(() => false);
|
||||||
if (expectedbulletPointIcon)
|
if (!expectedbulletPointIcon) {
|
||||||
{console.log('Passed: Bullet Point Icon 3 present');}
|
throw new Error('Bullet Point Icon 3 not found');
|
||||||
else
|
}
|
||||||
{console.log('FAILED: Bullet Point Icon 3 not found');}
|
console.log('Passed: Bullet Point Icon 3 present');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
//Bullet Point 3 text
|
//Bullet Point 3 text
|
||||||
{ description: 'Validate bullet point 3 text', action: async () =>
|
{
|
||||||
|
description: 'Validate bullet point 3 text',
|
||||||
|
action: async () =>
|
||||||
{ const elementText = await driver.findElement(By.css('li:nth-child(3) > .list-flex')).getText();
|
{ const elementText = await driver.findElement(By.css('li:nth-child(3) > .list-flex')).getText();
|
||||||
if (elementText === expectedBulletPointText3)
|
if (elementText !== expectedBulletPointText3) {
|
||||||
{console.log('Passed: Bullet point 3 text matched as expected');}
|
throw new Error(`Expected: "${expectedBulletPointText3}"; Actual: "${elementText}"`);
|
||||||
else
|
}
|
||||||
{console.log(`FAILED: Expected: "${expectedBulletPointText3}"; Actual: "${elementText}"`);}
|
console.log('Passed: Bullet point 3 text matched as expected');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
//Bullet Point link 3 text color
|
//Bullet Point link 3 text color
|
||||||
{ description: 'Validate bullet point link 3 text color', action: async () =>
|
{
|
||||||
|
description: 'Validate bullet point link 3 text color',
|
||||||
|
action: async () =>
|
||||||
{ const elementStyle = await driver.findElement(By.linkText('International Standards.')).getCssValue('color');
|
{ const elementStyle = await driver.findElement(By.linkText('International Standards.')).getCssValue('color');
|
||||||
if (elementStyle === expectedBulletPointLinkColor3)
|
if (elementStyle !== expectedBulletPointLinkColor3) {
|
||||||
{console.log('Passed: Bullet point link 3 text color matched as expected');}
|
throw new Error(`Bullet point link 3 text color Expected: "${expectedBulletPointLinkColor3}"; Actual: "${elementStyle}"`);
|
||||||
else
|
}
|
||||||
{console.log(`FAILED: Bullet point link 3 text color Expected: "${expectedBulletPointLinkColor3}"; Actual: "${elementStyle}"`);}
|
console.log('Passed: Bullet point link 3 text color matched as expected');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
//RIGHT PANEL
|
//RIGHT PANEL
|
||||||
//ExACT logo
|
//ExACT logo
|
||||||
{ description: 'Verify ExACT logo is present', action: async () =>
|
{
|
||||||
{ const expectedExactLogo = await driver.wait(until.elementLocated(By.css('.logo')), 5000).catch(() => false);
|
description: 'Verify ExACT logo is present',
|
||||||
if (expectedExactLogo)
|
action: async () => {
|
||||||
{console.log('Passed: ExACT logo present');}
|
const expectedExactLogo = await driver.wait(until.elementLocated(By.css('.logo')), 5000).catch(() => false);
|
||||||
else
|
if (!expectedExactLogo) {
|
||||||
{console.log('FAILED: ExACT logo not found');}
|
throw new Error('ExACT logo not found');
|
||||||
|
}
|
||||||
|
console.log('Passed: ExACT logo present');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
//Welcome back text
|
//Welcome back text
|
||||||
{ description: 'Validate Welcome back text', action: async () =>
|
{
|
||||||
{ const elementText = await driver.findElement(By.css('#formLogin > p')).getText();
|
description: 'Validate Welcome back text',
|
||||||
if (elementText === expectedWelcomeBackText)
|
action: async () => {
|
||||||
{console.log('Passed: Welcome Back! text matched as expected');}
|
const elementText = await driver.findElement(By.css('#formLogin > p')).getText();
|
||||||
else
|
if (elementText !== expectedWelcomeBackText) {
|
||||||
{console.log(`FAILED: Expected: "${expectedWelcomeBackText}"; Actual: "${elementText}"`);}
|
throw new Error(`Expected: "${expectedWelcomeBackText}"; Actual: "${elementText}"`);
|
||||||
|
}
|
||||||
|
console.log('Passed: Welcome Back! text matched as expected');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
//Welcome back text color
|
//Welcome back text color
|
||||||
{ description: 'Validate Welcome back text color', action: async () =>
|
{
|
||||||
{ const elementStyle = await driver.findElement(By.css('#formLogin > p')).getCssValue('color');
|
description: 'Validate Welcome back text color',
|
||||||
if (elementStyle === expectedWelcomeBackColor)
|
action: async () => {
|
||||||
{console.log('Passed: Welcome back text color matched as expected');}
|
const elementStyle = await driver.findElement(By.css('#formLogin > p')).getCssValue('color');
|
||||||
else
|
if (elementStyle !== expectedWelcomeBackColor) {
|
||||||
{console.log(`FAILED: Welcome back text color Expected: "${expectedWelcomeBackColor}"; Actual: "${elementStyle}"`);}
|
throw new Error(`Welcome back text color Expected: "${expectedWelcomeBackColor}"; Actual: "${elementStyle}"`);
|
||||||
|
}
|
||||||
|
console.log('Passed: Welcome back text color matched as expected');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
//Welcome back icon
|
//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);
|
description: 'Verify Welcome back icon is present',
|
||||||
if (expectedWelcomeBackIcon)
|
action: async () => {
|
||||||
{console.log('Passed: Welcome back icon present');}
|
const expectedWelcomeBackIcon = await driver.wait(until.elementLocated(By.css('p > img')), 5000).catch(() => false);
|
||||||
else
|
if (!expectedWelcomeBackIcon) {
|
||||||
{console.log('FAILED: Welcome back icon not found');}
|
throw new Error('Welcome back icon not found');
|
||||||
|
}
|
||||||
|
console.log('Passed: Welcome back icon present');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
//Login title text
|
//Login title text
|
||||||
{ description: 'Validate Login title text', action: async () =>
|
{
|
||||||
{ const elementText = await driver.findElement(By.css('h2:nth-child(3)')).getText();
|
description: 'Validate Login title text',
|
||||||
if (elementText === expectedLoginTitleText)
|
action: async () => {
|
||||||
{console.log('Passed: Login title text matched as expected');}
|
const elementText = await driver.findElement(By.css('h2:nth-child(3)')).getText();
|
||||||
else
|
if (elementText !== expectedLoginTitleText) {
|
||||||
{console.log(`FAILED: Expected: "${expectedLoginTitleText}"; Actual: "${elementText}"`);}
|
throw new Error(`Expected: "${expectedLoginTitleText}"; Actual: "${elementText}"`);
|
||||||
|
}
|
||||||
|
console.log('Passed: Login title text matched as expected');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
//Login title text color
|
//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');
|
description: 'Validate Login title text color',
|
||||||
if (elementStyle === expectedLoginTitleColor)
|
action: async () => {
|
||||||
{console.log('Passed: Login title text color matched as expected');}
|
const elementStyle = await driver.findElement(By.css('h2:nth-child(3)')).getCssValue('color');
|
||||||
else
|
if (elementStyle !== expectedLoginTitleColor) {
|
||||||
{console.log(`FAILED: Login title text color Expected: "${expectedLoginTitleColor}"; Actual: "${elementStyle}"`);}
|
throw new Error(`Login title text color Expected: "${expectedLoginTitleColor}"; Actual: "${elementStyle}"`);
|
||||||
|
}
|
||||||
|
console.log('Passed: Login title text color matched as expected');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
//Login title text font
|
//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');
|
description: 'Validate Login title text font size',
|
||||||
if (elementStyle === expectedLoginTitleFont)
|
action: async () => {
|
||||||
{console.log('Passed: Login title text font-size matched as expected');}
|
const elementStyle = await driver.findElement(By.css('h2:nth-child(3)')).getCssValue('font-size');
|
||||||
else
|
if (elementStyle !== expectedLoginTitleFont) {
|
||||||
{console.log(`FAILED: Login title text font-size Expected: "${expectedLoginTitleFont}"; Actual: "${elementStyle}"`);}
|
throw new Error(`Login title text font-size Expected: "${expectedLoginTitleFont}"; Actual: "${elementStyle}"`);
|
||||||
|
}
|
||||||
|
console.log('Passed: Login title text font-size matched as expected');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
//Username label text
|
//Username label text
|
||||||
{ description: 'Validate Username label text', action: async () =>
|
{
|
||||||
{ const elementText = await driver.findElement(By.css('.form-group:nth-child(4) > label')).getText();
|
description: 'Validate Username label text',
|
||||||
if (elementText === expectedUsernameLabel)
|
action: async () => {
|
||||||
{console.log('Passed: Username label text matched as expected');}
|
const elementText = await driver.findElement(By.css('.form-group:nth-child(4) > label')).getText();
|
||||||
else
|
if (elementText !== expectedUsernameLabel) {
|
||||||
{console.log(`FAILED: Expected: "${expectedUsernameLabel}"; Actual: "${elementText}"`);}
|
throw new Error(`Expected: "${expectedUsernameLabel}"; Actual: "${elementText}"`);
|
||||||
|
}
|
||||||
|
console.log('Passed: Username label text matched as expected');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
//Username label text color
|
//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');
|
description: 'Validate Username label text color',
|
||||||
if (elementStyle === expectedUsernameColor)
|
action: async () => {
|
||||||
{console.log('Passed: Username label text color matched as expected');}
|
const elementStyle = await driver.findElement(By.css('.form-group:nth-child(4) > label')).getCssValue('color');
|
||||||
else
|
if (elementStyle !== expectedUsernameColor) {
|
||||||
{console.log(`FAILED: Username label text color Expected: "${expectedUsernameColor}"; Actual: "${elementStyle}"`);}
|
throw new Error(`Username label text color Expected: "${expectedUsernameColor}"; Actual: "${elementStyle}"`);
|
||||||
|
}
|
||||||
|
console.log('Passed: Username label text color matched as expected');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
//Username textbox placeholder
|
//Username textbox placeholder
|
||||||
{ description: 'Validate Username placeholder text', action: async () =>
|
{
|
||||||
{ const elementValue = await driver.findElement(By.css('.form-control:nth-child(2)')).getAttribute('placeholder');
|
description: 'Validate Username placeholder text',
|
||||||
if (elementValue === expectedUsernamePlaceholder)
|
action: async () => {
|
||||||
{console.log('Passed: Username placeholder text matched as expected');}
|
const elementValue = await driver.findElement(By.css('.form-control:nth-child(2)')).getAttribute('placeholder');
|
||||||
else
|
if (elementValue !== expectedUsernamePlaceholder) {
|
||||||
{console.log(`FAILED: Username placeholder text Expected: "${expectedUsernamePlaceholder}"; Actual: "${elementValue}"`);}
|
throw new Error(`Username placeholder text Expected: "${expectedUsernamePlaceholder}"; Actual: "${elementValue}"`);
|
||||||
|
}
|
||||||
|
console.log('Passed: Username placeholder text matched as expected');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
//Password label text
|
//Password label text
|
||||||
{ description: 'Validate Password label text', action: async () =>
|
{
|
||||||
{ const elementText = await driver.findElement(By.css('.form-group:nth-child(5) > label')).getText();
|
description: 'Validate Password label text',
|
||||||
if (elementText === expectedPasswordLabel)
|
action: async () => {
|
||||||
{console.log('Passed: Password label text matched as expected');}
|
const elementText = await driver.findElement(By.css('.form-group:nth-child(5) > label')).getText();
|
||||||
else
|
if (elementText !== expectedPasswordLabel) {
|
||||||
{console.log(`FAILED: Expected: "${expectedPasswordLabel}"; Actual: "${elementText}"`);}
|
throw new Error(`Expected: "${expectedPasswordLabel}"; Actual: "${elementText}"`);
|
||||||
|
}
|
||||||
|
console.log('Passed: Password label text matched as expected');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
//Password label text color
|
//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');
|
description: 'Validate Password label text color',
|
||||||
if (elementStyle === expectedPasswordColor)
|
action: async () => {
|
||||||
{console.log('Passed: Password label text color matched as expected');}
|
const elementStyle = await driver.findElement(By.css('.form-group:nth-child(5) > label')).getCssValue('color');
|
||||||
else
|
if (elementStyle !== expectedPasswordColor) {
|
||||||
{console.log(`FAILED: Password label text color Expected: "${expectedPasswordColor}"; Actual: "${elementStyle}"`);}
|
throw new Error(`Password label text color Expected: "${expectedPasswordColor}"; Actual: "${elementStyle}"`);
|
||||||
|
}
|
||||||
|
console.log('Passed: Password label text color matched as expected');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
//Password textbox placeholder
|
//Password textbox placeholder
|
||||||
{ description: 'Validate Password placeholder text', action: async () =>
|
{
|
||||||
{ const elementValue = await driver.findElement(By.css('.passfield')).getAttribute('placeholder');
|
description: 'Validate Password placeholder text',
|
||||||
if (elementValue === expectedPasswordPlaceholder)
|
action: async () => {
|
||||||
{console.log('Passed: Password placeholder text matched as expected');}
|
const elementValue = await driver.findElement(By.css('.passfield')).getAttribute('placeholder');
|
||||||
else
|
if (elementValue !== expectedPasswordPlaceholder) {
|
||||||
{console.log(`FAILED: Password placeholder text Expected: "${expectedPasswordPlaceholder}"; Actual: "${elementValue}"`);}
|
throw new Error(`Password placeholder text Expected: "${expectedPasswordPlaceholder}"; Actual: "${elementValue}"`);
|
||||||
|
}
|
||||||
|
console.log('Passed: Password placeholder text matched as expected');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
//Forgot password text link color
|
//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');
|
description: 'Validate Forgot Password link text color',
|
||||||
if (elementStyle === expectedForgotPasswordLinkColor)
|
action: async () => {
|
||||||
{console.log('Passed: Forgot password link text color matched as expected');}
|
const elementStyle = await driver.findElement(By.linkText('Forgot Password?')).getCssValue('color');
|
||||||
else
|
if (elementStyle !== expectedForgotPasswordLinkColor) {
|
||||||
{console.log(`FAILED: Forgot password link text color Expected: "${expectedForgotPasswordLinkColor}"; Actual: "${elementStyle}"`);}
|
throw new Error(`Forgot password link text color Expected: "${expectedForgotPasswordLinkColor}"; Actual: "${elementStyle}"`);
|
||||||
|
}
|
||||||
|
console.log('Passed: Forgot password link text color matched as expected');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
//Login button text
|
//Login button text
|
||||||
{ description: 'Validate Login button text', action: async () =>
|
{
|
||||||
{ const elementText = await driver.findElement(By.css('.login')).getAttribute('value');
|
description: 'Validate Login button text',
|
||||||
if (elementText === expectedLoginButtonText)
|
action: async () => {
|
||||||
{console.log('Passed: Login button text matched as expected');}
|
const elementText = await driver.findElement(By.css('.login')).getAttribute('value');
|
||||||
else
|
if (elementText !== expectedLoginButtonText) {
|
||||||
{console.log(`FAILED: Expected: "${expectedLoginButtonText}"; Actual: "${elementText}"`);}
|
throw new Error(`Expected: "${expectedLoginButtonText}"; Actual: "${elementText}"`);
|
||||||
|
}
|
||||||
|
console.log('Passed: Login button text matched as expected');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
//Login button background color
|
//Login button background color
|
||||||
{ description: 'Validate Login button background color', action: async () =>
|
{
|
||||||
{ const elementStyle = await driver.findElement(By.css('.login')).getCssValue('background-color');
|
description: 'Validate Login button background color',
|
||||||
if (elementStyle === expectedLoginButtonColor)
|
action: async () => {
|
||||||
{console.log('Passed: Login button background color matched as expected');}
|
const elementStyle = await driver.findElement(By.css('.login')).getCssValue('background-color');
|
||||||
else
|
if (elementStyle !== expectedLoginButtonColor) {
|
||||||
{console.log(`FAILED: Login button background color Expected: "${expectedLoginButtonColor}"; Actual: "${elementStyle}"`);}
|
throw new Error(`Login button background color Expected: "${expectedLoginButtonColor}"; Actual: "${elementStyle}"`);
|
||||||
|
}
|
||||||
|
console.log('Passed: Login button background color matched as expected');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
//Don't have an account? text
|
//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();
|
description: 'Validate Dont have account text',
|
||||||
if (elementText === expectedDontHaveAccountText)
|
action: async () => {
|
||||||
{console.log('Passed: Dont have an account text matched as expected');}
|
const elementText = await driver.findElement(By.css('p:nth-child(1)')).getText();
|
||||||
else
|
if (elementText !== expectedDontHaveAccountText) {
|
||||||
{console.log(`FAILED: Expected: "${expectedDontHaveAccountText}"; Actual: "${elementText}"`);}
|
throw new Error(`Expected: "${expectedDontHaveAccountText}"; Actual: "${elementText}"`);
|
||||||
|
}
|
||||||
|
console.log('Passed: Dont have an account text matched as expected');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
//Free trial button text
|
//Free trial button text
|
||||||
{ description: 'Validate Free trial button text', action: async () =>
|
{
|
||||||
{ const elementText = await driver.findElement(By.css('.btn > span')).getText();//attribute
|
description: 'Validate Free trial button text',
|
||||||
if (elementText === expectedFreeTrialButtonText)
|
action: async () => {
|
||||||
{console.log('Passed: Free trial button text matched as expected');}
|
const elementText = await driver.findElement(By.css('.btn > span')).getText();
|
||||||
else
|
if (elementText !== expectedFreeTrialButtonText) {
|
||||||
{console.log(`FAILED: Expected: "${expectedFreeTrialButtonText}"; Actual: "${elementText}"`);}
|
throw new Error(`Expected: "${expectedFreeTrialButtonText}"; Actual: "${elementText}"`);
|
||||||
|
}
|
||||||
|
console.log('Passed: Free trial button text matched as expected');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
//Free trial button background color
|
//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');
|
description: 'Validate Free trial button background color',
|
||||||
if (elementStyle === expectedFreeTrialButtonColor)
|
action: async () => {
|
||||||
{console.log('Passed: Free trial button background color matched as expected');}
|
const elementStyle = await driver.findElement(By.css('.btn > span')).getCssValue('background-color');
|
||||||
else
|
if (elementStyle !== expectedFreeTrialButtonColor) {
|
||||||
{console.log(`FAILED: Free trial button background color Expected: "${expectedFreeTrialButtonColor}"; Actual: "${elementStyle}"`);}
|
throw new Error(`Free trial button background color Expected: "${expectedFreeTrialButtonColor}"; Actual: "${elementStyle}"`);
|
||||||
|
}
|
||||||
|
console.log('Passed: Free trial button background color matched as expected');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
//EdGate copyright image
|
//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);
|
description: 'Verify EdGate copyright image is present',
|
||||||
if (expectedEdGateCopyright)
|
action: async () => {
|
||||||
{console.log('Passed: EdGate copyright image present');}
|
const expectedEdGateCopyright = await driver.wait(until.elementLocated(By.css('.logincopyright > img')), 5000).catch(() => false);
|
||||||
else
|
if (!expectedEdGateCopyright) {
|
||||||
{console.log('FAILED: EdGate copyright not found');}
|
throw new Error('EdGate copyright not found');
|
||||||
|
}
|
||||||
|
console.log('Passed: EdGate copyright image present');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
//Validation
|
|
||||||
{ description: 'Click Login button', action: async () => await driver.findElement(By.css('.login')).click() },
|
|
||||||
];
|
];
|
||||||
|
|
||||||
const logStep = (worksheet, stepDescription, status, stepIndex, timestamp, screenshotPath) => {
|
const logStep = (worksheet, stepDescription, status, stepIndex, timestamp, screenshotPath) => {
|
||||||
@@ -428,31 +496,37 @@ const logStep = (worksheet, stepDescription, status, stepIndex, timestamp, scree
|
|||||||
const takeScreenshot = async (driver, stepIndex, stepDescription) => {
|
const takeScreenshot = async (driver, stepIndex, stepDescription) => {
|
||||||
const screenshot = await driver.takeScreenshot();
|
const screenshot = await driver.takeScreenshot();
|
||||||
|
|
||||||
const dir = path.join('screenshots', 'landingPageScript');
|
const dir = path.join('screenshots', 'landingPage');
|
||||||
if (!fs.existsSync(dir)) {
|
|
||||||
fs.mkdirSync(dir, { recursive: true });
|
|
||||||
}
|
|
||||||
|
|
||||||
const screenshotFileName = `step_${stepIndex}_${stepDescription.replace(/\s+/g, '_')}.png`;
|
const screenshotFileName = `step_${stepIndex}_${stepDescription.replace(/\s+/g, '_')}.png`;
|
||||||
const screenshotPath = path.join(dir, screenshotFileName);
|
const screenshotPath = path.join(dir, screenshotFileName);
|
||||||
fs.writeFileSync(screenshotPath, screenshot, 'base64');
|
fs.writeFileSync(screenshotPath, screenshot, 'base64');
|
||||||
return screenshotPath;
|
return screenshotPath;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const clearOldResults = () => {
|
||||||
|
// Remove old screenshots
|
||||||
|
const screenshotDir = path.join('screenshots', 'landingPage');
|
||||||
|
if (fs.existsSync(screenshotDir)) {
|
||||||
|
fs.rmSync(screenshotDir, { recursive: true, force: true });
|
||||||
|
}
|
||||||
|
fs.mkdirSync(screenshotDir, { recursive: true });
|
||||||
|
|
||||||
|
// Remove old Excel file
|
||||||
|
if (fs.existsSync('landingPageResults.xlsx')) {
|
||||||
|
fs.unlinkSync('landingPageResults.xlsx');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// Initialize workbook and worksheet
|
// Initialize workbook and worksheet
|
||||||
if (!fs.existsSync('landingPageResults.xlsx')) {
|
clearOldResults();
|
||||||
|
|
||||||
|
// Initialize workbook and worksheet
|
||||||
workbook = XLSX.utils.book_new();
|
workbook = XLSX.utils.book_new();
|
||||||
worksheet = XLSX.utils.aoa_to_sheet([
|
worksheet = XLSX.utils.aoa_to_sheet([
|
||||||
['Step Number', 'Step Description', 'Status', 'Timestamp', 'Screenshot']
|
['Step Number', 'Step Description', 'Status', 'Timestamp', 'Screenshot']
|
||||||
]);
|
]);
|
||||||
XLSX.utils.book_append_sheet(workbook, worksheet, 'Sheet1');
|
XLSX.utils.book_append_sheet(workbook, worksheet, 'Sheet1');
|
||||||
XLSX.writeFile(workbook, 'landingPageResults.xlsx');
|
|
||||||
} else {
|
|
||||||
workbook = XLSX.readFile('landingPageResults.xlsx', { cellStyles: true });
|
|
||||||
const sheetName = workbook.SheetNames[0];
|
|
||||||
worksheet = workbook.Sheets[sheetName];
|
|
||||||
}
|
|
||||||
|
|
||||||
// Log test start time
|
// Log test start time
|
||||||
worksheet = logStep(worksheet, 'Test Start', 'Started', '', startTime, '');
|
worksheet = logStep(worksheet, 'Test Start', 'Started', '', startTime, '');
|
||||||
@@ -468,23 +542,25 @@ try {
|
|||||||
} catch (error) {
|
} catch (error) {
|
||||||
const screenshotPath = await takeScreenshot(driver, stepIndex, `${step.description}_Failed`);
|
const screenshotPath = await takeScreenshot(driver, stepIndex, `${step.description}_Failed`);
|
||||||
worksheet = logStep(worksheet, step.description, 'Failed', stepIndex, timestamp, screenshotPath);
|
worksheet = logStep(worksheet, step.description, 'Failed', stepIndex, timestamp, screenshotPath);
|
||||||
throw error; // Re-throw the error to stop further execution if necessary
|
console.error(`Step ${stepIndex} failed: ${error.message}`);
|
||||||
|
testStatus = 'Failed';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Check if landing page username validation was successful
|
//Script completed
|
||||||
const usernameValidation = await driver.wait(until.elementLocated(By.css('.form-group:nth-child(5) > label')), 5000).catch(() => false);
|
const expectedEdGateCopyright = await driver.wait(until.elementLocated(By.css('.logincopyright > img')), 5000).catch(() => false);
|
||||||
|
|
||||||
if (usernameValidation) {
|
if (expectedEdGateCopyright) {
|
||||||
console.log('Passed: Username validation');
|
console.log('PASSED: Script completed');
|
||||||
testStatus = 'Passed';
|
testStatus = 'Passed';
|
||||||
} else {
|
} else {
|
||||||
console.log('FAILED: Username validation not triggered');
|
console.log('FAILED: Script completed');
|
||||||
|
testStatus = 'Failed';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Log test end time
|
// Log test end time
|
||||||
const endTime = new Date().toISOString();
|
const endTime = new Date().toISOString();
|
||||||
worksheet = logStep(worksheet, 'Test End', 'Ended', '', endTime, '');
|
worksheet = logStep(worksheet, 'Test End', testStatus, '', endTime, '');
|
||||||
|
|
||||||
// Write the updated worksheet back to the workbook and save it
|
// Write the updated worksheet back to the workbook and save it
|
||||||
workbook.Sheets['Sheet1'] = worksheet;
|
workbook.Sheets['Sheet1'] = worksheet;
|
||||||
|
|||||||
Reference in New Issue
Block a user