From 72bd36bb7757d4c2ba66af91073f57544e543291 Mon Sep 17 00:00:00 2001 From: jhuerta Date: Tue, 7 Apr 2026 13:43:19 -0700 Subject: [PATCH] Revampted script --- tests/ExACT_landingPage.js | 4931 +++++++++++++++++++++++++++++++++--- 1 file changed, 4614 insertions(+), 317 deletions(-) diff --git a/tests/ExACT_landingPage.js b/tests/ExACT_landingPage.js index a4ec2e7..775630e 100644 --- a/tests/ExACT_landingPage.js +++ b/tests/ExACT_landingPage.js @@ -1,4 +1,5 @@ import { Builder, By, Key, until } from 'selenium-webdriver'; +import { Options as ChromeOptions } from 'selenium-webdriver/chrome.js'; import fs from 'fs'; import XLSX from 'xlsx'; import path from 'path'; @@ -6,327 +7,3182 @@ import path from 'path'; const ExACT_landingPage = (req, res) => { res.send('

ExACT Automated Test Script: ExACT Login Page(ExACT_landingPage); Initiated

'); (async function example() { - let driver = await new Builder().forBrowser('chrome').build(); + let driver = await new Builder() + .forBrowser('chrome') + .setChromeOptions( + new ChromeOptions() + .addArguments('--disable-features=MediaRouter') + .addArguments('--disable-extensions') + .addArguments('--disable-background-networking') + .addArguments('--log-level=3') + ) + .build(); let testStatus = 'Failed'; let workbook; let worksheet; const startTime = new Date().toISOString(); -//Left Panel: -//Title -const expectedTitleText = 'Empowering publishers with the ability to correlate their unique content to standards.'; -//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'; -//Bullet Points -const expectedBulletPointText1 = 'Learn more about ExACT AutoAlign, the AI-based alignment tool.'; -const expectedBulletPointText2 = 'See your Correlation Analytics.'; -const expectedBulletPointText3 = 'Explore how your Content maps to International Standards.'; - -//Right Panel: -//Welcome back -const expectedWelcomeBackText = 'WELCOME BACK!'; -//Login -const expectedLoginTitleText = 'Login to your account'; -//Username -const expectedUsernameLabel = 'Username'; - const expectedUsernamePlaceholder = 'Username'; -//Password -const expectedPasswordLabel = 'Password'; - const expectedPasswordPlaceholder = 'Password'; -//Forgot password link -//Login button -const expectedLoginButtonText = 'Login'; -//Don't have account text -const expectedDontHaveAccountText = `DON'T HAVE AN ACCOUNT?`; -//Free trial button -const expectedFreeTrialButtonText = '30 Day'; - const steps = [ { description: 'Navigate to ExACT Landing Page', action: async () => await driver.navigate().to('https://correlation.edgate.com/exact/login.php') }, { description: 'Expand browser', action: async () => await driver.manage().window().maximize() }, - { - description: 'Validate title text', + //Loadig page + { + description: 'Loading Page', action: async () => { //Wait for page to load completely await driver.wait(async () => { const readyState = await driver.executeScript('return document.readyState'); return readyState === 'complete'; - }, 30000, 'ExACT Login Page did not fully load within 30 seconds'); - console.log('---------------->| BEGIN |<----------------'); - console.log('---------->| ExACT Login Page |<---------'); - console.log('Passed: ExACT Login Page loaded successfully'); - } - }, + }, 30000, 'ExACT Landing Page did not fully load within 30 seconds'); + console.log('------------->| BEGIN SCRIPT |<-------------'); + console.log('---------->| ExACT Landing Page |<----------'); - //LEFT PANEL - //Title text - { description: 'Wait for title text to be present', action: async () => await driver.wait(until.elementsLocated(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) { - throw new Error(`Expected: "${expectedTitleText}"; Actual: "${elementText}"`); - } - console.log('Passed: Title text matched as expected'); + //Wait until the element exists in the DOM + const exactLogo = await driver.wait( + until.elementLocated(By.css('.logo')), + 30000 + ); + + //Wait until it becomes visible + await driver.wait( + until.elementIsVisible(exactLogo), + 30000 + ); + + //Wait for page to load completely + await driver.wait(async () => { + const readyState = await driver.executeScript('return document.readyState'); + return readyState === 'complete'; + }, 30000, 'ExACT Langing page did not fully load within 30 seconds'); + console.log('Passed: ExACT Landing Page loaded successfully'); } }, - //Title text font + //Left Panel + //Header Title { - description: 'Validate Title text font size', - action: async () => - { const elementStyle = await driver.findElement(By.css('h2:nth-child(1)')).getCssValue('font-size'); - if (elementStyle !== '32px') { - throw new Error(`Title text font-size did not match; Actual: "${elementStyle}"`); + description: 'Left Panel - Header title text, color, and size', + action: async () => { + const multipleChecks = 'Page title'; + const element = await driver.findElement(By.css('h2:nth-child(1)')); + + //Get text, color, and size + const elementText = await element.getText(); + const elementFont = await element.getCssValue('font-family'); + const elementColor = await element.getCssValue('color'); + const elementSize = await element.getCssValue('font-size'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Empowering publishers with the ability to correlate their unique content to standards.') { + console.log('Passed: Title text matched as expected'); + } else { + errors.push(`Expected: "Empowering publishers with the ability to correlate their unique content to standards."; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === `"DM Serif Display", serif`) { + console.log('Passed: Title font matched as expected'); + } else { + errors.push(`Expected: Title font "DM Serif Display", serif; Actual: ${elementFont}`); + } + + //color -white + if (elementColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Title text color matched as expected'); + } else { + errors.push(`Expected: Title text color "rgba(255, 255, 255, 1)"; Actual: "${elementColor}"`); + } + + //font size + if (elementSize === '32px') { + console.log('Passed: Title text font-size matched as expected'); + } else { + errors.push(`Expected: Title text font-size "32px"; Actual: "${elementSize}"`); + } + + //Throw summary if any validation failed + if (errors.length > 0) { + //Add summary line only when multiple checks failed + if (errors.length > 1) { + errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); + } + + //Throw collected messages — catch() will prefix with "FAILED:" + throw new Error(errors.join('\n')); } - console.log('Passed: Title text font-size matched as expected'); } }, //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) { - throw new Error(`Expected: "${expectedDescriptiveText1}"; Actual: "${elementText}"`); + description: 'Validate Landing page descriptive text 1', + action: async () => { + const multipleChecks = 'Landing page descriptive text 1'; + const element = await driver.findElement(By.css('.content-inner > p:nth-child(2)')); + + //Get text, color, and size + const elementText = await element.getText(); + const elementFont = await element.getCssValue('font-family'); + const elementColor = await element.getCssValue('color'); + const elementSize = await element.getCssValue('font-size'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'The ExACT platform is the education industry’s most trusted source to globally correlate content to standards and produce content alignment reports.') { + console.log('Passed: Descriptive text 1 matched as expected'); + } else { + errors.push(`Expected: "The ExACT platform is the education industry’s most trusted source to globally correlate content to standards and produce content alignment reports."; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Descriptive text 1 text font matched as expected'); + } else { + errors.push(`Expected: Descriptive text 1 text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //color -white + if (elementColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Descriptive text 1 text color matched as expected'); + } else { + errors.push(`Expected: Descriptive text 1 text color "rgba(255, 255, 255, 1)"; Actual: "${elementColor}"`); + } + + //font size + if (elementSize === '14px') { + console.log('Passed: Descriptive text 1 text font-size matched as expected'); + } else { + errors.push(`Expected: Descriptive text 1 text font-size "14px"; Actual: "${elementSize}"`); + } + + //Throw summary if any validation failed + if (errors.length > 0) { + //Add summary line only when multiple checks failed + if (errors.length > 1) { + errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); + } + + //Throw collected messages — catch() will prefix with "FAILED:" + throw new Error(errors.join('\n')); } - console.log('Passed: Descriptive text 1 matched as expected'); } }, //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) { - throw new Error(`Expected: "${expectedDescriptiveText2}"; Actual: "${elementText}"`); + description: 'Validate Landing page descriptive text 2', + action: async () => { + const multipleChecks = 'Landing page descriptive text 2'; + const element = await driver.findElement(By.css('p:nth-child(3)')); + + //Get text, color, and size + const elementText = await element.getText(); + const elementFont = await element.getCssValue('font-family'); + const elementColor = await element.getCssValue('color'); + const elementSize = await element.getCssValue('font-size'); + + //Track all errors + const errors = []; + + //text + if (elementText === '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.') { + console.log('Passed: Descriptive text 2 matched as expected'); + } else { + errors.push(`Expected: "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."; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Descriptive text 2 text font matched as expected'); + } else { + errors.push(`Expected: Descriptive text 2 text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //color -white + if (elementColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Descriptive text 2 text color matched as expected'); + } else { + errors.push(`Expected: Descriptive text 2 text color "rgba(255, 255, 255, 1)"; Actual: "${elementColor}"`); + } + + //font size + if (elementSize === '14px') { + console.log('Passed: Descriptive text 2 text font-size matched as expected'); + } else { + errors.push(`Expected: Descriptive text 2 text font-size "14px"; Actual: "${elementSize}"`); + } + + //Throw summary if any validation failed + if (errors.length > 0) { + //Add summary line only when multiple checks failed + if (errors.length > 1) { + errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); + } + + //Throw collected messages — catch() will prefix with "FAILED:" + throw new Error(errors.join('\n')); } - console.log('Passed: Descriptive text 2 matched as expected'); } }, //Sign Up text { description: 'Validate sign up text', - action: async () => - { const elementText = await driver.findElement(By.css('h4')).getText(); - if (elementText !== expectedSignUpText) { - throw new Error(`Expected: "${expectedSignUpText}"; Actual: "${elementText}"`); + action: async () => { + const multipleChecks = 'Sign Up text'; + const element = await driver.findElement(By.css('h4')); + + //Get text, color, and size + const elementText = await element.getText(); + const elementFont = await element.getCssValue('font-family'); + const elementColor = await element.getCssValue('color'); + const elementSize = await element.getCssValue('font-size'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Sign Up For A 30 Day Free Trial') { + console.log('Passed: Sign up text matched as expected'); + } else { + errors.push(`Expected: "Sign Up For A 30 Day Free Trial"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Sign up text font matched as expected'); + } else { + errors.push(`Expected: Sign up text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //color -white + if (elementColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Sign up text color matched as expected'); + } else { + errors.push(`Expected: Sign up text color "rgba(255, 255, 255, 1)"; Actual: "${elementColor}"`); + } + + //font size + if (elementSize === '20px') { + console.log('Passed: Sign up text font-size matched as expected'); + } else { + errors.push(`Expected: Sign up text text font-size "20px"; Actual: "${elementSize}"`); + } + + //Throw summary if any validation failed + if (errors.length > 0) { + //Add summary line only when multiple checks failed + if (errors.length > 1) { + errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); + } + + //Throw collected messages — catch() will prefix with "FAILED:" + throw new Error(errors.join('\n')); } - console.log('Passed: Sign up text matched as expected'); } }, - //Free trial link text color -red/orange + //Free trial link (START WITH) { - description: 'Validate free trial link color', - action: async () => - { const elementStyle = await driver.findElement(By.linkText('30 Day Free Trial')).getCssValue('color'); - if (elementStyle !== 'rgba(255, 111, 97, 1)') { - throw new Error(`Free trial link text color did not match; Actual: "${elementStyle}"`); + description: 'Validate free trial link', + action: async () => { + const multipleChecks = '30 Day Free Trial link'; + const element = await driver.findElement(By.linkText('30 Day Free Trial')); + + //Get href, text, color, and size + const linkHref = await element.getAttribute('href'); + const elementText = await element.getText(); + const elementFont = await element.getCssValue('font-family'); + const elementColor = await element.getCssValue('color'); + const elementSize = await element.getCssValue('font-size'); + + //Track all errors + const errors = []; + + //href + if (linkHref.startsWith('https://correlation.edgate.com/exact/trial-registration.php')) { + console.log('Passed: 30 Day Free Trail link URL matched as expected'); + } else { + errors.push(`Expected: "https://correlation.edgate.com/exact/trial-registration.php"; Actual: "${linkHref}"`); + } + + //text + if (elementText === '30 Day Free Trial') { + console.log('Passed: Free trial link text matched as expected'); + } else { + errors.push(`Expected: "30 Day Free Trial"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Free trial link text font matched as expected'); + } else { + errors.push(`Expected: Free trial link text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //color -red/orange + if (elementColor === 'rgba(255, 111, 97, 1)') { + console.log('Passed: Free trial link text color matched as expected'); + } else { + errors.push(`Expected: Free trial link text color "rgba(255, 111, 97, 1)"; Actual: "${elementColor}"`); + } + + //font size + if (elementSize === '20px') { + console.log('Passed: Free trial link text font-size matched as expected'); + } else { + errors.push(`Expected: Free trial link text text font-size "20px"; Actual: "${elementSize}"`); + } + + //Throw summary if any validation failed + if (errors.length > 0) { + //Add summary line only when multiple checks failed + if (errors.length > 1) { + errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); + } + + //Throw collected messages — catch() will prefix with "FAILED:" + throw new Error(errors.join('\n')); } - console.log('Passed: Free trial link text color matched as expected'); } }, - //Bullet Point Icon 1 + //NEXT ACTION - Click Free Trial link { - 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) { - throw new Error('Bullet Point Icon 1 not found'); - } - console.log('Passed: Bullet Point Icon 1 present'); + description: 'Click Free Trial link', + action: async () => { + await driver.findElement(By.linkText('30 Day Free Trial')).click(); + console.log('----->| NEXT ACTION: Clicked 30 Day Free Trial link'); + console.log('---------->| SIGN UP PAGE|<----------'); + + //Wait until the element exists in the DOM + const pageTitle = await driver.wait( + until.elementLocated(By.css('h3')), + 30000 + ); + + //Wait until it becomes visible + await driver.wait( + until.elementIsVisible(pageTitle), + 30000 + ); + + //Wait for page to load completely + await driver.wait(async () => { + const readyState = await driver.executeScript('return document.readyState'); + return readyState === 'complete'; + }, 30000, 'Sign Up page did not fully load within 30 seconds'); + console.log('Passed: Sign Up page loaded successfully'); } }, - //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 !== expectedBulletPointText1) { - throw new Error(`Expected: "${expectedBulletPointText1}"; Actual: "${elementText}"`); - } - console.log('Passed: Bullet point 1 text matched as expected'); - } - }, - - //Bullet Point link 1 text color -teal - { - description: 'Validate bullet point link 1 text color', - action: async () => - { const elementStyle = await driver.findElement(By.linkText('ExACT AutoAlign,')).getCssValue('color'); - if (elementStyle !== 'rgba(48, 200, 172, 1)') { - throw new Error(`Bullet point link 1 text color did not match; Actual: "${elementStyle}"`); - } - console.log('Passed: Bullet point link 1 text color matched as expected'); - } - }, - - //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) { - throw new Error('Bullet Point Icon 2 not found'); - } - console.log('Passed: Bullet Point Icon 2 present'); - } - }, - - //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 !== expectedBulletPointText2) { - throw new Error(`Expected: "${expectedBulletPointText2}"; Actual: "${elementText}"`); - } - console.log('Passed: Bullet point 2 text matched as expected'); - } - }, - - //Bullet Point link 2 text color -teal - { - description: 'Validate bullet point link 2 text color', - action: async () => - { const elementStyle = await driver.findElement(By.linkText('Correlation Analytics.')).getCssValue('color'); - if (elementStyle !== 'rgba(48, 200, 172, 1)') { - throw new Error(`Bullet point link 2 text color did not match; Actual: "${elementStyle}"`); - } - console.log('Passed: Bullet point link 2 text color matched as expected'); - } - }, - - //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) { - throw new Error('Bullet Point Icon 3 not found'); - } - console.log('Passed: Bullet Point Icon 3 present'); - } - }, - - //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 !== expectedBulletPointText3) { - throw new Error(`Expected: "${expectedBulletPointText3}"; Actual: "${elementText}"`); - } - console.log('Passed: Bullet point 3 text matched as expected'); - } - }, - - //Bullet Point link 3 text color -teal - { - description: 'Validate bullet point link 3 text color', - action: async () => - { const elementStyle = await driver.findElement(By.linkText('International Standards.')).getCssValue('color'); - if (elementStyle !== 'rgba(48, 200, 172, 1)') { - throw new Error(`Bullet point link 3 text color did not match; Actual: "${elementStyle}"`); - } - console.log('Passed: Bullet point link 3 text color matched as expected'); - } - }, - - //RIGHT PANEL - //ExACT logo + //Left 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) { - throw new Error('ExACT logo not found'); + if (expectedExactLogo) { + console.log('Passed: ExACT logo present'); + } else { + errors.push('ExACT logo not found'); } - console.log('Passed: ExACT logo present'); } }, - //Welcome back text + //ExACT text { - description: 'Validate Welcome back text', + description: 'Validate ExACT text', action: async () => { - const elementText = await driver.findElement(By.css('#formLogin > p')).getText(); - if (elementText !== expectedWelcomeBackText) { - throw new Error(`Expected: "${expectedWelcomeBackText}"; Actual: "${elementText}"`); + const multipleChecks = 'ExACT Free trial text 1'; + const element = await driver.findElement(By.css('h2')); + + //Get text, color, and size + const elementText = await element.getText(''); + const elementFont = await element.getCssValue('font-family'); + const elementColor = await element.getCssValue('color'); + const elementSize = await element.getCssValue('font-size'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'ExACT Free Trial') { + console.log('Passed: ExACT Free Trial text matched as expected'); + } else { + errors.push(`Expected: "ExACT Free Trial'"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === `"DM Serif Display", serif`) { + console.log('Passed: ExACT Free trial text font matched as expected'); + } else { + errors.push(`Expected: ExACT Free trial text font "DM Serif Display", serif; Actual: ${elementFont}`); + } + + //color -white + if (elementColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: ExACT Free trial color matched as expected'); + } else { + errors.push(`Expected: ExACT Free trial color "rgba(255, 255, 255, 1)"; Actual: "${elementColor}"`); + } + + //font size + if (elementSize === '36px') { + console.log('Passed: ExACT Free trial text font-size matched as expected'); + } else { + errors.push(`Expected: ExACT Free trial text font-size "36px"; Actual: "${elementSize}"`); + } + + //Throw summary if any validation failed + if (errors.length > 0) { + //Add summary line only when multiple checks failed + if (errors.length > 1) { + errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); + } + + //Throw collected messages — catch() will prefix with "FAILED:" + throw new Error(errors.join('\n')); } - console.log('Passed: Welcome Back! text matched as expected'); } }, - //Welcome back text color -gray + //Free trial text { - description: 'Validate Welcome back text color', + description: 'Validate Free trial text', action: async () => { - const elementStyle = await driver.findElement(By.css('#formLogin > p')).getCssValue('color'); - if (elementStyle !== 'rgba(117, 117, 117, 1)') { - throw new Error(`Welcome back text color did not match; Actual: "${elementStyle}"`); + const multipleChecks = 'ExACT Free trial text 1'; + const element = await driver.findElement(By.css('h2 > span')); + + //Get text, color, and size + const elementText = await element.getText(''); + const elementFont = await element.getCssValue('font-family'); + const elementColor = await element.getCssValue('color'); + const elementSize = await element.getCssValue('font-size'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Free Trial') { + console.log('Passed: ExACT Free trial text matched as expected'); + } else { + errors.push(`Expected: "Free Trial"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === `"DM Serif Display", serif`) { + console.log('Passed: ExACT Free trial text font matched as expected'); + } else { + errors.push(`Expected: ExACT Free trial text font "DM Serif Display", serif; Actual: ${elementFont}`); + } + + //color -red/orange + if (elementColor === 'rgba(255, 111, 97, 1)') { + console.log('Passed: ExACT Free trial color matched as expected'); + } else { + errors.push(`Expected: ExACT Free trial color "rgba(255, 111, 97, 1)"; Actual: "${elementColor}"`); + } + + //font size + if (elementSize === '36px') { + console.log('Passed: ExACT Free trial text font-size matched as expected'); + } else { + errors.push(`Expected: ExACT Free trial text font-size "36px"; Actual: "${elementSize}"`); + } + + //Throw summary if any validation failed + if (errors.length > 0) { + //Add summary line only when multiple checks failed + if (errors.length > 1) { + errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); + } + + //Throw collected messages — catch() will prefix with "FAILED:" + throw new Error(errors.join('\n')); } - console.log('Passed: Welcome back text color matched as expected'); } }, - //Welcome back icon + //30 Day Free Trial,... { - description: 'Verify Welcome back icon is present', + description: 'Validate Sign Up page descriptive text 1', action: async () => { - const expectedWelcomeBackIcon = await driver.wait(until.elementLocated(By.css('p > img')), 5000).catch(() => false); - if (!expectedWelcomeBackIcon) { - throw new Error('Welcome back icon not found'); + const multipleChecks = ' Sign Up page descriptive text 1'; + const element = await driver.findElement(By.css('.content-inner > p:nth-child(3)')); + + //Get text, color, and size + const elementText = await element.getText(''); + const elementFont = await element.getCssValue('font-family'); + const elementColor = await element.getCssValue('color'); + const elementSize = await element.getCssValue('font-size'); + + //Track all errors + const errors = []; + + //text + if (elementText === '30 Day Free Trial, with loads of benefits!') { + console.log('Passed: 30 Day Free trial,...text matched as expected'); + } else { + errors.push(`Expected: "30 Day Free Trial, with loads of benefits!"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: 30 Day Free trial,...text font matched as expected'); + } else { + errors.push(`Expected: 30 Day Free trial,...text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //color -white + if (elementColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: 30 Day Free trial,...text color matched as expected'); + } else { + errors.push(`Expected: 30 Day Free trial,...text color "rgba(255, 255, 255, 1)"; Actual: "${elementColor}"`); + } + + //font size + if (elementSize === '14px') { + console.log('Passed: 30 Day Free trial,...text font-size matched as expected'); + } else { + errors.push(`Expected: 30 Day Free trial,...text font-size "14px"; Actual: "${elementSize}"`); + } + + //Throw summary if any validation failed + if (errors.length > 0) { + //Add summary line only when multiple checks failed + if (errors.length > 1) { + errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); + } + + //Throw collected messages — catch() will prefix with "FAILED:" + throw new Error(errors.join('\n')); } - console.log('Passed: Welcome back icon present'); } }, - //Login title text + //See for yourself why ExACT... { - description: 'Validate Login title text', + description: 'Validate Sign Up page descriptive text 2', action: async () => { - const elementText = await driver.findElement(By.css('h2:nth-child(4)')).getText(); - if (elementText !== expectedLoginTitleText) { - throw new Error(`Expected: "${expectedLoginTitleText}"; Actual: "${elementText}"`); + const multipleChecks = ' Sign Up page descriptive text 2'; + const element = await driver.findElement(By.css('p:nth-child(4)')); + + //Get text, color, and size + const elementText = await element.getText(''); + const elementFont = await element.getCssValue('font-family'); + const elementColor = await element.getCssValue('color'); + const elementSize = await element.getCssValue('font-size'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'See for yourself why ExACT is the leading Standards and Alignment Management System in the Education market. The benefits:') { + console.log('Passed: See for yourself why ExACT...text matched as expected'); + } else { + errors.push(`Expected: "See for yourself why ExACT is the leading Standards and Alignment Management System in the Education market. The benefits:"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: See for yourself why ExACT...text font matched as expected'); + } else { + errors.push(`Expected: See for yourself why ExACT...text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //color -white + if (elementColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: See for yourself why ExACT...text color matched as expected'); + } else { + errors.push(`Expected: See for yourself why ExACT...text color "rgba(255, 255, 255, 1)"; Actual: "${elementColor}"`); + } + + //font size + if (elementSize === '14px') { + console.log('Passed: See for yourself why ExACT...text font-size matched as expected'); + } else { + errors.push(`Expected: See for yourself why ExACT...text font-size "14px"; Actual: "${elementSize}"`); + } + + //Throw summary if any validation failed + if (errors.length > 0) { + //Add summary line only when multiple checks failed + if (errors.length > 1) { + errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); + } + + //Throw collected messages — catch() will prefix with "FAILED:" + throw new Error(errors.join('\n')); } - console.log('Passed: Login title text matched as expected'); } }, - //Login title text color -navy blue + //Absolutely Free (SPECIAL CASE: Text without css path) { - description: 'Validate Login title text color', + description: 'Validate Absolutely Free', action: async () => { - const elementStyle = await driver.findElement(By.css('h2:nth-child(4)')).getCssValue('color'); - if (elementStyle !== 'rgba(40, 39, 90, 1)') { - throw new Error(`Login title text color did not match; Actual: "${elementStyle}"`); + const multipleChecks = 'Absolutely Free'; + const element = await driver.wait(until.elementLocated(By.css('.free-ico')), 5000).catch(() => false); + + //Track all errors + const errors = []; + + //icon + if (element) { + console.log('Passed: Absolutely Free Icon present'); + } else { + errors.push("Absolutely Free Icon not found"); + } + + //Filter specifically for text nodes (nodeType 3 = text node) + const textOnly = await driver.executeScript(` + const childNodes = arguments[0].childNodes; + for (let node of childNodes) { + if (node.nodeType === 3 && node.textContent.trim() !== '') { + return node.textContent.trim(); + } + } + `, element); + + //Get the span text " - no credit card required or hidden fees" + const spanText = await driver.executeScript(` + const span = arguments[0].querySelector('span'); + return span ? span.textContent.trim() : ''; + `, element); + + //Get element font attributes + const elementFont = await driver.executeScript(` + const style = window.getComputedStyle(arguments[0]); + return style.fontFamily; + `, element); + const elementColor = await driver.executeScript(` + const style = window.getComputedStyle(arguments[0]); + return style.color; + `, element); + const elementSize = await driver.executeScript(` + const style = window.getComputedStyle(arguments[0]); + return style.fontSize; + `, element); + + //Get span font attributes + const spanFont = await driver.executeScript(` + const span = arguments[0].querySelector('span'); + if (!span) return null; + const style = window.getComputedStyle(span); + return { + fontFamily: style.fontFamily, + color: style.color, + fontSize: style.fontSize + }; + `, element); + + //text - Absolutely Free + if (textOnly === 'Absolutely Free') { + console.log('Passed: Absolutely Free text matched as expected'); + } else { + errors.push(`Expected: "Absolutely Free"; Actual: "${textOnly}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Absolutely Free text font matched as expected'); + } else { + errors.push(`Expected: Absolutely Free text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + //color - white + if (elementColor === 'rgb(255, 255, 255)') { + console.log('Passed: Absolutely Free text color matched as expected'); + } else { + errors.push(`Expected: Absolutely Free text color "rgb(255, 255, 255)"; Actual: "${elementColor}"`); + } + //font size + if (elementSize === '14px') { + console.log('Passed: Absolutely Free text font-size matched as expected'); + } else { + errors.push(`Expected: Absolutely Free text font-size "14px"; Actual: "${elementSize}"`); + } + + //text - no credit card required or hidden fees + if (spanText === '- no credit card required or hidden fees') { + console.log('Passed: "- no credit card required or hidden fees" text matched as expected'); + } else { + errors.push(`Expected: "- no credit card required or hidden fees"; Actual: "${spanText}"`); + } + + //font-family - span + if (spanFont?.fontFamily === "Poppins, sans-serif") { + console.log('Passed: "- no credit card required or hidden fees" text font matched as expected'); + } else { + errors.push(`Expected: "- no credit card required or hidden fees" text font "Poppins, sans-serif"; Actual: ${spanFont?.fontFamily}`); + } + + //color - span + if (spanFont?.color === 'rgb(255, 255, 255)') { + console.log('Passed: "- no credit card required or hidden fees" text color matched as expected'); + } else { + errors.push(`Expected: "- no credit card required or hidden fees" text color "rgb(255, 255, 255)"; Actual: "${spanFont?.color}"`); + } + + //font size - span + if (spanFont?.fontSize === '14px') { + console.log('Passed: "- no credit card required or hidden fees" text font-size matched as expected'); + } else { + errors.push(`Expected: "- no credit card required or hidden fees" text font-size "14px"; Actual: "${spanFont?.fontSize}"`); + } + + //Throw summary if any validation failed + if (errors.length > 0) { + if (errors.length > 1) { + errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); + } + throw new Error(errors.join('\n')); } - console.log('Passed: Login title text color matched as expected'); } }, - //Login title text font + //Instant Access (SPECIAL CASE: Text without css path) { - description: 'Validate Login title text font size', + description: 'Validate Instant Access', action: async () => { - const elementStyle = await driver.findElement(By.css('h2:nth-child(4)')).getCssValue('font-size'); - if (elementStyle !== '32px') { - throw new Error(`Login title text font-size did not match; Actual: "${elementStyle}"`); + const multipleChecks = 'Instant Access'; + const element = await driver.wait(until.elementLocated(By.css('.access-ico')), 5000).catch(() => false); + + //Track all errors + const errors = []; + + //icon + if (element) { + console.log('Passed: Instant Access Icon present'); + } else { + errors.push("Instant Access Icon not found"); + } + + //Filter specifically for text nodes (nodeType 3 = text node) + const textOnly = await driver.executeScript(` + const childNodes = arguments[0].childNodes; + for (let node of childNodes) { + if (node.nodeType === 3 && node.textContent.trim() !== '') { + return node.textContent.trim(); + } + } + `, element); + + //Get the span text " - no credit card required or hidden fees" + const spanText = await driver.executeScript(` + const span = arguments[0].querySelector('span'); + return span ? span.textContent.trim() : ''; + `, element); + + //Get element font attributes + const elementFont = await driver.executeScript(` + const style = window.getComputedStyle(arguments[0]); + return style.fontFamily; + `, element); + const elementColor = await driver.executeScript(` + const style = window.getComputedStyle(arguments[0]); + return style.color; + `, element); + const elementSize = await driver.executeScript(` + const style = window.getComputedStyle(arguments[0]); + return style.fontSize; + `, element); + + //Get span font attributes + const spanFont = await driver.executeScript(` + const span = arguments[0].querySelector('span'); + if (!span) return null; + const style = window.getComputedStyle(span); + return { + fontFamily: style.fontFamily, + color: style.color, + fontSize: style.fontSize + }; + `, element); + + //text - Instant Access + if (textOnly === 'Instant Access') { + console.log('Passed: Instant Accesse text matched as expected'); + } else { + errors.push(`Expected: "Instant Access"; Actual: "${textOnly}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Instant Access text font matched as expected'); + } else { + errors.push(`Expected: Instant Access text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + //color - white + if (elementColor === 'rgb(255, 255, 255)') { + console.log('Passed: Instant Access text color matched as expected'); + } else { + errors.push(`Expected: Instant Access text color "rgb(255, 255, 255)"; Actual: "${elementColor}"`); + } + //font size + if (elementSize === '14px') { + console.log('Passed: Instant Access text font-size matched as expected'); + } else { + errors.push(`Expected: Absolutely Free text font-size "14px"; Actual: "${elementSize}"`); + } + + //text - Sign up and log-in, it’s that easy + if (spanText === `- Sign up and log-in, it’s that easy`) { + console.log(`Passed: "- Sign up and log-in, it’s that easy" text matched as expected`); + } else { + errors.push(`Expected: "- Sign up and log-in, it’s that easy"; Actual: "${spanText}"`); + } + + //font-family - span + if (spanFont?.fontFamily === "Poppins, sans-serif") { + console.log(`Passed: "- Sign up and log-in, it’s that easy" text font matched as expected`); + } else { + errors.push(`Expected: "- Sign up and log-in, it’s that easy" text font "Poppins, sans-serif"; Actual: ${spanFont?.fontFamily}`); + } + + //color - span + if (spanFont?.color === 'rgb(255, 255, 255)') { + console.log(`Passed: "- Sign up and log-in, it’s that easy" text color matched as expected`); + } else { + errors.push(`Expected: "- Sign up and log-in, it’s that easy" text color "rgb(255, 255, 255)"; Actual: "${spanFont?.color}"`); + } + + //font size - span + if (spanFont?.fontSize === '14px') { + console.log(`Passed: "- Sign up and log-in, it’s that easy" text font-size matched as expected`); + } else { + errors.push(`Expected: "- Sign up and log-in, it’s that easy" text font-size "14px"; Actual: "${spanFont?.fontSize}"`); + } + + //Throw summary if any validation failed + if (errors.length > 0) { + if (errors.length > 1) { + errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); + } + throw new Error(errors.join('\n')); + } + } + }, + + //Access Standards (SPECIAL CASE: Text without css path) + { + description: 'Validate Access Standards', + action: async () => { + const multipleChecks = 'Access Standards'; + const element = await driver.wait(until.elementLocated(By.css('.standard-ico')), 5000).catch(() => false); + + //Track all errors + const errors = []; + + //icon + if (element) { + console.log('Passed: Access Standards Icon present'); + } else { + errors.push("Access Standards Icon not found"); + } + + //Filter specifically for text nodes (nodeType 3 = text node) + const textOnly = await driver.executeScript(` + const childNodes = arguments[0].childNodes; + for (let node of childNodes) { + if (node.nodeType === 3 && node.textContent.trim() !== '') { + return node.textContent.trim(); + } + } + `, element); + + //Get the span text " - no credit card required or hidden fees" + const spanText = await driver.executeScript(` + const span = arguments[0].querySelector('span'); + return span ? span.textContent.trim() : ''; + `, element); + + //Get element font attributes + const elementFont = await driver.executeScript(` + const style = window.getComputedStyle(arguments[0]); + return style.fontFamily; + `, element); + const elementColor = await driver.executeScript(` + const style = window.getComputedStyle(arguments[0]); + return style.color; + `, element); + const elementSize = await driver.executeScript(` + const style = window.getComputedStyle(arguments[0]); + return style.fontSize; + `, element); + + //Get span font attributes + const spanFont = await driver.executeScript(` + const span = arguments[0].querySelector('span'); + if (!span) return null; + const style = window.getComputedStyle(span); + return { + fontFamily: style.fontFamily, + color: style.color, + fontSize: style.fontSize + }; + `, element); + + //text - Access Standards + if (textOnly === 'Access Standards') { + console.log('Passed: Access Standards text matched as expected'); + } else { + errors.push(`Expected: "Access Standards"; Actual: "${textOnly}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Access Standards text font matched as expected'); + } else { + errors.push(`Expected: Access Standards text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + //color - white + if (elementColor === 'rgb(255, 255, 255)') { + console.log('Passed: Access Standards text color matched as expected'); + } else { + errors.push(`Expected: Access Standards text color "rgb(255, 255, 255)"; Actual: "${elementColor}"`); + } + //font size + if (elementSize === '14px') { + console.log('Passed: Access Standards text font-size matched as expected'); + } else { + errors.push(`Expected: Absolutely Free text font-size "14px"; Actual: "${elementSize}"`); + } + + //text - Access all Common Core, NGSS, and NCSS Standards free + if (spanText === `- Access all Common Core, NGSS, and NCSS Standards free`) { + console.log(`Passed: "- Access all Common Core, NGSS, and NCSS Standards free`); + } else { + errors.push(`Expected: "- Access all Common Core, NGSS, and NCSS Standards free"; Actual: "${spanText}"`); + } + + //font-family - span + if (spanFont?.fontFamily === "Poppins, sans-serif") { + console.log(`Passed: "- Access all Common Core, NGSS, and NCSS Standards free" text font matched as expected`); + } else { + errors.push(`Expected: "- Access all Common Core, NGSS, and NCSS Standards free" text font "Poppins, sans-serif"; Actual: ${spanFont?.fontFamily}`); + } + + //color - span + if (spanFont?.color === 'rgb(255, 255, 255)') { + console.log(`Passed: "- Access all Common Core, NGSS, and NCSS Standards free" text color matched as expected`); + } else { + errors.push(`Expected: "- Access all Common Core, NGSS, and NCSS Standards free" text color "rgb(255, 255, 255)"; Actual: "${spanFont?.color}"`); + } + + //font size - span + if (spanFont?.fontSize === '14px') { + console.log(`Passed: "- Access all Common Core, NGSS, and NCSS Standards free" text font-size matched as expected`); + } else { + errors.push(`Expected: "- Access all Common Core, NGSS, and NCSS Standards free" text font-size "14px"; Actual: "${spanFont?.fontSize}"`); + } + + //Throw summary if any validation failed + if (errors.length > 0) { + if (errors.length > 1) { + errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); + } + throw new Error(errors.join('\n')); + } + } + }, + + //Want to talk to a representative... + { + description: 'Validate Want to talk to a representative', + action: async () => { + const multipleChecks = 'Want to talk to a representative'; + const element = await driver.findElement(By.css('p:nth-child(6)')); + + //Get text, color, and size + const elementText = await element.getText(''); + const elementFont = await element.getCssValue('font-family'); + const elementColor = await element.getCssValue('color'); + const elementSize = await element.getCssValue('font-size'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Want to talk to a representative about a the benefits of a full ExACT license? Contact Us today!') { + console.log('Passed: Want to talk to a representative...text matched as expected'); + } else { + errors.push(`Expected: "Want to talk to a representative about a the benefits of a full ExACT license? Contact Us today!"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Want to talk to a representative...text font matched as expected'); + } else { + errors.push(`Expected: Want to talk to a representative...text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //color -white + if (elementColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Want to talk to a representative...text color matched as expected'); + } else { + errors.push(`Expected: Want to talk to a representative...text color "rgba(255, 255, 255, 1)"; Actual: "${elementColor}"`); + } + + //font size + if (elementSize === '14px') { + console.log('Passed: Want to talk to a representative...text font-size matched as expected'); + } else { + errors.push(`Expected: Want to talk to a representative...text font-size "14px"; Actual: "${elementSize}"`); + } + + //Throw summary if any validation failed + if (errors.length > 0) { + //Add summary line only when multiple checks failed + if (errors.length > 1) { + errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); + } + + //Throw collected messages — catch() will prefix with "FAILED:" + throw new Error(errors.join('\n')); + } + } + }, + + //Contact Us link + { + description: 'Validate Contact Us link', + action: async () => { + const multipleChecks = 'Contact Us link'; + const element = await driver.findElement(By.linkText('Contact Us')); + + //Get href, text, color, and size + const linkHref = await element.getAttribute('href'); + const elementText = await element.getText(); + const elementFont = await element.getCssValue('font-family'); + const elementColor = await element.getCssValue('color'); + const elementSize = await element.getCssValue('font-size'); + + //Track all errors + const errors = []; + + //href + if (linkHref === 'https://edgate.com/contact-us') { + console.log('Passed: Contact Us link URL matched as expected'); + } else { + errors.push(`Expected: "https://edgate.com/contact-us"; Actual: "${linkHref}"`); + } + + //text + if (elementText === 'Contact Us') { + console.log('Passed: Contact Us link text matched as expected'); + } else { + errors.push(`Expected: "Contact Us"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Contact Us link text font matched as expected'); + } else { + errors.push(`Expected: Contact Us link text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //color -teal + if (elementColor === 'rgba(48, 200, 172, 1)') { + console.log('Passed: Contact Us link text color matched as expected'); + } else { + errors.push(`Expected: Contact Us link text color "rgba(48, 200, 172, 1)"; Actual: "${elementColor}"`); + } + + //font size + if (elementSize === '14px') { + console.log('Passed: Contact Us link text font-size matched as expected'); + } else { + errors.push(`Expected: Contact Us link text text font-size "14px"; Actual: "${elementSize}"`); + } + + //Throw summary if any validation failed + if (errors.length > 0) { + //Add summary line only when multiple checks failed + if (errors.length > 1) { + errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); + } + + //Throw collected messages — catch() will prefix with "FAILED:" + throw new Error(errors.join('\n')); + } + } + }, + + //Sign Up title + { + description: 'Validate Sign Up title', + action: async () => { + const multipleChecks = 'Sign Up title'; + const element = await driver.findElement(By.css('h3')); + + //Get text, color, and size + const elementText = await element.getText(''); + const elementFont = await element.getCssValue('font-family'); + const elementColor = await element.getCssValue('color'); + const elementSize = await element.getCssValue('font-size'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Sign Up') { + console.log('Passed: Sign Up title text matched as expected'); + } else { + const message = `Expected: "Sign Up"; Actual: "${elementText}"`; + errors.push(message); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Sign Up title text font matched as expected'); + } else { + const message = `Expected: Sign Up title text font "Poppins, sans-serif"; Actual: ${elementFont}`; + errors.push(message); + } + + //color -navy blue + if (elementColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Sign Up title color matched as expected'); + } else { + const message = `Expected: Sign Up title color "rgba(40, 39, 90, 1)"; Actual: "${elementColor}"`; + errors.push(message); + } + + //font size + if (elementSize === '24px') { + console.log('Passed: Sign Up title text font-size matched as expected'); + } else { + const message = `Expected: Sign Up title text font-size "24px"; Actual: "${elementSize}"`; + errors.push(message); + } + + //Throw summary if any validation failed + if (errors.length > 0) { + //Add summary line only when multiple checks failed + if (errors.length > 1) { + errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); + } + + //Throw collected messages — catch() will prefix with "FAILED:" + throw new Error(errors.join('\n')); + } + } + }, + + //Already have an account? + { + description: 'Validate Already have an account', + action: async () => { + const multipleChecks = 'Already have an account?'; + const element = await driver.findElement(By.css('.alreadyacount')); + + //Get text, color, and size + const elementText = await element.getText(''); + const elementFont = await element.getCssValue('font-family'); + const elementColor = await element.getCssValue('color'); + const elementSize = await element.getCssValue('font-size'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Already Have an account? Sign In') { + console.log('Passed: Already Have an account? Sign In text matched as expected'); + } else { + const message = `Expected: "Already Have an account? Sign In"; Actual: "${elementText}"`; + errors.push(message); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Already Have an account? Sign In text font matched as expected'); + } else { + const message = `Expected: Already Have an account? Sign In text font "Poppins, sans-serif"; Actual: ${elementFont}`; + errors.push(message); + } + + //color -black + if (elementColor === 'rgba(32, 32, 32, 1)') { + console.log('Passed: Already Have an account? Sign In color matched as expected'); + } else { + const message = `Expected: Already Have an account? Sign In color "rgba(32, 32, 32, 1)"; Actual: "${elementColor}"`; + errors.push(message); + } + + //font size + if (elementSize === '12px') { + console.log('Passed: Already Have an account? Sign In text font-size matched as expected'); + } else { + const message = `Expected: Already Have an account? Sign In text font-size "12px"; Actual: "${elementSize}"`; + errors.push(message); + } + + //Throw summary if any validation failed + if (errors.length > 0) { + //Add summary line only when multiple checks failed + if (errors.length > 1) { + errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); + } + + //Throw collected messages — catch() will prefix with "FAILED:" + throw new Error(errors.join('\n')); + } + } + }, + + //Sign In link + { + description: 'Validate Sign In link', + action: async () => { + const multipleChecks = 'Sign In link'; + const element = await driver.wait(until.elementLocated(By.css('.alreadyacount > a')), 5000); + + //Get href, text, and CSS values all from the same element + const linkHref = await element.getAttribute('href'); + const elementText = await element.getText(); + const elementFont = await element.getCssValue('font-family'); + const elementColor = await element.getCssValue('color'); + const elementSize = await element.getCssValue('font-size'); + + //Track all errors + const errors = []; + + //href + if (linkHref === 'https://correlation.edgate.com/exact/login.php') { + console.log('Passed: Sign In link URL matched as expected'); + } else { + errors.push(`Expected: "https://correlation.edgate.com/exact/login.php"; Actual: "${linkHref}"`); + } + + //text + if (elementText === 'Sign In') { + console.log('Passed: Sign In link text matched as expected'); + } else { + errors.push(`Expected: "Sign In"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Sign In link text font matched as expected'); + } else { + errors.push(`Expected: Sign In link text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //color - teal + if (elementColor === 'rgba(48, 200, 172, 1)') { + console.log('Passed: Sign In link text color matched as expected'); + } else { + errors.push(`Expected: Sign In link text color "rgba(48, 200, 172, 1)"; Actual: "${elementColor}"`); + } + + //font size + if (elementSize === '14px') { + console.log('Passed: Sign In link text font-size matched as expected'); + } else { + errors.push(`Expected: Sign In link text font-size "14px"; Actual: "${elementSize}"`); + } + + //Throw summary if any validation failed + if (errors.length > 0) { + if (errors.length > 1) { + errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); + } + throw new Error(errors.join('\n')); + } + } + }, + + //First name (SPECIAL CASE: Placeholder validation without trigger) + { + description: 'Validate First name placeholder', + action: async () => { + const multipleChecks = 'First name placeholder'; + const element = await driver.findElement(By.css('#firstname')); + + //Get text, color, and size + const elementText = await element.getAttribute('placeholder'); + + //Get placeholder styles via executeScript since it's a pseudo-element + const elementFont = await driver.executeScript( + `return window.getComputedStyle(arguments[0], '::placeholder').getPropertyValue('font-family')`, + element + ); + const elementColor = await driver.executeScript( + `return window.getComputedStyle(arguments[0], '::placeholder').getPropertyValue('color')`, + element + ); + const elementSize = await driver.executeScript( + `return window.getComputedStyle(arguments[0], '::placeholder').getPropertyValue('font-size')`, + element + ); + + //Track all errors + const errors = []; + + //text + if (elementText === 'First name') { + console.log('Passed: First name label text matched as expected'); + } else { + errors.push(`Expected: "First name"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: First name label text font matched as expected'); + } else { + errors.push(`Expected: First name label text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //color -gray + if (elementColor === 'rgb(108, 117, 125)') { + console.log('Passed: First name label text color matched as expected'); + } else { + errors.push(`Expected: First name label text color "rgb(108, 117, 125)"; Actual: "${elementColor}"`); + } + + //font size + if (elementSize === '12.6px') { + console.log('Passed: First name label text font-size matched as expected'); + } else { + errors.push(`Expected: First name label text font-size "12.6px"; Actual: "${elementSize}"`); + } + + //invalid-feedback + const feedbackText = await driver.executeScript(` + const input = arguments[0]; + const feedback = input.parentElement.querySelector('.invalid-feedback'); + return feedback ? feedback.textContent.trim() : ''; + `, element); + if (feedbackText === 'Please enter a first name.') { + console.log('Passed: First name invalid feedback validation message matched as expected'); + } else { + errors.push(`Expected: "Please enter a first name." validation message; Actual: "${feedbackText}"`); + } + + //Throw summary if any validation failed + if (errors.length > 0) { + //Add summary line only when multiple checks failed + if (errors.length > 1) { + errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); + } + + //Throw collected messages — catch() will prefix with "FAILED:" + throw new Error(errors.join('\n')); + } + } + }, + + //Last name textbox + { + description: 'Validate Last name textbox', + action: async () => { + const multipleChecks = 'Last name textbox'; + const element = await driver.findElement(By.css('#lastname')); + + //Get text, color, and size + const elementText = await element.getAttribute('placeholder'); + + //Get placeholder styles via executeScript since it's a pseudo-element + const elementFont = await driver.executeScript( + `return window.getComputedStyle(arguments[0], '::placeholder').getPropertyValue('font-family')`, + element + ); + const elementColor = await driver.executeScript( + `return window.getComputedStyle(arguments[0], '::placeholder').getPropertyValue('color')`, + element + ); + const elementSize = await driver.executeScript( + `return window.getComputedStyle(arguments[0], '::placeholder').getPropertyValue('font-size')`, + element + ); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Last name') { + console.log('Passed: Last name label text matched as expected'); + } else { + errors.push(`Expected: "Last name"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Last name label text font matched as expected'); + } else { + errors.push(`Expected: Last name label text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //color -gray + if (elementColor === 'rgb(108, 117, 125)') { + console.log('Passed: Last name label text color matched as expected'); + } else { + errors.push(`Expected: Last name label text color "rgb(108, 117, 125)"; Actual: "${elementColor}"`); + } + + //font size + if (elementSize === '12.6px') { + console.log('Passed: Last name label text font-size matched as expected'); + } else { + errors.push(`Expected: Last name label text font-size "12.6px"; Actual: "${elementSize}"`); + } + + //invalid-feedback + const feedbackText = await driver.executeScript(` + const input = arguments[0]; + const feedback = input.parentElement.querySelector('.invalid-feedback'); + return feedback ? feedback.textContent.trim() : ''; + `, element); + if (feedbackText === 'Please enter a last name.') { + console.log('Passed: First name invalid feedback validation message matched as expected'); + } else { + errors.push(`Expected: "Please enter a last name." validation message; Actual: "${feedbackText}"`); + } + + //Throw summary if any validation failed + if (errors.length > 0) { + //Add summary line only when multiple checks failed + if (errors.length > 1) { + errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); + } + + //Throw collected messages — catch() will prefix with "FAILED:" + throw new Error(errors.join('\n')); + } + } + }, + + //Username textbox + { + description: 'Validate Username textbox', + action: async () => { + const multipleChecks = 'Username textbox'; + const element = await driver.findElement(By.css('.row:nth-child(5) > .col:nth-child(1) > .form-control')); + + //Get text, color, and size + const elementText = await element.getAttribute('placeholder'); + + //Get placeholder styles via executeScript since it's a pseudo-element + const elementFont = await driver.executeScript( + `return window.getComputedStyle(arguments[0], '::placeholder').getPropertyValue('font-family')`, + element + ); + const elementColor = await driver.executeScript( + `return window.getComputedStyle(arguments[0], '::placeholder').getPropertyValue('color')`, + element + ); + const elementSize = await driver.executeScript( + `return window.getComputedStyle(arguments[0], '::placeholder').getPropertyValue('font-size')`, + element + ); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Username') { + console.log('Passed: Username label text matched as expected'); + } else { + errors.push(`Expected: "Username"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Username label text font matched as expected'); + } else { + errors.push(`Expected: Username label text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //color -gray + if (elementColor === 'rgb(108, 117, 125)') { + console.log('Passed: Username label text color matched as expected'); + } else { + errors.push(`Expected: Username label text color "rgb(108, 117, 125)"; Actual: "${elementColor}"`); + } + + //font size + if (elementSize === '12.6px') { + console.log('Passed: Username label text font-size matched as expected'); + } else { + errors.push(`Expected: Username label text font-size "12.6px"; Actual: "${elementSize}"`); + } + + //Trigger validation by clicking Start Your Free Trial button + await driver.findElement(By.css('#firstname')).sendKeys('EdgateAutomated'); + console.log('----->| NEXT ACTION: Entered First name: EdgateAutomated'); + + await driver.findElement(By.css('#lastname')).sendKeys('EdGateRegression'); + console.log('----->| NEXT ACTION: Entered Last name: EdGateRegression'); + + await driver.findElement(By.css('.btn')).click(); + console.log('----->| NEXT ACTION: Clicked Start Your Free Trial button'); + await driver.sleep(500); + + //Check native HTML5 validation message + const validationMessage = await driver.executeScript(` + return document.querySelector('input[name="userlogon"]').validationMessage; + `); + + if (validationMessage === 'Please fill out this field.') { + console.log('Passed: Username validation message matched as expected'); + } else { + errors.push(`Expected: "Please fill out this field." validation message; Actual: "${validationMessage}"`); + } + + //Throw summary if any validation failed + if (errors.length > 0) { + //Add summary line only when multiple checks failed + if (errors.length > 1) { + errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); + } + + //Throw collected messages — catch() will prefix with "FAILED:" + throw new Error(errors.join('\n')); + } + } + }, + + //Password textbox + { + description: 'Validate Password textbox', + action: async () => { + const multipleChecks = 'Password textbox'; + const element = await driver.findElement(By.css('#password')); + const icon = await driver.findElement(By.css('.pass-eye')); + + //Get text, color, and size + const elementText = await element.getAttribute('placeholder'); + + //Get placeholder styles via executeScript since it's a pseudo-element + const elementFont = await driver.executeScript( + `return window.getComputedStyle(arguments[0], '::placeholder').getPropertyValue('font-family')`, + element + ); + const elementColor = await driver.executeScript( + `return window.getComputedStyle(arguments[0], '::placeholder').getPropertyValue('color')`, + element + ); + const elementSize = await driver.executeScript( + `return window.getComputedStyle(arguments[0], '::placeholder').getPropertyValue('font-size')`, + element + ); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Password') { + console.log('Passed: Password label text matched as expected'); + } else { + errors.push(`Expected: "Password"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Password label text font matched as expected'); + } else { + errors.push(`Expected: Password label text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //color -gray + if (elementColor === 'rgb(108, 117, 125)') { + console.log('Passed: Password label text color matched as expected'); + } else { + errors.push(`Expected: Password label text color "rgb(108, 117, 125)"; Actual: "${elementColor}"`); + } + + //font size + if (elementSize === '12.6px') { + console.log('Passed: Password label text font-size matched as expected'); + } else { + errors.push(`Expected: Password label text font-size "12.6px"; Actual: "${elementSize}"`); + } + + //icon + if (icon) { + console.log('Passed: Passkey eye Icon present'); + } else { + errors.push("Passkey eye Icon not found"); + } + + //Trigger validation by clicking Start Your Free Trial button + await driver.findElement(By.css('.row:nth-child(5) > .col:nth-child(1) > .form-control')).sendKeys('EdGateAutomatedRegression'); + console.log('----->| NEXT ACTION: Entered Username: EdGateAutomatedRegression'); + + //invalid-feedback + const feedbackText = await driver.executeScript(` + const input = arguments[0]; + const feedback = input.parentElement.querySelector('.invalid-feedback'); + return feedback ? feedback.textContent.trim() : ''; + `, element); + if (feedbackText === 'Please enter a password (8 or more characters).') { + console.log('Passed: Please enter a password (8 or more characters). validation message matched as expected'); + } else { + errors.push(`Expected: "Please enter a password (8 or more characters)." validation message; Actual: "${feedbackText}"`); + } + + //Throw summary if any validation failed + if (errors.length > 0) { + //Add summary line only when multiple checks failed + if (errors.length > 1) { + errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); + } + + //Throw collected messages — catch() will prefix with "FAILED:" + throw new Error(errors.join('\n')); + } + } + }, + + //Password Requirements: + { + description: 'Validate Password Requirements text', + action: async () => { + const multipleChecks = 'Password Requirements'; + const element = await driver.findElement(By.css('.pass-req')); + + //Get text, color, and size + const elementText = await element.getText(); + const elementFont = await element.getCssValue('font-family'); + const elementColor = await element.getCssValue('color'); + const elementSize = await element.getCssValue('font-size'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Password Requirements:') { + console.log('Passed: Password Requirements: text matched as expected'); + } else { + errors.push(`Expected: "Password Requirements:"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: Password Requirements: text font matched as expected'); + } else { + errors.push(`Expected: Password Requirements: text font "DM Serif Display", serif; Actual: ${elementFont}`); + } + + //color -navy blue + if (elementColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Password Requirements: text color matched as expected'); + } else { + errors.push(`Expected: Password Requirements: text color "rgba(40, 39, 90, 1)"; Actual: "${elementColor}"`); + } + + //font size + if (elementSize === '15px') { + console.log('Passed: Password Requirements: text font-size matched as expected'); + } else { + errors.push(`Expected: Password Requirements: text font-size "15px"; Actual: "${elementSize}"`); + } + + //Throw summary if any validation failed + if (errors.length > 0) { + //Add summary line only when multiple checks failed + if (errors.length > 1) { + errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); + } + + //Throw collected messages — catch() will prefix with "FAILED:" + throw new Error(errors.join('\n')); + } + } + }, + + //Must be at least 8 characters. + { + description: 'Validate Password Req1 text', + action: async () => { + const multipleChecks = 'Password Req1'; + const element = await driver.findElement(By.css('.changeul > li:nth-child(2)')); + + //Get text, color, and size + const elementText = await element.getText(); + const elementFont = await element.getCssValue('font-family'); + const elementColor = await element.getCssValue('color'); + const elementSize = await element.getCssValue('font-size'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Must be at least 8 characters.') { + console.log('Passed: Must be at least 8 characters. text matched as expected'); + } else { + errors.push(`Expected: "Must be at least 8 characters."; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: Must be at least 8 characters. text font matched as expected'); + } else { + errors.push(`Expected: Must be at least 8 characters. text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //color -navy blue + if (elementColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Must be at least 8 characters. text color matched as expected'); + } else { + errors.push(`Expected: Must be at least 8 characters. text color "rgba(40, 39, 90, 1)"; Actual: "${elementColor}"`); + } + + //font size + if (elementSize === '13px') { + console.log('Passed: Must be at least 8 characters. text font-size matched as expected'); + } else { + errors.push(`Expected: Must be at least 8 characters. text font-size "13px"; Actual: "${elementSize}"`); + } + + //Throw summary if any validation failed + if (errors.length > 0) { + //Add summary line only when multiple checks failed + if (errors.length > 1) { + errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); + } + + //Throw collected messages — catch() will prefix with "FAILED:" + throw new Error(errors.join('\n')); + } + } + }, + + //Contain at least one of each: + { + description: 'Validate Password Req2 text', + action: async () => { + const multipleChecks = 'Password Req2'; + const element = await driver.wait(until.elementLocated(By.css('.changeul > li:nth-child(3)')), 5000); + + const textOnly = await driver.executeScript(` + const childNodes = arguments[0].childNodes; + for (let node of childNodes) { + if (node.nodeType === 3 && node.textContent.trim() !== '') { + return node.textContent.trim(); + } + } + `, element); + + //Get text, color, and size + const elementText = await element.getText(); + const elementFont = await element.getCssValue('font-family'); + const elementColor = await element.getCssValue('color'); + const elementSize = await element.getCssValue('font-size'); + + //Track all errors + const errors = []; + + //text + if (textOnly === 'Contain at least one of each:') { + console.log('Passed: Contain at least one of each: text matched as expected'); + } else { + errors.push(`Expected: "Contain at least one of each:"; Actual: "${textOnly}"`); + } + + //font-family + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: Contain at least one of each: text font matched as expected'); + } else { + errors.push(`Expected: Contain at least one of each: text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //color -navy blue + if (elementColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Contain at least one of each: text color matched as expected'); + } else { + errors.push(`Expected: Contain at least one of each: text color "rgba(40, 39, 90, 1)"; Actual: "${elementColor}"`); + } + + //font size + if (elementSize === '13px') { + console.log('Passed: Contain at least one of each: text font-size matched as expected'); + } else { + errors.push(`Expected: Contain at least one of each: text font-size "13px"; Actual: "${elementSize}"`); + } + + //Throw summary if any validation failed + if (errors.length > 0) { + //Add summary line only when multiple checks failed + if (errors.length > 1) { + errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); + } + + //Throw collected messages — catch() will prefix with "FAILED:" + throw new Error(errors.join('\n')); + } + } + }, + + //Uppercase letter + { + description: 'Validate Password Req2a text', + action: async () => { + const multipleChecks = 'Password Req2a'; + const element = await driver.findElement(By.css('li li:nth-child(1)')); + + //Get text, color, and size + const elementText = await element.getText(); + const elementFont = await element.getCssValue('font-family'); + const elementColor = await element.getCssValue('color'); + const elementSize = await element.getCssValue('font-size'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Uppercase letter') { + console.log('Passed: Uppercase letter text matched as expected'); + } else { + errors.push(`Expected: "Uppercase letter"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: Uppercase letter text font matched as expected'); + } else { + errors.push(`Expected: Uppercase letter text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //color -navy blue + if (elementColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Uppercase letter text color matched as expected'); + } else { + errors.push(`Expected: Uppercase letter text color "rgba(40, 39, 90, 1)"; Actual: "${elementColor}"`); + } + + //font size + if (elementSize === '13px') { + console.log('Passed: Uppercase letter text font-size matched as expected'); + } else { + errors.push(`Expected: Uppercase letter text font-size "13px"; Actual: "${elementSize}"`); + } + + //Throw summary if any validation failed + if (errors.length > 0) { + //Add summary line only when multiple checks failed + if (errors.length > 1) { + errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); + } + + //Throw collected messages — catch() will prefix with "FAILED:" + throw new Error(errors.join('\n')); + } + } + }, + + //Lowercase letter + { + description: 'Validate Password Req2b text', + action: async () => { + const multipleChecks = 'Password Req2b'; + const element = await driver.findElement(By.css('li li:nth-child(2)')); + + //Get text, color, and size + const elementText = await element.getText(); + const elementFont = await element.getCssValue('font-family'); + const elementColor = await element.getCssValue('color'); + const elementSize = await element.getCssValue('font-size'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Lowercase letter') { + console.log('Passed: Lowercase letter text matched as expected'); + } else { + errors.push(`Expected: "Lowercase letter"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: Lowercase letter text font matched as expected'); + } else { + errors.push(`Expected: Lowercase letter text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //color -navy blue + if (elementColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Lowercase letter text color matched as expected'); + } else { + errors.push(`Expected: Lowercase letter text color "rgba(40, 39, 90, 1)"; Actual: "${elementColor}"`); + } + + //font size + if (elementSize === '13px') { + console.log('Passed: Lowercase letter text font-size matched as expected'); + } else { + errors.push(`Expected: Lowercase letter text font-size "13px"; Actual: "${elementSize}"`); + } + + //Throw summary if any validation failed + if (errors.length > 0) { + //Add summary line only when multiple checks failed + if (errors.length > 1) { + errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); + } + + //Throw collected messages — catch() will prefix with "FAILED:" + throw new Error(errors.join('\n')); + } + } + }, + + //Number + { + description: 'Validate Password Req2c text', + action: async () => { + const multipleChecks = 'Password Req2c'; + const element = await driver.findElement(By.css('li li:nth-child(3)')); + + //Get text, color, and size + const elementText = await element.getText(); + const elementFont = await element.getCssValue('font-family'); + const elementColor = await element.getCssValue('color'); + const elementSize = await element.getCssValue('font-size'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Number') { + console.log('Passed: Number text matched as expected'); + } else { + errors.push(`Expected: "Number"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: Number text font matched as expected'); + } else { + errors.push(`Expected: Number text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //color -navy blue + if (elementColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Number text color matched as expected'); + } else { + errors.push(`Expected: Number text color "rgba(40, 39, 90, 1)"; Actual: "${elementColor}"`); + } + + //font size + if (elementSize === '13px') { + console.log('Passed: Number text font-size matched as expected'); + } else { + errors.push(`Expected: Number text font-size "13px"; Actual: "${elementSize}"`); + } + + //Throw summary if any validation failed + if (errors.length > 0) { + //Add summary line only when multiple checks failed + if (errors.length > 1) { + errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); + } + + //Throw collected messages — catch() will prefix with "FAILED:" + throw new Error(errors.join('\n')); + } + } + }, + + //Special character (e.g. - ! @ # $ etc.) + { + description: 'Validate Password Req2d text', + action: async () => { + const multipleChecks = 'Password Req2d'; + const element = await driver.findElement(By.css('li li:nth-child(4)')); + + //Get text, color, and size + const elementText = await element.getText(); + const elementFont = await element.getCssValue('font-family'); + const elementColor = await element.getCssValue('color'); + const elementSize = await element.getCssValue('font-size'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Special character (e.g. - ! @ # $ etc.)') { + console.log('Passed: Special character (e.g. - ! @ # $ etc.) text matched as expected'); + } else { + errors.push(`Expected: "Special character (e.g. - ! @ # $ etc.)"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === 'Poppins, sans-serif') { + console.log('Passed: Special character (e.g. - ! @ # $ etc.) text font matched as expected'); + } else { + errors.push(`Expected: Special character (e.g. - ! @ # $ etc.) text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //color -navy blue + if (elementColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Special character (e.g. - ! @ # $ etc.) text color matched as expected'); + } else { + errors.push(`Expected: Special character (e.g. - ! @ # $ etc.) text color "rgba(40, 39, 90, 1)"; Actual: "${elementColor}"`); + } + + //font size + if (elementSize === '13px') { + console.log('Passed: Special character (e.g. - ! @ # $ etc.) text font-size matched as expected'); + } else { + errors.push(`Expected: Special character (e.g. - ! @ # $ etc.) text font-size "13px"; Actual: "${elementSize}"`); + } + + //Throw summary if any validation failed + if (errors.length > 0) { + //Add summary line only when multiple checks failed + if (errors.length > 1) { + errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); + } + + //Throw collected messages — catch() will prefix with "FAILED:" + throw new Error(errors.join('\n')); + } + } + }, + + //Email address textbox + { + description: 'Validate Email address textbox', + action: async () => { + const multipleChecks = 'Email address textbox'; + const element = await driver.findElement(By.css('.row:nth-child(6) .form-control')); + + //Get text, color, and size + const elementText = await element.getAttribute('placeholder'); + + //Get placeholder styles via executeScript since it's a pseudo-element + const elementFont = await driver.executeScript( + `return window.getComputedStyle(arguments[0], '::placeholder').getPropertyValue('font-family')`, + element + ); + const elementColor = await driver.executeScript( + `return window.getComputedStyle(arguments[0], '::placeholder').getPropertyValue('color')`, + element + ); + const elementSize = await driver.executeScript( + `return window.getComputedStyle(arguments[0], '::placeholder').getPropertyValue('font-size')`, + element + ); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Email address') { + console.log('Passed: Email address label text matched as expected'); + } else { + errors.push(`Expected: "Email address"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Email address label text font matched as expected'); + } else { + errors.push(`Expected: Email address label text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //color -gray + if (elementColor === 'rgb(108, 117, 125)') { + console.log('Passed: Email address label text color matched as expected'); + } else { + errors.push(`Expected: Email address label text color "rgb(108, 117, 125)"; Actual: "${elementColor}"`); + } + + //font size + if (elementSize === '12.6px') { + console.log('Passed: Email address label text font-size matched as expected'); + } else { + errors.push(`Expected: Email address label text font-size "12.6px"; Actual: "${elementSize}"`); + } + + //Trigger validation by clicking Start Your Free Trial button + await driver.findElement(By.css('#password')).sendKeys('EdGate123'); + console.log('----->| NEXT ACTION: Entered Password: EdGate123'); + + await driver.findElement(By.css('.btn')).click(); + console.log('----->| NEXT ACTION: Clicked Start Your Free Trial button'); + await driver.sleep(500); + + //Check native HTML5 validation message + const validationMessage = await driver.executeScript(` + return document.querySelector('input[name="email"]').validationMessage; + `); + + if (validationMessage === 'Please fill out this field.') { + console.log('Passed: Email validation message matched as expected'); + } else { + errors.push(`Expected: "Please fill out this field." validation message; Actual: "${validationMessage}"`); + } + + //Throw summary if any validation failed + if (errors.length > 0) { + //Add summary line only when multiple checks failed + if (errors.length > 1) { + errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); + } + + //Throw collected messages — catch() will prefix with "FAILED:" + throw new Error(errors.join('\n')); + } + } + }, + + //Organization textbox + { + description: 'Validate Organization textbox', + action: async () => { + const multipleChecks = 'Organization placeholder'; + const element = await driver.findElement(By.css('.row:nth-child(7) > .col:nth-child(1) > .form-control')); + + //Get text, color, and size + const elementText = await element.getAttribute('placeholder'); + + //Get placeholder styles via executeScript since it's a pseudo-element + const elementFont = await driver.executeScript( + `return window.getComputedStyle(arguments[0], '::placeholder').getPropertyValue('font-family')`, + element + ); + const elementColor = await driver.executeScript( + `return window.getComputedStyle(arguments[0], '::placeholder').getPropertyValue('color')`, + element + ); + const elementSize = await driver.executeScript( + `return window.getComputedStyle(arguments[0], '::placeholder').getPropertyValue('font-size')`, + element + ); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Organization') { + console.log('Passed: Organization label text matched as expected'); + } else { + errors.push(`Expected: "Organization"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Organization label text font matched as expected'); + } else { + errors.push(`Expected: Organization label text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //color -gray + if (elementColor === 'rgb(108, 117, 125)') { + console.log('Passed: Organization label text color matched as expected'); + } else { + errors.push(`Expected: Organization label text color "rgb(108, 117, 125)"; Actual: "${elementColor}"`); + } + + //font size + if (elementSize === '12.6px') { + console.log('Passed: Organization label text font-size matched as expected'); + } else { + errors.push(`Expected: Organization label text font-size "12.6px"; Actual: "${elementSize}"`); + } + + //invalid-feedback + const feedbackText = await driver.executeScript(` + const input = arguments[0]; + const feedback = input.parentElement.querySelector('.invalid-feedback'); + return feedback ? feedback.textContent.trim() : ''; + `, element); + if (feedbackText === 'Please enter your organization.') { + console.log('Passed: Please enter your organization. validation message matched as expected'); + } else { + errors.push(`Expected: "Please enter your organization." validation message; Actual: "${feedbackText}"`); + } + + //Throw summary if any validation failed + if (errors.length > 0) { + //Add summary line only when multiple checks failed + if (errors.length > 1) { + errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); + } + + //Throw collected messages — catch() will prefix with "FAILED:" + throw new Error(errors.join('\n')); + } + } + }, + + //Position textbox + { + description: 'Validate Position textbox', + action: async () => { + const multipleChecks = 'Position textbox'; + const element = await driver.findElement(By.css('.row:nth-child(7) > .col:nth-child(2) > .form-control')); + + //Get text, color, and size + const elementText = await element.getAttribute('placeholder'); + + //Get placeholder styles via executeScript since it's a pseudo-element + const elementFont = await driver.executeScript( + `return window.getComputedStyle(arguments[0], '::placeholder').getPropertyValue('font-family')`, + element + ); + const elementColor = await driver.executeScript( + `return window.getComputedStyle(arguments[0], '::placeholder').getPropertyValue('color')`, + element + ); + const elementSize = await driver.executeScript( + `return window.getComputedStyle(arguments[0], '::placeholder').getPropertyValue('font-size')`, + element + ); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Position') { + console.log('Passed: Position label text matched as expected'); + } else { + errors.push(`Expected: "Position"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Position label text font matched as expected'); + } else { + errors.push(`Expected: Position label text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //color -gray + if (elementColor === 'rgb(108, 117, 125)') { + console.log('Passed: Position label text color matched as expected'); + } else { + errors.push(`Expected: Position label text color "rgb(108, 117, 125)"; Actual: "${elementColor}"`); + } + + //font size + if (elementSize === '12.6px') { + console.log('Passed: Position label text font-size matched as expected'); + } else { + errors.push(`Expected: Position label text font-size "12.6px"; Actual: "${elementSize}"`); + } + + //Throw summary if any validation failed + if (errors.length > 0) { + //Add summary line only when multiple checks failed + if (errors.length > 1) { + errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); + } + + //Throw collected messages — catch() will prefix with "FAILED:" + throw new Error(errors.join('\n')); + } + } + }, + + //Phone number textbox + { + description: 'Validate Phone number textbox', + action: async () => { + const multipleChecks = 'Phone number textbox'; + const element = await driver.findElement(By.css('.row:nth-child(8) .form-control')); + + //Get text, color, and size + const elementText = await element.getAttribute('placeholder'); + + //Get placeholder styles via executeScript since it's a pseudo-element + const elementFont = await driver.executeScript( + `return window.getComputedStyle(arguments[0], '::placeholder').getPropertyValue('font-family')`, + element + ); + const elementColor = await driver.executeScript( + `return window.getComputedStyle(arguments[0], '::placeholder').getPropertyValue('color')`, + element + ); + const elementSize = await driver.executeScript( + `return window.getComputedStyle(arguments[0], '::placeholder').getPropertyValue('font-size')`, + element + ); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Phone number') { + console.log('Passed: Phone number label text matched as expected'); + } else { + errors.push(`Expected: Phone number"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Phone number label text font matched as expected'); + } else { + errors.push(`Expected: Phone number label text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //color -gray + if (elementColor === 'rgb(108, 117, 125)') { + console.log('Passed: Phone number label text color matched as expected'); + } else { + errors.push(`Expected: Phone number label text color "rgb(108, 117, 125)"; Actual: "${elementColor}"`); + } + + //font size + if (elementSize === '12.6px') { + console.log('Passed: Phone number label text font-size matched as expected'); + } else { + errors.push(`Expected: Phone number label text font-size "12.6px"; Actual: "${elementSize}"`); + } + + //Throw summary if any validation failed + if (errors.length > 0) { + //Add summary line only when multiple checks failed + if (errors.length > 1) { + errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); + } + + //Throw collected messages — catch() will prefix with "FAILED:" + throw new Error(errors.join('\n')); + } + } + }, + + //Terms of service + { + description: 'Validate Terms of service', + action: async () => { + const multipleChecks = 'Terms of service'; + const elementcheckbox = await driver.wait(until.elementLocated(By.css('#terms')), 5000).catch(() => false); + const element = await driver.findElement(By.css('.form-check-label')); + + //Get icon, text, color, and size + const elementText = await element.getText(); + const elementFont = await element.getCssValue('font-family'); + const elementColor = await element.getCssValue('color'); + const elementSize = await element.getCssValue('font-size'); + + //Track all errors + const errors = []; + + //icon + if (elementcheckbox) { + console.log('Passed: Terms of service checkbox present'); + } else { + errors.push("Terms of service checkbox not found"); + } + + //text + if (elementText === 'I agree to the terms of service') { + console.log('Passed: I agree to the terms of service text matched as expected'); + } else { + errors.push(`Expected: "I agree to the terms of service"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: I agree to the terms of service text font matched as expected'); + } else { + errors.push(`Expected: I agree to the terms of service text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //color -navy blue + if (elementColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: I agree to the terms of service text color matched as expected'); + } else { + errors.push(`Expected: I agree to the terms of service text color "rgba(40, 39, 90, 1)"; Actual: "${elementColor}"`); + } + + //font size + if (elementSize === '10px') { + console.log('Passed: I agree to the terms of service text font-size matched as expected'); + } else { + errors.push(`Expected: I agree to the terms of service text text font-size "10px"; Actual: "${elementSize}"`); + } + + //Trigger validation by clicking Start Your Free Trial button + await driver.findElement(By.css('.row:nth-child(6) .form-control')).sendKeys('EdGateAutomatedRegression@edgate.com'); + console.log('----->| NEXT ACTION: Entered Organization: EdGateAutomatedRegression@edgate.com'); + + await driver.findElement(By.css('.row:nth-child(7) > .col:nth-child(1) > .form-control')).sendKeys('EdGate Inc.'); + console.log('----->| NEXT ACTION: Entered Organization: EdGate Inc.'); + + await driver.findElement(By.css('.btn')).click(); + console.log('----->| NEXT ACTION: Clicked Start Your Free Trial button'); + await driver.sleep(500); + + //Check native HTML5 validation message + const validationMessage = await driver.executeScript(` + return document.querySelector('input[name="terms"]').validationMessage; + `); + + if (validationMessage === 'Please check this box if you want to proceed.') { + console.log('Passed: Username validation message matched as expected'); + } else { + errors.push(`Expected: "Please check this box if you want to proceed." validation message; Actual: "${validationMessage}"`); + } + + //Throw summary if any validation failed + if (errors.length > 0) { + //Add summary line only when multiple checks failed + if (errors.length > 1) { + errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); + } + + //Throw collected messages — catch() will prefix with "FAILED:" + throw new Error(errors.join('\n')); + } + } + }, + + //Terms of Service link + { + description: 'Validate Terms of Service link', + action: async () => { + const multipleChecks = 'Terms of Service link'; + const element = await driver.findElement(By.linkText('terms of service')); + + //Get href, text, color, and size + const linkHref = await element.getAttribute('href'); + const elementText = await element.getText(); + const elementFont = await element.getCssValue('font-family'); + const elementColor = await element.getCssValue('color'); + const elementSize = await element.getCssValue('font-size'); + + //Track all errors + const errors = []; + + //href + if (linkHref === 'https://edgate.com/terms-of-service') { + console.log('Passed: Terms of Service link URL matched as expected'); + } else { + errors.push(`Expected: "https://edgate.com/terms-of-service"; Actual: "${linkHref}"`); + } + + //text + if (elementText === 'terms of service') { + console.log('Passed: terms of service link text matched as expected'); + } else { + errors.push(`Expected: "terms of service"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: terms of service link text font matched as expected'); + } else { + errors.push(`Expected: terms of service link text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //color -teal + if (elementColor === 'rgba(48, 200, 172, 1)') { + console.log('Passed: terms of service link text color matched as expected'); + } else { + errors.push(`Expected: terms of service link text color "rgba(48, 200, 172, 1)"; Actual: "${elementColor}"`); + } + + //font size + if (elementSize === '10px') { + console.log('Passed: ExACT AutoAlign, link text font-size matched as expected'); + } else { + errors.push(`Expected: ExACT AutoAlign, link text text font-size "10px"; Actual: "${elementSize}"`); + } + + //Throw summary if any validation failed + if (errors.length > 0) { + //Add summary line only when multiple checks failed + if (errors.length > 1) { + errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); + } + + //Throw collected messages — catch() will prefix with "FAILED:" + throw new Error(errors.join('\n')); + } + } + }, + + //Start Your Free Trial button + { + description: 'Validate Start Your Free Trial button', + action: async () => { + const multipleChecks = 'Start Your Free Trial'; + const element = await driver.findElement(By.css('.btn')); + + //Get text, color, and size + const elementText = await element.getAttribute('value'); + const elementFont = await element.getCssValue('font-family'); + const elementColor = await element.getCssValue('background-color'); + const elementSize = await element.getCssValue('font-size'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Start Your Free Trial') { + console.log('Passed: Start Your Free Trial button text matched as expected'); + } else { + errors.push(`Expected: "Start Your Free Trial"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Start Your Free Trial button text font matched as expected'); + } else { + errors.push(`Expected: Start Your Free Trial button text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //color -navy blue + if (elementColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Start Your Free Trial button background color matched as expected'); + } else { + errors.push(`Expected: Start Your Free Trial button background color "rgba(40, 39, 90, 1)"; Actual: "${elementColor}"`); + } + + //font size + if (elementSize === '16px') { + console.log('Passed: Start Your Free Trial button text font-size matched as expected'); + } else { + errors.push(`Expected: Start Your Free Trial button text font-size "16px"; Actual: "${elementSize}"`); + } + + //Throw summary if any validation failed + if (errors.length > 0) { + //Add summary line only when multiple checks failed + if (errors.length > 1) { + errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); + } + + //Throw collected messages — catch() will prefix with "FAILED:" + throw new Error(errors.join('\n')); + } + } + }, + + //edgate logo + { + description: 'Verify edgate logo is present', + action: async () => { + const expectedExactLogo = await driver.wait(until.elementLocated(By.css('.signuplogo > img')), 5000).catch(() => false); + if (expectedExactLogo) { + console.log('Passed: edgate logo present'); + } else { + errors.push('edgate logo not found'); + } + } + }, + + //Copyright 2026 + { + description: 'Validate Copyright 2026 text', + action: async () => { + const multipleChecks = 'Copyright 2026'; + const element = await driver.findElement(By.css('p:nth-child(2)')); + + //Get text, color, and size + const elementText = await element.getText(); + const elementFont = await element.getCssValue('font-family'); + const elementColor = await element.getCssValue('color'); + const elementSize = await element.getCssValue('font-size'); + + //Track all errors + const errors = []; + + //text + if (elementText === '© Copyright 2026 EdGate Correlation Services') { + console.log('Passed: © Copyright 2026 EdGate Correlation Services text matched as expected'); + } else { + errors.push(`Expected: "© Copyright 2026 EdGate Correlation Services"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: © Copyright 2026 EdGate Correlation Services text font matched as expected'); + } else { + errors.push(`Expected: © Copyright 2026 EdGate Correlation Services text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //color -navy blue + if (elementColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: © Copyright 2026 EdGate Correlation Services text color matched as expected'); + } else { + errors.push(`Expected: © Copyright 2026 EdGate Correlation Services text color "rgba(40, 39, 90, 1)"; Actual: "${elementColor}"`); + } + + //font size + if (elementSize === '12px') { + console.log('Passed: © Copyright 2026 EdGate Correlation Services text font-size matched as expected'); + } else { + errors.push(`Expected: © Copyright 2026 EdGate Correlation Services text text font-size "12px"; Actual: "${elementSize}"`); + } + + //Throw summary if any validation failed + if (errors.length > 0) { + //Add summary line only when multiple checks failed + if (errors.length > 1) { + errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); + } + + //Throw collected messages — catch() will prefix with "FAILED:" + throw new Error(errors.join('\n')); + } + } + }, + + //NEXT ACTION - Click Sign In link + { + description: 'Click Sign In link', + action: async () => { + await driver.findElement(By.linkText('Sign In')).click(); + console.log('----->| NEXT ACTION: Clicked Sign In link'); + console.log('---------->| RETURN TO LANDING PAGE|<----------'); + + //Wait until the element exists in the DOM + const pageTitle = await driver.wait( + until.elementLocated(By.css('.logo')), + 30000 + ); + + //Wait until it becomes visible + await driver.wait( + until.elementIsVisible(pageTitle), + 30000 + ); + + //Wait for page to load completely + await driver.wait(async () => { + const readyState = await driver.executeScript('return document.readyState'); + return readyState === 'complete'; + }, 30000, 'Landig page did not fully load within 30 seconds'); + console.log('Passed: Landing page loaded successfully'); + } + }, + + //Bullet Point 1 + { + description: 'Validate bullet point 1', + action: async () => { + const multipleChecks = 'Bullet point 1'; + const elementicon = await driver.wait(until.elementLocated(By.css('li:nth-child(1) img')), 5000).catch(() => false); + const element = await driver.findElement(By.css('li:nth-child(1) > .list-flex')); + + //Get icon, text, color, and size + const elementText = await element.getText(); + const elementFont = await element.getCssValue('font-family'); + const elementColor = await element.getCssValue('color'); + const elementSize = await element.getCssValue('font-size'); + + //Track all errors + const errors = []; + + //icon + if (elementicon) { + console.log('Passed: Bullet Point Icon 1 present'); + } else { + errors.push("Bullet Point Icon 1 not found"); + } + + //text + if (elementText === 'Learn more about ExACT AutoAlign, the AI-based alignment tool.') { + console.log('Passed: Bullet point 1 text matched as expected'); + } else { + errors.push(`Expected: "Learn more about ExACT AutoAlign, the AI-based alignment tool."; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Bullet point 1 text font matched as expected'); + } else { + errors.push(`Expected: Bullet point 1 text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //color -white + if (elementColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Bullet point 1 text color matched as expected'); + } else { + errors.push(`Expected: Bullet point 1 text color "rgba(255, 255, 255, 1)"; Actual: "${elementColor}"`); + } + + //font size + if (elementSize === '14px') { + console.log('Passed: Bullet point 1 text font-size matched as expected'); + } else { + errors.push(`Expected: Bullet point 1 text text font-size "14px"; Actual: "${elementSize}"`); + } + + //Throw summary if any validation failed + if (errors.length > 0) { + //Add summary line only when multiple checks failed + if (errors.length > 1) { + errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); + } + + //Throw collected messages — catch() will prefix with "FAILED:" + throw new Error(errors.join('\n')); + } + } + }, + + //ExACT AutoAlign, link + { + description: 'Validate ExACT AutoAlign, link', + action: async () => { + const multipleChecks = 'ExACT AutoAlign link'; + const element = await driver.findElement(By.linkText('ExACT AutoAlign,')); + + //Get href, text, color, and size + const linkHref = await element.getAttribute('href'); + const elementText = await element.getText(); + const elementFont = await element.getCssValue('font-family'); + const elementColor = await element.getCssValue('color'); + const elementSize = await element.getCssValue('font-size'); + + //Track all errors + const errors = []; + + //href + if (linkHref === 'https://edgate.com/systems/exact/autoalign') { + console.log('Passed: ExACT AutoAlign link URL matched as expected'); + } else { + errors.push(`Expected: "https://edgate.com/systems/exact/autoalign"; Actual: "${linkHref}"`); + } + + //text + if (elementText === 'ExACT AutoAlign,') { + console.log('Passed: ExACT AutoAlign, link text matched as expected'); + } else { + errors.push(`Expected: "ExACT AutoAlign,"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: ExACT AutoAlign, link text font matched as expected'); + } else { + errors.push(`Expected: ExACT AutoAlign, link text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //color -teal + if (elementColor === 'rgba(48, 200, 172, 1)') { + console.log('Passed: ExACT AutoAlign, link text color matched as expected'); + } else { + errors.push(`Expected: ExACT AutoAlign, link text color "rgba(48, 200, 172, 1)"; Actual: "${elementColor}"`); + } + + //font size + if (elementSize === '14px') { + console.log('Passed: ExACT AutoAlign, link text font-size matched as expected'); + } else { + errors.push(`Expected: ExACT AutoAlign, link text text font-size "14px"; Actual: "${elementSize}"`); + } + + //Throw summary if any validation failed + if (errors.length > 0) { + //Add summary line only when multiple checks failed + if (errors.length > 1) { + errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); + } + + //Throw collected messages — catch() will prefix with "FAILED:" + throw new Error(errors.join('\n')); + } + } + }, + + //Bullet Point 2 + { + description: 'Validate bullet point 2', + action: async () => { + const multipleChecks = 'Bullet point 2'; + const elementicon = await driver.wait(until.elementLocated(By.css('li:nth-child(2) img')), 5000).catch(() => false); + const element = await driver.findElement(By.css('li:nth-child(2) > .list-flex')); + + //Get icon, text, color, and size + const elementText = await element.getText(); + const elementFont = await element.getCssValue('font-family'); + const elementColor = await element.getCssValue('color'); + const elementSize = await element.getCssValue('font-size'); + + //Track all errors + const errors = []; + + //icon + if (elementicon) { + console.log('Passed: Bullet Point Icon 2 present'); + } else { + errors.push("Bullet Point Icon 2 not found"); + } + + //text + if (elementText === 'See your Correlation Analytics.') { + console.log('Passed: Bullet point 2 text matched as expected'); + } else { + errors.push(`Expected: "See your Correlation Analytics."; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Bullet point 2 text font matched as expected'); + } else { + errors.push(`Expected: Bullet point 2 text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //color -white + if (elementColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Bullet point 2 text color matched as expected'); + } else { + errors.push(`Expected: Bullet point 2 text color "rgba(255, 255, 255, 1)"; Actual: "${elementColor}"`); + } + + //font size + if (elementSize === '14px') { + console.log('Passed: Bullet point 2 text font-size matched as expected'); + } else { + errors.push(`Expected: Bullet point 2 text text font-size "14px"; Actual: "${elementSize}"`); + } + + //Throw summary if any validation failed + if (errors.length > 0) { + //Add summary line only when multiple checks failed + if (errors.length > 1) { + errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); + } + + //Throw collected messages — catch() will prefix with "FAILED:" + throw new Error(errors.join('\n')); + } + } + }, + + //Correlation Analytics. link + { + description: 'Validate Correlation Analytics. link', + action: async () => { + const multipleChecks = 'Correlation Analytics link'; + const element = await driver.findElement(By.linkText('Correlation Analytics.')); + + //Get href, text, color, and size + const linkHref = await element.getAttribute('href'); + const elementText = await element.getText(); + const elementFont = await element.getCssValue('font-family'); + const elementColor = await element.getCssValue('color'); + const elementSize = await element.getCssValue('font-size'); + + //Track all errors + const errors = []; + + //href + if (linkHref === 'https://edgate.com/systems/exact/analytics') { + console.log('Passed: Correlation Analytics link URL matched as expected'); + } else { + errors.push(`Expected: "https://edgate.com/systems/exact/analytics"; Actual: "${linkHref}"`); + } + + //text + if (elementText === 'Correlation Analytics.') { + console.log('Passed: Correlation Analytics. link text matched as expected'); + } else { + errors.push(`Expected: "Correlation Analytics."; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Correlation Analytics. link text font matched as expected'); + } else { + errors.push(`Expected: Correlation Analytics. link text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //color -teal + if (elementColor === 'rgba(48, 200, 172, 1)') { + console.log('Passed: Correlation Analytics. link text color matched as expected'); + } else { + errors.push(`Expected: Correlation Analytics. link text color "rgba(48, 200, 172, 1)"; Actual: "${elementColor}"`); + } + + //font size + if (elementSize === '14px') { + console.log('Passed: Correlation Analytics. link text font-size matched as expected'); + } else { + errors.push(`Expected: Correlation Analytics. link text text font-size "14px"; Actual: "${elementSize}"`); + } + + //Throw summary if any validation failed + if (errors.length > 0) { + //Add summary line only when multiple checks failed + if (errors.length > 1) { + errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); + } + + //Throw collected messages — catch() will prefix with "FAILED:" + throw new Error(errors.join('\n')); + } + } + }, + + //Bullet Point 3 + { + description: 'Validate bullet point 3', + action: async () => { + const multipleChecks = 'Bullet point 3'; + const elementicon = await driver.wait(until.elementLocated(By.css('li:nth-child(3) img')), 5000).catch(() => false); + const element = await driver.findElement(By.css('li:nth-child(3) > .list-flex')); + + //Get icon, text, color, and size + const elementText = await element.getText(); + const elementFont = await element.getCssValue('font-family'); + const elementColor = await element.getCssValue('color'); + const elementSize = await element.getCssValue('font-size'); + + //Track all errors + const errors = []; + + //icon + if (elementicon) { + console.log('Passed: Bullet Point Icon 3 present'); + } else { + errors.push("Bullet Point Icon 3 not found"); + } + + //text + if (elementText === 'Explore how your Content maps to International Standards.') { + console.log('Passed: Bullet point 3 text matched as expected'); + } else { + errors.push(`Expected: "Explore how your Content maps to International Standards."; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Bullet point 3 text font matched as expected'); + } else { + errors.push(`Expected: Bullet point 3 text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //color -white + if (elementColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Bullet point 3 text color matched as expected'); + } else { + errors.push(`Expected: Bullet point 3 text color "rgba(255, 255, 255, 1)"; Actual: "${elementColor}"`); + } + + //font size + if (elementSize === '14px') { + console.log('Passed: Bullet point 3 text font-size matched as expected'); + } else { + errors.push(`Expected: Bullet point 3 text text font-size "14px"; Actual: "${elementSize}"`); + } + + //Throw summary if any validation failed + if (errors.length > 0) { + //Add summary line only when multiple checks failed + if (errors.length > 1) { + errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); + } + + //Throw collected messages — catch() will prefix with "FAILED:" + throw new Error(errors.join('\n')); + } + } + }, + + //International Standards. link + { + description: 'Validate International Standards. link', + action: async () => { + const multipleChecks = 'International Standards link'; + const element = await driver.findElement(By.linkText('International Standards.')); + + //Get href, text, color, and size + const linkHref = await element.getAttribute('href'); + const elementText = await element.getText(); + const elementFont = await element.getCssValue('font-family'); + const elementColor = await element.getCssValue('color'); + const elementSize = await element.getCssValue('font-size'); + + //Track all errors + const errors = []; + + //href + if (linkHref === 'https://edgate.com/standards/international') { + console.log('Passed: International Standards link URL matched as expected'); + } else { + errors.push(`Expected: "https://edgate.com/standards/international"; Actual: "${linkHref}"`); + } + + //text + if (elementText === 'International Standards.') { + console.log('Passed: International Standards. link text matched as expected'); + } else { + errors.push(`Expected: "International Standards."; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: International Standards. link text font matched as expected'); + } else { + errors.push(`Expected: International Standards. link text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //color -teal + if (elementColor === 'rgba(48, 200, 172, 1)') { + console.log('Passed: International Standards. link text color matched as expected'); + } else { + errors.push(`Expected: International Standards. link text color "rgba(48, 200, 172, 1)"; Actual: "${elementColor}"`); + } + + //font size + if (elementSize === '14px') { + console.log('Passed: International Standards. link text font-size matched as expected'); + } else { + errors.push(`Expected: International Standards. link text text font-size "14px"; Actual: "${elementSize}"`); + } + + //Throw summary if any validation failed + if (errors.length > 0) { + //Add summary line only when multiple checks failed + if (errors.length > 1) { + errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); + } + + //Throw collected messages — catch() will prefix with "FAILED:" + throw new Error(errors.join('\n')); + } + } + }, + + //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 { + errors.push('ExACT logo not found'); + } + } + }, + + //Welcome Back + { + description: 'Validate Welcome Back', + action: async () => { + const multipleChecks = 'Welcome Back!'; + const element = await driver.findElement(By.css('#formLogin > p')); + const elementicon = await driver.wait(until.elementLocated(By.css('p > img')), 5000).catch(() => false); + + //Get icon, text, color, and size + const elementText = await element.getText(); + const elementFont = await element.getCssValue('font-family'); + const elementColor = await element.getCssValue('color'); + const elementSize = await element.getCssValue('font-size'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'WELCOME BACK!') { + console.log('Passed: Welcome Back text matched as expected'); + } else { + errors.push(`Expected: "WELCOME BACK!"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Welcome Back text font matched as expected'); + } else { + errors.push(`Expected: Welcome Back text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //color -gray + if (elementColor === 'rgba(117, 117, 117, 1)') { + console.log('Passed: Welcome Back text color matched as expected'); + } else { + errors.push(`Expected: Welcome Back text color "rgba(117, 117, 117, 1)"; Actual: "${elementColor}"`); + } + + //font size + if (elementSize === '14px') { + console.log('Passed: Welcome Back text font-size matched as expected'); + } else { + errors.push(`Expected: Welcome Back text text font-size "14px"; Actual: "${elementSize}"`); + } + + //icon + if (elementicon) { + console.log('Passed: Welcome Back Icon present'); + } else { + errors.push("Welcome Back Icon not found"); + } + + //Throw summary if any validation failed + if (errors.length > 0) { + //Add summary line only when multiple checks failed + if (errors.length > 1) { + errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); + } + + //Throw collected messages — catch() will prefix with "FAILED:" + throw new Error(errors.join('\n')); + } + } + }, + + //Login header + { + description: 'Validate Login header text', + action: async () => { + const multipleChecks = 'Login to your account'; + const element = await driver.findElement(By.css('h2:nth-child(3)')); + + //Get text, color, and size + const elementText = await element.getText(); + const elementFont = await element.getCssValue('font-family'); + const elementColor = await element.getCssValue('color'); + const elementSize = await element.getCssValue('font-size'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Login to your account') { + console.log('Passed: Login header text matched as expected'); + } else { + errors.push(`Expected: "Login to your account"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === `"DM Serif Display", serif`) { + console.log('Passed: Login header text font matched as expected'); + } else { + errors.push(`Expected: Login header text font "DM Serif Display", serif; Actual: ${elementFont}`); + } + + //color -navy blue + if (elementColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Login header text color matched as expected'); + } else { + errors.push(`Expected: Login header text color "rgba(40, 39, 90, 1)"; Actual: "${elementColor}"`); + } + + //font size + if (elementSize === '32px') { + console.log('Passed: Login header text font-size matched as expected'); + } else { + errors.push(`Expected: Login header text font-size "32px"; Actual: "${elementSize}"`); + } + + //Throw summary if any validation failed + if (errors.length > 0) { + //Add summary line only when multiple checks failed + if (errors.length > 1) { + errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); + } + + //Throw collected messages — catch() will prefix with "FAILED:" + throw new Error(errors.join('\n')); } - console.log('Passed: Login title text font-size matched as expected'); } }, @@ -334,35 +3190,139 @@ const steps = [ { description: 'Validate Username label text', action: async () => { - const elementText = await driver.findElement(By.css('.form-group:nth-child(5) > label')).getText(); - if (elementText !== expectedUsernameLabel) { - throw new Error(`Expected: "${expectedUsernameLabel}"; Actual: "${elementText}"`); + const multipleChecks = 'Username label'; + const element = await driver.findElement(By.css('.form-group:nth-child(4) > label')); + + //Get text, color, and size + const elementText = await element.getText(); + const elementFont = await element.getCssValue('font-family'); + const elementColor = await element.getCssValue('color'); + const elementSize = await element.getCssValue('font-size'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Username') { + console.log('Passed: Username label text matched as expected'); + } else { + errors.push(`Expected: "Username"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Username label text font matched as expected'); + } else { + errors.push(`Expected: Username label text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //color -navy blue + if (elementColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Username label text color matched as expected'); + } else { + errors.push(`Expected: Username label text color "rgba(40, 39, 90, 1)"; Actual: "${elementColor}"`); + } + + //font size + if (elementSize === '14px') { + console.log('Passed: Username label text font-size matched as expected'); + } else { + errors.push(`Expected: Username label text font-size "14px"; Actual: "${elementSize}"`); + } + + //Throw summary if any validation failed + if (errors.length > 0) { + //Add summary line only when multiple checks failed + if (errors.length > 1) { + errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); + } + + //Throw collected messages — catch() will prefix with "FAILED:" + throw new Error(errors.join('\n')); } - console.log('Passed: Username label text matched as expected'); } }, - //Username label text color -navy blue + //Username textbox { - description: 'Validate Username label text color', + description: 'Validate Username textbox', action: async () => { - const elementStyle = await driver.findElement(By.css('.form-group:nth-child(5) > label')).getCssValue('color'); - 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'); - } - }, + const multipleChecks = 'Username textbox'; + const element = await driver.findElement(By.css('.form-control:nth-child(2)')); - //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) { - throw new Error(`Username placeholder text Expected: "${expectedUsernamePlaceholder}"; Actual: "${elementValue}"`); + //Get text, color, and size + const elementText = await element.getAttribute('placeholder'); + + //Get placeholder styles via executeScript since it's a pseudo-element + const elementFont = await driver.executeScript( + `return window.getComputedStyle(arguments[0], '::placeholder').getPropertyValue('font-family')`, + element + ); + const elementColor = await driver.executeScript( + `return window.getComputedStyle(arguments[0], '::placeholder').getPropertyValue('color')`, + element + ); + const elementSize = await driver.executeScript( + `return window.getComputedStyle(arguments[0], '::placeholder').getPropertyValue('font-size')`, + element + ); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Username') { + console.log('Passed: Username placeholder text matched as expected'); + } else { + errors.push(`Expected: "Username" placeholder; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Username placeholder text font matched as expected'); + } else { + errors.push(`Expected: Username placeholder text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //color -gray + if (elementColor === 'rgb(108, 117, 125)') { + console.log('Passed: Username placeholder text color matched as expected'); + } else { + errors.push(`Expected: Username placeholder text color "rgb(108, 117, 125)"; Actual: "${elementColor}"`); + } + + //font size + if (elementSize === '12.6px') { + console.log('Passed: Username placeholder text font-size matched as expected'); + } else { + errors.push(`Expected: Username placeholder text font-size "12.6px"; Actual: "${elementSize}"`); + } + + //Trigger validation by clicking login button without filling in the field + await driver.findElement(By.css('.login')).click(); + console.log('----->| NEXT ACTION: Clicked Login button without entering credentials'); + await driver.sleep(500); + + //Check native HTML5 validation message + const validationMessage = await driver.executeScript(` + return document.querySelector('input[name="username"]').validationMessage; + `); + + if (validationMessage === 'Please fill out this field.') { + console.log('Passed: Username validation message matched as expected'); + } else { + errors.push(`Expected: "Please fill out this field." validation message; Actual: "${validationMessage}"`); + } + + //Throw summary if any validation failed + if (errors.length > 0) { + //Add summary line only when multiple checks failed + if (errors.length > 1) { + errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); + } + //Throw collected messages — catch() will prefix with "FAILED:" + throw new Error(errors.join('\n')); } - console.log('Passed: Username placeholder text matched as expected'); } }, @@ -370,47 +3330,284 @@ const steps = [ { description: 'Validate Password label text', action: async () => { - const elementText = await driver.findElement(By.css('.form-group:nth-child(6) > label')).getText(); - if (elementText !== expectedPasswordLabel) { - throw new Error(`Expected: "${expectedPasswordLabel}"; Actual: "${elementText}"`); + const multipleChecks = 'Password label'; + const element = await driver.findElement(By.css('.form-group:nth-child(5) > label')); + + //Get text, color, and size + const elementText = await element.getText(); + const elementFont = await element.getCssValue('font-family'); + const elementColor = await element.getCssValue('color'); + const elementSize = await element.getCssValue('font-size'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Password') { + console.log('Passed: Password label text matched as expected'); + } else { + errors.push(`Expected: "Password"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Password label text font matched as expected'); + } else { + errors.push(`Expected: Password label text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //color -navy blue + if (elementColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Password label text color matched as expected'); + } else { + errors.push(`Expected:Password label text color "rgba(40, 39, 90, 1)"; Actual: "${elementColor}"`); + } + + //font size + if (elementSize === '14px') { + console.log('Passed: Password label text font-size matched as expected'); + } else { + errors.push(`Expected: Password label text font-size "14px"; Actual: "${elementSize}"`); + } + + //Throw summary if any validation failed + if (errors.length > 0) { + //Add summary line only when multiple checks failed + if (errors.length > 1) { + errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); + } + + //Throw collected messages — catch() will prefix with "FAILED:" + throw new Error(errors.join('\n')); } - console.log('Passed: Password label text matched as expected'); } }, - //Password label text color -navy blue + //Password textbox { - description: 'Validate Password label text color', + description: 'Validate Password textbox', action: async () => { - const elementStyle = await driver.findElement(By.css('.form-group:nth-child(6) > label')).getCssValue('color'); - if (elementStyle !== 'rgba(40, 39, 90, 1)') { - throw new Error(`Password label text color did not match; Actual: "${elementStyle}"`); + const multipleChecks = 'Password textbox'; + const element = await driver.findElement(By.css('.passfield')); + + //Get text, color, and size + const elementText = await element.getAttribute('placeholder'); + + //Get placeholder styles via executeScript since it's a pseudo-element + const elementFont = await driver.executeScript( + `return window.getComputedStyle(arguments[0], '::placeholder').getPropertyValue('font-family')`, + element + ); + const elementColor = await driver.executeScript( + `return window.getComputedStyle(arguments[0], '::placeholder').getPropertyValue('color')`, + element + ); + const elementSize = await driver.executeScript( + `return window.getComputedStyle(arguments[0], '::placeholder').getPropertyValue('font-size')`, + element + ); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Password') { + console.log('Passed: Password placeholder text matched as expected'); + } else { + errors.push(`Expected: "Password" placeholder; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Password placeholder text font matched as expected'); + } else { + errors.push(`Expected: Password placeholder text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //color -gray + if (elementColor === 'rgb(108, 117, 125)') { + console.log('Passed: Password placeholder text color matched as expected'); + } else { + errors.push(`Expected: Password placeholder text color "rgb(108, 117, 125)"; Actual: "${elementColor}"`); + } + + //font size + if (elementSize === '12.6px') { + console.log('Passed: Password placeholder text font-size matched as expected'); + } else { + errors.push(`Expected: Password placeholder text font-size "12.6px"; Actual: "${elementSize}"`); + } + + //Trigger validation by clicking login button without filling in the field + await driver.findElement(By.css('.form-control:nth-child(2)')).sendKeys('Edgate1'); + console.log('----->| NEXT ACTION: Entered incorrect username and left password field empty'); + + await driver.findElement(By.css('.login')).click(); + console.log('----->| NEXT ACTION: Clicked Login button'); + await driver.sleep(500); + + //Check native HTML5 validation message + const validationMessage = await driver.executeScript(` + return document.querySelector('input[name="password"]').validationMessage; + `); + + if (validationMessage === 'Please fill out this field.') { + console.log('Passed: Username validation message matched as expected'); + } else { + errors.push(`Expected: "Please fill out this field." validation message; Actual: "${validationMessage}"`); + } + + //Throw summary if any validation failed + if (errors.length > 0) { + //Add summary line only when multiple checks failed + if (errors.length > 1) { + errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); + } + + //Throw collected messages — catch() will prefix with "FAILED:" + throw new Error(errors.join('\n')); } - console.log('Passed: Password label text color matched as expected'); } }, - //Password textbox placeholder + //Incorrect password validation { - description: 'Validate Password placeholder text', + description: 'Validate Incorrect password validation', action: async () => { - const elementValue = await driver.findElement(By.css('.passfield')).getAttribute('placeholder'); - if (elementValue !== expectedPasswordPlaceholder) { - throw new Error(`Password placeholder text Expected: "${expectedPasswordPlaceholder}"; Actual: "${elementValue}"`); + const multipleChecks = 'Incorrect Password'; + + //Track all errors + const errors = []; + + await driver.findElement(By.css('.passfield')).sendKeys('Edgate123'); + console.log('----->| NEXT ACTION: Entered incorrect password'); + + await driver.findElement(By.css('.login')).click(); + console.log('----->| NEXT ACTION: Clicked Login button'); + await driver.sleep(500); + + //Wait until the element exists in the DOM + const elementVisible = await driver.wait( + until.elementLocated(By.css('.alert')), + 20000 + ); + + //Wait until it becomes visible + await driver.wait( + until.elementIsVisible(elementVisible), + 20000 + ); + await driver.sleep(2000); + + //Get text, color, and size + const elementText = await elementVisible.getText(); + const elementFont = await elementVisible.getCssValue('font-family'); + const elementColor = await elementVisible.getCssValue('background-color'); + const elementSize = await elementVisible.getCssValue('font-size'); + + //text + if (elementText === 'Authentication Failed. Please check the username and password you entered and try again.') { + console.log('Passed: Alert text matched as expected'); + } else { + errors.push(`Expected: Alert message "Authentication Failed. Please check the username and password you entered and try again."; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Alert text font matched as expected'); + } else { + errors.push(`Expected: Alert text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //color -red/orange + if (elementColor === 'rgba(231, 76, 60, 0.88)') { + console.log('Passed: Alert text color matched as expected'); + } else { + errors.push(`Expected: Alert text color "rgba(231, 76, 60, 0.88)"; Actual: "${elementColor}"`); + } + + //font size + if (elementSize === '13px') { + console.log('Passed: Alert text font-size matched as expected'); + } else { + errors.push(`Expected: Alert text font-size "13px"; Actual: "${elementSize}"`); + } + + //Throw summary if any validation failed + if (errors.length > 0) { + //Add summary line only when multiple checks failed + if (errors.length > 1) { + errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); + } + + //Throw collected messages — catch() will prefix with "FAILED:" + throw new Error(errors.join('\n')); } - console.log('Passed: Password placeholder text matched as expected'); } }, - //Forgot password text link color -navy blue + //Forgot password { - description: 'Validate Forgot Password link text color', + description: 'Validate Forgot Password link', action: async () => { - const elementStyle = await driver.findElement(By.linkText('Forgot Password?')).getCssValue('color'); - if (elementStyle !== 'rgba(40, 39, 90, 1)') { - throw new Error(`Forgot password link text color did not match; Actual: "${elementStyle}"`); + const multipleChecks = 'Forgot Password?'; + const element = await driver.findElement(By.linkText('Forgot Password?')); + + //Get href, text, color, and size + const linkHref = await element.getAttribute('href'); + const elementText = await element.getText(); + const elementFont = await element.getCssValue('font-family'); + const elementColor = await element.getCssValue('color'); + const elementSize = await element.getCssValue('font-size'); + + //Track all errors + const errors = []; + + //href + if (linkHref === 'https://correlation.edgate.com/exact/forgot.php') { + console.log('Passed: Forgot Password? link URL matched as expected'); + } else { + errors.push(`Expected: "https://correlation.edgate.com/exact/forgot.php"; Actual: "${linkHref}"`); + } + + //text + if (elementText === 'Forgot Password?') { + console.log('Passed: Forgot password link text matched as expected'); + } else { + errors.push(`Expected: "Forgot Password?"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Forgot password link text font matched as expected'); + } else { + errors.push(`Expected: Forgot password link text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //color -navy blue + if (elementColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Forgot password link text color matched as expected'); + } else { + errors.push(`Expected: Forgot password link text color "rgba(40, 39, 90, 1)"; Actual: "${elementColor}"`); + } + + //font size + if (elementSize === '12px') { + console.log('Passed: Forgot password link text font-size matched as expected'); + } else { + errors.push(`Expected: Forgot password link text font-size "12px"; Actual: "${elementSize}"`); + } + + //Throw summary if any validation failed + if (errors.length > 0) { + //Add summary line only when multiple checks failed + if (errors.length > 1) { + errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); + } + + //Throw collected messages — catch() will prefix with "FAILED:" + throw new Error(errors.join('\n')); } - console.log('Passed: Forgot password link text color matched as expected'); } }, @@ -418,23 +3615,56 @@ const steps = [ { description: 'Validate Login button text', action: async () => { - const elementText = await driver.findElement(By.css('.login')).getAttribute('value'); - if (elementText !== expectedLoginButtonText) { - throw new Error(`Expected: "${expectedLoginButtonText}"; Actual: "${elementText}"`); - } - console.log('Passed: Login button text matched as expected'); - } - }, + const multipleChecks = 'Login Button'; + const element = await driver.findElement(By.css('.login')); - //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 !== 'rgba(48, 200, 172, 1)') { - throw new Error(`Login button background color did not match; Actual: "${elementStyle}"`); + //Get text, color, and size + const elementText = await element.getAttribute('value'); + const elementFont = await element.getCssValue('font-family'); + const elementColor = await element.getCssValue('background-color'); + const elementSize = await element.getCssValue('font-size'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Login') { + console.log('Passed: Login button text matched as expected'); + } else { + errors.push(`Expected: "Login"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Login button text font matched as expected'); + } else { + errors.push(`Expected: Login buttonk text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //color -teal + if (elementColor === 'rgba(48, 200, 172, 1)') { + console.log('Passed: Login button text background color matched as expected'); + } else { + errors.push(`Expected: Login button text background color "rgba(48, 200, 172, 1)"; Actual: "${elementColor}"`); + } + + //font size + if (elementSize === '16px') { + console.log('Passed: Login button text font-size matched as expected'); + } else { + errors.push(`Expected: Login button text font-size "16px"; Actual: "${elementSize}"`); + } + + //Throw summary if any validation failed + if (errors.length > 0) { + //Add summary line only when multiple checks failed + if (errors.length > 1) { + errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); + } + + //Throw collected messages — catch() will prefix with "FAILED:" + throw new Error(errors.join('\n')); } - console.log('Passed: Login button background color matched as expected'); } }, @@ -442,47 +3672,1116 @@ const steps = [ { description: 'Validate Dont have account text', action: async () => { - const elementText = await driver.findElement(By.css('p:nth-child(1)')).getText(); - if (elementText !== expectedDontHaveAccountText) { - throw new Error(`Expected: "${expectedDontHaveAccountText}"; Actual: "${elementText}"`); + const multipleChecks = `Don't Have an account?`; + const element = await driver.findElement(By.css('p:nth-child(1)')); + + //Get text, color, and size + const elementText = await element.getText(); + const elementFont = await element.getCssValue('font-family'); + const elementColor = await element.getCssValue('color'); + const elementSize = await element.getCssValue('font-size'); + + //Track all errors + const errors = []; + + //text + if (elementText === `DON'T HAVE AN ACCOUNT?`) { + console.log('Passed: Dont have an account text matched as expected'); + } else { + errors.push(`Expected: "DON'T HAVE AN ACCOUNT?"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Dont have an account text font matched as expected'); + } else { + errors.push(`Expected: Dont have an account text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //color -black + if (elementColor === 'rgba(32, 32, 32, 1)') { + console.log('Passed: Dont have an account text color matched as expected'); + } else { + errors.push(`Expected: Dont have an account text color "rgba(32, 32, 32, 1)"; Actual: "${elementColor}"`); + } + + //font size + if (elementSize === '14px') { + console.log('Passed: Dont have an account text font-size matched as expected'); + } else { + errors.push(`Expected: Dont have an account text font-size "14px"; Actual: "${elementSize}"`); + } + + //Throw summary if any validation failed + if (errors.length > 0) { + //Add summary line only when multiple checks failed + if (errors.length > 1) { + errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); + } + + //Throw collected messages — catch() will prefix with "FAILED:" + throw new Error(errors.join('\n')); } - console.log('Passed: Dont have an account text matched as expected'); } }, - //Free trial button text + //Free trial button { - description: 'Validate Free trial button text', + description: 'Validate Free trial button', action: async () => { - const elementText = await driver.findElement(By.css('.btn > span')).getText(); - if (elementText !== expectedFreeTrialButtonText) { - throw new Error(`Expected: "${expectedFreeTrialButtonText}"; Actual: "${elementText}"`); + const multipleChecks = 'Free Trial'; + const element = await driver.findElement(By.linkText('Sign up for a 30 Day Free Trial')); + + //Get href, text, color, and size + const linkHref = await element.getAttribute('href'); + const elementText = await element.getText(''); + const elementFont = await element.getCssValue('font-family'); + const elementColor = await element.getCssValue('background-color'); + const elementSize = await element.getCssValue('font-size'); + + //Track all errors + const errors = []; + + //href + if (linkHref === 'https://correlation.edgate.com/exact/trial-registration.php') { + console.log('Passed: Sign up for a 30 Day Free Trial link URL matched as expected'); + } else { + errors.push(`Expected: "2"; Actual: "${linkHref}"`); + } + + //text + if (elementText === 'Sign up for a 30 Day Free Trial') { + console.log('Passed: Free trial button text matched as expected'); + } else { + errors.push(`Expected: "Sign up for a 30 Day Free Trial"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Free trial button text font matched as expected'); + } else { + errors.push(`Expected: Free trial button text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //color -white + if (elementColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Free trial button background color matched as expected'); + } else { + errors.push(`Expected: Free trial button background color "rgba(255, 255, 255, 1)"; Actual: "${elementColor}"`); + } + + //font size + if (elementSize === '16px') { + console.log('Passed: Free trial button text font-size matched as expected'); + } else { + errors.push(`Expected: Free trial button text font-size "16px"; Actual: "${elementSize}"`); + } + + //Throw summary if any validation failed + if (errors.length > 0) { + //Add summary line only when multiple checks failed + if (errors.length > 1) { + errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); + } + + //Throw collected messages — catch() will prefix with "FAILED:" + throw new Error(errors.join('\n')); } - console.log('Passed: Free trial button text matched as expected'); } }, - //Free trial button background color -white + //EdGate copyright logo { - description: 'Validate Free trial button background color', - action: async () => { - const elementStyle = await driver.findElement(By.css('.btn > span')).getCssValue('background-color'); - 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'); - } - }, - - //EdGate copyright image - { - description: 'Verify EdGate copyright image is present', + description: 'Verify EdGate copyright logo is present', action: async () => { const expectedEdGateCopyright = await driver.wait(until.elementLocated(By.css('.logincopyright > img')), 5000).catch(() => false); - if (!expectedEdGateCopyright) { - throw new Error('EdGate copyright not found'); + if (expectedEdGateCopyright) { + console.log('Passed: EdGate copyright logo present'); + } else { + errors.push("EdGate copyright logo not found"); + } + } + }, + + //NEXT ACTION - Click Forgot password link + { + description: 'Click Forgot password link', + action: async () => { + await driver.findElement(By.linkText('Forgot Password?')).click(); + console.log('----->| NEXT ACTION: Clicked Forgot Password? link'); + console.log('---------->| PASSWORD RECOVERY PAGE|<----------'); + + //Wait until the element exists in the DOM + const recoverUsername = await driver.wait( + until.elementLocated(By.css('#username')), + 30000 + ); + + //Wait until it becomes visible + await driver.wait( + until.elementIsVisible(recoverUsername), + 30000 + ); + } + }, + + //Recover Username textbox + { + description: 'Validate Recover Username textbox', + action: async () => { + const multipleChecks = 'Recover Username textbox'; + const element = await driver.findElement(By.css('#username')); + + //Get text, color, and size + const elementText = await element.getAttribute('placeholder'); + + //Get placeholder styles via executeScript since it's a pseudo-element + const elementFont = await driver.executeScript( + `return window.getComputedStyle(arguments[0], '::placeholder').getPropertyValue('font-family')`, + element + ); + const elementColor = await driver.executeScript( + `return window.getComputedStyle(arguments[0], '::placeholder').getPropertyValue('color')`, + element + ); + const elementSize = await driver.executeScript( + `return window.getComputedStyle(arguments[0], '::placeholder').getPropertyValue('font-size')`, + element + ); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Username') { + console.log('Passed: Username placeholder text matched as expected'); + } else { + errors.push(`Expected: "Username" placeholder; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Username placeholder text font matched as expected'); + } else { + errors.push(`Expected: Username placeholder text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //color -gray + if (elementColor === 'rgb(108, 117, 125)') { + console.log('Passed: Username placeholder text color matched as expected'); + } else { + errors.push(`Expected: Username placeholder text color "rgb(108, 117, 125)"; Actual: "${elementColor}"`); + } + + //font size + if (elementSize === '12.6px') { + console.log('Passed: Username placeholder text font-size matched as expected'); + } else { + errors.push(`Expected: Username placeholder text font-size "12.6px"; Actual: "${elementSize}"`); + } + + //Trigger validation by clicking submit button without filling in the field + await driver.findElement(By.css('.btn')).click(); + console.log('----->| NEXT ACTION: Clicked Submit button without entering username'); + await driver.sleep(500); + + //Check native HTML5 validation message + const validationMessage = await driver.executeScript(` + return document.querySelector('input[name="username"]').validationMessage; + `); + + if (validationMessage === 'Please fill out this field.') { + console.log('Passed: Username validation message matched as expected'); + } else { + errors.push(`Expected: "Please fill out this field." validation message; Actual: "${validationMessage}"`); + } + + //Throw summary if any validation failed + if (errors.length > 0) { + //Add summary line only when multiple checks failed + if (errors.length > 1) { + errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); + } + //Throw collected messages — catch() will prefix with "FAILED:" + throw new Error(errors.join('\n')); + } + } + }, + + //Submit button text (alt to .getText) + { + description: 'Validate Submit button text', + action: async () => { + const multipleChecks = 'Submit Button'; + const element = await driver.findElement(By.css('.btn')); + + //Get text, color, and size + const elementText = await element.getAttribute('value'); + const elementFont = await element.getCssValue('font-family'); + const elementColor = await element.getCssValue('background-color'); + const elementSize = await element.getCssValue('font-size'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Submit') { + console.log('Passed: Submit button text matched as expected'); + } else { + errors.push(`Expected: "Submit"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Submit button text font matched as expected'); + } else { + errors.push(`Expected: Submit buttonk text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //color -teal + if (elementColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Submit button text background color matched as expected'); + } else { + errors.push(`Expected: Submit button text background color "rgba(40, 39, 90, 1)"; Actual: "${elementColor}"`); + } + + //font size + if (elementSize === '16px') { + console.log('Passed: Submit button text font-size matched as expected'); + } else { + errors.push(`Expected: Submit button text font-size "16px"; Actual: "${elementSize}"`); + } + + //Throw summary if any validation failed + if (errors.length > 0) { + //Add summary line only when multiple checks failed + if (errors.length > 1) { + errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); + } + + //Throw collected messages — catch() will prefix with "FAILED:" + throw new Error(errors.join('\n')); + } + } + }, + + //Back to Login link + { + description: 'Validate Back to Login link', + action: async () => { + const multipleChecks = '< Back to Login'; + const element = await driver.findElement(By.linkText('< Back to Login')); + + //Get text, color, and size + const linkHref = await element.getAttribute('href'); + const elementText = await element.getText(); + const elementFont = await element.getCssValue('font-family'); + const elementColor = await element.getCssValue('color'); + const elementSize = await element.getCssValue('font-size'); + + //Track all errors + const errors = []; + + //href + if (linkHref === 'https://correlation.edgate.com/exact/login.php') { + console.log('Passed: < Back to Login link URL matched as expected'); + } else { + errors.push(`Expected: "https://correlation.edgate.com/exact/login.php"; Actual: "${linkHref}"`); + } + + //text + if (elementText === '< Back to Login') { + console.log('Passed: < Back to Login link text matched as expected'); + } else { + errors.push(`Expected: "< Back to Login"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: < Back to Login link text font matched as expected'); + } else { + errors.push(`Expected: < Back to Login link text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //color -navy blue + if (elementColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: < Back to Login link text color matched as expected'); + } else { + errors.push(`Expected: < Back to Login link text color "rgba(40, 39, 90, 1)"; Actual: "${elementColor}"`); + } + + //font size + if (elementSize === '12px') { + console.log('Passed: < Back to Login link text font-size matched as expected'); + } else { + errors.push(`Expected: < Back to Login link text font-size "12px"; Actual: "${elementSize}"`); + } + + //Throw summary if any validation failed + if (errors.length > 0) { + //Add summary line only when multiple checks failed + if (errors.length > 1) { + errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); + } + + //Throw collected messages — catch() will prefix with "FAILED:" + throw new Error(errors.join('\n')); + } + } + }, + + //NEXT ACTION - Click Back to Login link + { + description: 'Click Back to Login link', + action: async () => { + await driver.findElement(By.linkText('< Back to Login')).click(); + console.log('----->| NEXT ACTION: Clicked < Back to Login link'); + console.log('---------->| SIGN UP PAGE|<----------'); + + //Wait until the element exists in the DOM + const pageTitle = await driver.wait( + until.elementLocated(By.css('h2:nth-child(1)')), + 30000 + ); + + //Wait until it becomes visible + await driver.wait( + until.elementIsVisible(pageTitle), + 30000 + ); + } + }, + + //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 { + errors.push('ExACT logo not found'); + } + } + }, + + //Welcome Back + { + description: 'Validate Welcome Back', + action: async () => { + const multipleChecks = 'Welcome Back!'; + const element = await driver.findElement(By.css('#formLogin > p')); + const elementicon = await driver.wait(until.elementLocated(By.css('p > img')), 5000).catch(() => false); + + //Get icon, text, color, and size + const elementText = await element.getText(); + const elementFont = await element.getCssValue('font-family'); + const elementColor = await element.getCssValue('color'); + const elementSize = await element.getCssValue('font-size'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'WELCOME BACK!') { + console.log('Passed: Welcome Back text matched as expected'); + } else { + errors.push(`Expected: "WELCOME BACK!"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Welcome Back text font matched as expected'); + } else { + errors.push(`Expected: Welcome Back text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //color -gray + if (elementColor === 'rgba(117, 117, 117, 1)') { + console.log('Passed: Welcome Back text color matched as expected'); + } else { + errors.push(`Expected: Welcome Back text color "rgba(117, 117, 117, 1)"; Actual: "${elementColor}"`); + } + + //font size + if (elementSize === '14px') { + console.log('Passed: Welcome Back text font-size matched as expected'); + } else { + errors.push(`Expected: Welcome Back text text font-size "14px"; Actual: "${elementSize}"`); + } + + //icon + if (elementicon) { + console.log('Passed: Welcome Back Icon present'); + } else { + errors.push("Welcome Back Icon not found"); + } + + //Throw summary if any validation failed + if (errors.length > 0) { + //Add summary line only when multiple checks failed + if (errors.length > 1) { + errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); + } + + //Throw collected messages — catch() will prefix with "FAILED:" + throw new Error(errors.join('\n')); + } + } + }, + + //Login header + { + description: 'Validate Login header text', + action: async () => { + const multipleChecks = 'Login to your account'; + const element = await driver.findElement(By.css('h2:nth-child(3)')); + + //Get text, color, and size + const elementText = await element.getText(); + const elementFont = await element.getCssValue('font-family'); + const elementColor = await element.getCssValue('color'); + const elementSize = await element.getCssValue('font-size'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Login to your account') { + console.log('Passed: Login header text matched as expected'); + } else { + errors.push(`Expected: "Login to your account"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === `"DM Serif Display", serif`) { + console.log('Passed: Login header text font matched as expected'); + } else { + errors.push(`Expected: Login header text font "DM Serif Display", serif; Actual: ${elementFont}`); + } + + //color -navy blue + if (elementColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Login header text color matched as expected'); + } else { + errors.push(`Expected: Login header text color "rgba(40, 39, 90, 1)"; Actual: "${elementColor}"`); + } + + //font size + if (elementSize === '32px') { + console.log('Passed: Login header text font-size matched as expected'); + } else { + errors.push(`Expected: Login header text font-size "32px"; Actual: "${elementSize}"`); + } + + //Throw summary if any validation failed + if (errors.length > 0) { + //Add summary line only when multiple checks failed + if (errors.length > 1) { + errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); + } + + //Throw collected messages — catch() will prefix with "FAILED:" + throw new Error(errors.join('\n')); + } + } + }, + + //Username label text + { + description: 'Validate Username label text', + action: async () => { + const multipleChecks = 'Username label'; + const element = await driver.findElement(By.css('.form-group:nth-child(4) > label')); + + //Get text, color, and size + const elementText = await element.getText(); + const elementFont = await element.getCssValue('font-family'); + const elementColor = await element.getCssValue('color'); + const elementSize = await element.getCssValue('font-size'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Username') { + console.log('Passed: Username label text matched as expected'); + } else { + errors.push(`Expected: "Username"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Username label text font matched as expected'); + } else { + errors.push(`Expected: Username label text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //color -navy blue + if (elementColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Username label text color matched as expected'); + } else { + errors.push(`Expected: Username label text color "rgba(40, 39, 90, 1)"; Actual: "${elementColor}"`); + } + + //font size + if (elementSize === '14px') { + console.log('Passed: Username label text font-size matched as expected'); + } else { + errors.push(`Expected: Username label text font-size "14px"; Actual: "${elementSize}"`); + } + + //Throw summary if any validation failed + if (errors.length > 0) { + //Add summary line only when multiple checks failed + if (errors.length > 1) { + errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); + } + + //Throw collected messages — catch() will prefix with "FAILED:" + throw new Error(errors.join('\n')); + } + } + }, + + //Username textbox + { + description: 'Validate Username textbox', + action: async () => { + const multipleChecks = 'Username textbox'; + const element = await driver.findElement(By.css('.form-control:nth-child(2)')); + + //Get text, color, and size + const elementText = await element.getAttribute('placeholder'); + + //Get placeholder styles via executeScript since it's a pseudo-element + const elementFont = await driver.executeScript( + `return window.getComputedStyle(arguments[0], '::placeholder').getPropertyValue('font-family')`, + element + ); + const elementColor = await driver.executeScript( + `return window.getComputedStyle(arguments[0], '::placeholder').getPropertyValue('color')`, + element + ); + const elementSize = await driver.executeScript( + `return window.getComputedStyle(arguments[0], '::placeholder').getPropertyValue('font-size')`, + element + ); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Username') { + console.log('Passed: Username label text matched as expected'); + } else { + errors.push(`Expected: "Username"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Username label text font matched as expected'); + } else { + errors.push(`Expected: Username label text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //color -gray + if (elementColor === 'rgb(108, 117, 125)') { + console.log('Passed: Username label text color matched as expected'); + } else { + errors.push(`Expected: Username label text color "rgb(108, 117, 125)"; Actual: "${elementColor}"`); + } + + //font size + if (elementSize === '12.6px') { + console.log('Passed: Username label text font-size matched as expected'); + } else { + errors.push(`Expected: Username label text font-size "12.6px"; Actual: "${elementSize}"`); + } + + //Throw summary if any validation failed + if (errors.length > 0) { + //Add summary line only when multiple checks failed + if (errors.length > 1) { + errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); + } + + //Throw collected messages — catch() will prefix with "FAILED:" + throw new Error(errors.join('\n')); + } + } + }, + + //Password label text + { + description: 'Validate Password label text', + action: async () => { + const multipleChecks = 'Password label'; + const element = await driver.findElement(By.css('.form-group:nth-child(5) > label')); + + //Get text, color, and size + const elementText = await element.getText(); + const elementFont = await element.getCssValue('font-family'); + const elementColor = await element.getCssValue('color'); + const elementSize = await element.getCssValue('font-size'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Password') { + console.log('Passed: Password label text matched as expected'); + } else { + errors.push(`Expected: "Password"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Password label text font matched as expected'); + } else { + errors.push(`Expected: Password label text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //color -navy blue + if (elementColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Password label text color matched as expected'); + } else { + errors.push(`Expected:Password label text color "rgba(40, 39, 90, 1)"; Actual: "${elementColor}"`); + } + + //font size + if (elementSize === '14px') { + console.log('Passed: Password label text font-size matched as expected'); + } else { + errors.push(`Expected: Password label text font-size "14px"; Actual: "${elementSize}"`); + } + + //Throw summary if any validation failed + if (errors.length > 0) { + //Add summary line only when multiple checks failed + if (errors.length > 1) { + errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); + } + + //Throw collected messages — catch() will prefix with "FAILED:" + throw new Error(errors.join('\n')); + } + } + }, + + //Password textbox + { + description: 'Validate Password textbox', + action: async () => { + const multipleChecks = 'Password textbox'; + const element = await driver.findElement(By.css('.passfield')); + + //Get text, color, and size + const elementText = await element.getAttribute('placeholder'); + + //Get placeholder styles via executeScript since it's a pseudo-element + const elementFont = await driver.executeScript( + `return window.getComputedStyle(arguments[0], '::placeholder').getPropertyValue('font-family')`, + element + ); + const elementColor = await driver.executeScript( + `return window.getComputedStyle(arguments[0], '::placeholder').getPropertyValue('color')`, + element + ); + const elementSize = await driver.executeScript( + `return window.getComputedStyle(arguments[0], '::placeholder').getPropertyValue('font-size')`, + element + ); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Password') { + console.log('Passed: Password label text matched as expected'); + } else { + errors.push(`Expected: "Password"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Password label text font matched as expected'); + } else { + errors.push(`Expected: Password label text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //color -gray + if (elementColor === 'rgb(108, 117, 125)') { + console.log('Passed: Password label text color matched as expected'); + } else { + errors.push(`Expected: Password label text color "rgb(108, 117, 125)"; Actual: "${elementColor}"`); + } + + //font size + if (elementSize === '12.6px') { + console.log('Passed: Password label text font-size matched as expected'); + } else { + errors.push(`Expected: Password label text font-size "12.6px"; Actual: "${elementSize}"`); + } + + //Throw summary if any validation failed + if (errors.length > 0) { + //Add summary line only when multiple checks failed + if (errors.length > 1) { + errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); + } + + //Throw collected messages — catch() will prefix with "FAILED:" + throw new Error(errors.join('\n')); + } + } + }, + + //Forgot password link + { + description: 'Validate Forgot Password link', + action: async () => { + const multipleChecks = 'Forgot Password?'; + const element = await driver.findElement(By.linkText('Forgot Password?')); + + //Get text, color, and size + const linkHref = await element.getAttribute('href'); + const elementText = await element.getText(); + const elementFont = await element.getCssValue('font-family'); + const elementColor = await element.getCssValue('color'); + const elementSize = await element.getCssValue('font-size'); + + //Track all errors + const errors = []; + + //href + if (linkHref === 'https://correlation.edgate.com/exact/forgot.php') { + console.log('Passed: Forgot Password link URL matched as expected'); + } else { + errors.push(`Expected: "https://correlation.edgate.com/exact/forgot.php"; Actual: "${linkHref}"`); + } + + //text + if (elementText === 'Forgot Password?') { + console.log('Passed: Forgot password link text matched as expected'); + } else { + errors.push(`Expected: "Forgot Password?"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Forgot password link text font matched as expected'); + } else { + errors.push(`Expected: Forgot password link text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //color -navy blue + if (elementColor === 'rgba(40, 39, 90, 1)') { + console.log('Passed: Forgot password link text color matched as expected'); + } else { + errors.push(`Expected: Forgot password link text color "rgba(40, 39, 90, 1)"; Actual: "${elementColor}"`); + } + + //font size + if (elementSize === '12px') { + console.log('Passed: Forgot password link text font-size matched as expected'); + } else { + errors.push(`Expected: Forgot password link text font-size "12px"; Actual: "${elementSize}"`); + } + + //Throw summary if any validation failed + if (errors.length > 0) { + //Add summary line only when multiple checks failed + if (errors.length > 1) { + errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); + } + + //Throw collected messages — catch() will prefix with "FAILED:" + throw new Error(errors.join('\n')); + } + } + }, + + //Login button text (alt to .getText) + { + description: 'Validate Login button text', + action: async () => { + const multipleChecks = 'Login Button'; + const element = await driver.findElement(By.css('.login')); + + //Get text, color, and size + const elementText = await element.getAttribute('value'); + const elementFont = await element.getCssValue('font-family'); + const elementColor = await element.getCssValue('background-color'); + const elementSize = await element.getCssValue('font-size'); + + //Track all errors + const errors = []; + + //text + if (elementText === 'Login') { + console.log('Passed: Login button text matched as expected'); + } else { + errors.push(`Expected: "Login"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Login button text font matched as expected'); + } else { + errors.push(`Expected: Login buttonk text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //color -teal + if (elementColor === 'rgba(48, 200, 172, 1)') { + console.log('Passed: Login button text background color matched as expected'); + } else { + errors.push(`Expected: Login button text background color "rgba(48, 200, 172, 1)"; Actual: "${elementColor}"`); + } + + //font size + if (elementSize === '16px') { + console.log('Passed: Login button text font-size matched as expected'); + } else { + errors.push(`Expected: Login button text font-size "16px"; Actual: "${elementSize}"`); + } + + //Throw summary if any validation failed + if (errors.length > 0) { + //Add summary line only when multiple checks failed + if (errors.length > 1) { + errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); + } + + //Throw collected messages — catch() will prefix with "FAILED:" + throw new Error(errors.join('\n')); + } + } + }, + + //Don't have an account? text + { + description: 'Validate Dont have account text', + action: async () => { + const multipleChecks = `Don't Have an account?`; + const element = await driver.findElement(By.css('p:nth-child(1)')); + + //Get text, color, and size + const elementText = await element.getText(); + const elementFont = await element.getCssValue('font-family'); + const elementColor = await element.getCssValue('color'); + const elementSize = await element.getCssValue('font-size'); + + //Track all errors + const errors = []; + + //text + if (elementText === `DON'T HAVE AN ACCOUNT?`) { + console.log('Passed: Dont have an account text matched as expected'); + } else { + errors.push(`Expected: "DON'T HAVE AN ACCOUNT?"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Dont have an account text font matched as expected'); + } else { + errors.push(`Expected: Dont have an account text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //color -black + if (elementColor === 'rgba(32, 32, 32, 1)') { + console.log('Passed: Dont have an account text color matched as expected'); + } else { + errors.push(`Expected: Dont have an account text color "rgba(32, 32, 32, 1)"; Actual: "${elementColor}"`); + } + + //font size + if (elementSize === '14px') { + console.log('Passed: Dont have an account text font-size matched as expected'); + } else { + errors.push(`Expected: Dont have an account text font-size "14px"; Actual: "${elementSize}"`); + } + + //Throw summary if any validation failed + if (errors.length > 0) { + //Add summary line only when multiple checks failed + if (errors.length > 1) { + errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); + } + + //Throw collected messages — catch() will prefix with "FAILED:" + throw new Error(errors.join('\n')); + } + } + }, + + //Free trial button + { + description: 'Validate Free trial button', + action: async () => { + const multipleChecks = 'Free Trial'; + const element = await driver.findElement(By.linkText('Sign up for a 30 Day Free Trial')); + + //Get href, text, color, and size + const linkHref = await element.getAttribute('href'); + const elementText = await element.getText(''); + const elementFont = await element.getCssValue('font-family'); + const elementColor = await element.getCssValue('background-color'); + const elementSize = await element.getCssValue('font-size'); + + //Track all errors + const errors = []; + + //href + if (linkHref === 'https://correlation.edgate.com/exact/trial-registration.php') { + console.log('Passed: Sign up for a 30 Day Free Trial link URL matched as expected'); + } else { + errors.push(`Expected: "https://correlation.edgate.com/exact/trial-registration.php"; Actual: "${linkHref}"`); + } + + //text + if (elementText === 'Sign up for a 30 Day Free Trial') { + console.log('Passed: Free trial button text matched as expected'); + } else { + errors.push(`Expected: "Sign up for a 30 Day Free Trial"; Actual: "${elementText}"`); + } + + //font-family + if (elementFont === "Poppins, sans-serif") { + console.log('Passed: Free trial button text font matched as expected'); + } else { + errors.push(`Expected: Free trial button text font "Poppins, sans-serif"; Actual: ${elementFont}`); + } + + //color -white + if (elementColor === 'rgba(255, 255, 255, 1)') { + console.log('Passed: Free trial button background color matched as expected'); + } else { + errors.push(`Expected: Free trial button background color "rgba(255, 255, 255, 1)"; Actual: "${elementColor}"`); + } + + //font size + if (elementSize === '16px') { + console.log('Passed: Free trial button text font-size matched as expected'); + } else { + errors.push(`Expected: Free trial button text font-size "16px"; Actual: "${elementSize}"`); + } + + //Throw summary if any validation failed + if (errors.length > 0) { + //Add summary line only when multiple checks failed + if (errors.length > 1) { + errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); + } + + //Throw collected messages — catch() will prefix with "FAILED:" + throw new Error(errors.join('\n')); + } + } + }, + + //EdGate copyright logo + { + description: 'Verify EdGate copyright logo 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 logo present'); + } else { + errors.push("EdGate copyright logo not found"); + } + } + }, + + //Login and Log out + { + description: 'Login and Log Out', + action: async () => { + const multipleChecks = 'Log In and Out'; + + //Track all errors + const errors = []; + + await driver.findElement(By.css('.form-control:nth-child(2)')).sendKeys('exact_juan'); + console.log('----->| NEXT ACTION: Entered Username: exact_juan'); + + await driver.findElement(By.css('.passfield')).sendKeys('Edgate1!'); + console.log('----->| NEXT ACTION: Entered Password: Edgate1!'); + + await driver.findElement(By.css('.login')).click(); + console.log('----->| NEXT ACTION: Clicked Login button'); + + //Wait for page to load completely + await driver.wait(async () => { + const readyState = await driver.executeScript('return document.readyState'); + return readyState === 'complete'; + }, 30000, 'ExACT Dashboard did not fully load within 30 seconds'); + console.log('------------->| ExACT Dashboard |<-------------'); + + //Wait until the element exists in the DOM + const pageTitle = await driver.wait( + until.elementLocated(By.css('.e-heading')), + 30000 + ); + + //Wait until it becomes visible + await driver.wait( + until.elementIsVisible(pageTitle), + 30000 + ); + + const element = await driver.wait(until.elementLocated(By.css('.e-heading')), 5000).catch(() => false); + const elementText = await element.getText(); + + //text + if (elementText === 'Correlation Dashboard') { + console.log('Passed: Correlation Dashboard page title matched as expected'); + } else { + errors.push(`Expected: "Correlation Dashboard"; Actual: "${elementText}"`); + } + + //Wait for page to load completely + await driver.wait(async () => { + const readyState = await driver.executeScript('return document.readyState'); + return readyState === 'complete'; + }, 30000, 'ExACT Dashboard did not fully load within 30 seconds'); + console.log('Passed: ExACT Dashboard loaded successfully'); + + await driver.findElement(By.css('#navbarDropdown > span')).click(); + await driver.findElement(By.linkText('Log Out')).click(); + console.log('----->| NEXT ACTION: Clicked user profile and logged out'); + + //Wait until the element exists in the DOM + const exactLogo = await driver.wait( + until.elementLocated(By.css('.logo')), + 30000 + ); + + //Wait until it becomes visible + await driver.wait( + until.elementIsVisible(exactLogo), + 30000 + ); + + //Wait for page to load completely + await driver.wait(async () => { + const readyState = await driver.executeScript('return document.readyState'); + return readyState === 'complete'; + }, 30000, 'ExACT Langing page did not fully load within 30 seconds'); + console.log('Passed: ExACT Landing Page loaded successfully'); + + //Throw summary if any validation failed + if (errors.length > 0) { + //Add summary line only when multiple checks failed + if (errors.length > 1) { + errors.unshift(`${multipleChecks} - Multiple validation checks did not pass`); + } + + //Throw collected messages — catch() will prefix with "FAILED:" + throw new Error(errors.join('\n')); } - console.log('Passed: EdGate copyright image present'); } }, ]; @@ -575,9 +4874,7 @@ try { } //Script completed - const expectedEdGateCopyright = await driver.wait(until.elementLocated(By.css('.logincopyright > img')), 5000).catch(() => false); - - if (expectedEdGateCopyright && allStepsPassed) { + if (allStepsPassed) { console.log('PASSED: ExACT Login Page(ExACT_landingPage); All test steps completed successfully'); testStatus = 'Passed'; } else {