diff --git a/tests/ExACT_landingPage.js b/tests/ExACT_landingPage.js index e5a1300..a4ec2e7 100644 --- a/tests/ExACT_landingPage.js +++ b/tests/ExACT_landingPage.js @@ -4,7 +4,7 @@ import XLSX from 'xlsx'; import path from 'path'; const ExACT_landingPage = (req, res) => { - res.send('

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

'); + res.send('

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

'); (async function example() { let driver = await new Builder().forBrowser('chrome').build(); let testStatus = 'Failed'; @@ -26,7 +26,7 @@ const expectedBulletPointText2 = 'See your Correlation Analytics.'; const expectedBulletPointText3 = 'Explore how your Content maps to International Standards.'; //Right Panel: - //Welcome back +//Welcome back const expectedWelcomeBackText = 'WELCOME BACK!'; //Login const expectedLoginTitleText = 'Login to your account'; @@ -45,12 +45,26 @@ const expectedDontHaveAccountText = `DON'T HAVE AN ACCOUNT?`; const expectedFreeTrialButtonText = '30 Day'; const steps = [ - { description: 'Navigate to ExACT Landing Page', action: async () => await driver.navigate().to('https://stage.edgate.com/exact/login.php') }, //PROD - https://correlation.edgate.com/exact/login.php + { description: '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', + 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'); + } + }, + //LEFT PANEL //Title text - { description: 'Wait for title text to be present', action: async () => await driver.wait(until.elementLocated(By.css('h2:nth-child(1)')), 5000) }, + { description: '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', @@ -67,7 +81,7 @@ const steps = [ { description: 'Validate Title text font size', action: async () => - { const elementStyle = await driver.findElement(By.css('h2:nth-child(3)')).getCssValue('font-size'); + { const elementStyle = await driver.findElement(By.css('h2:nth-child(1)')).getCssValue('font-size'); if (elementStyle !== '32px') { throw new Error(`Title text font-size did not match; Actual: "${elementStyle}"`); } @@ -284,7 +298,7 @@ const steps = [ { description: 'Validate Login title text', action: async () => { - const elementText = await driver.findElement(By.css('h2:nth-child(3)')).getText(); + const elementText = await driver.findElement(By.css('h2:nth-child(4)')).getText(); if (elementText !== expectedLoginTitleText) { throw new Error(`Expected: "${expectedLoginTitleText}"; Actual: "${elementText}"`); } @@ -296,7 +310,7 @@ const steps = [ { description: 'Validate Login title text color', action: async () => { - const elementStyle = await driver.findElement(By.css('h2:nth-child(3)')).getCssValue('color'); + 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}"`); } @@ -308,7 +322,7 @@ const steps = [ { description: 'Validate Login title text font size', action: async () => { - const elementStyle = await driver.findElement(By.css('h2:nth-child(3)')).getCssValue('font-size'); + 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}"`); } @@ -320,7 +334,7 @@ const steps = [ { description: 'Validate Username label text', action: async () => { - const elementText = await driver.findElement(By.css('.form-group:nth-child(4) > label')).getText(); + const elementText = await driver.findElement(By.css('.form-group:nth-child(5) > label')).getText(); if (elementText !== expectedUsernameLabel) { throw new Error(`Expected: "${expectedUsernameLabel}"; Actual: "${elementText}"`); } @@ -332,7 +346,7 @@ const steps = [ { description: 'Validate Username label text color', action: async () => { - const elementStyle = await driver.findElement(By.css('.form-group:nth-child(4) > label')).getCssValue('color'); + 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}"`); } @@ -356,7 +370,7 @@ const steps = [ { description: 'Validate Password label text', action: async () => { - const elementText = await driver.findElement(By.css('.form-group:nth-child(5) > label')).getText(); + const elementText = await driver.findElement(By.css('.form-group:nth-child(6) > label')).getText(); if (elementText !== expectedPasswordLabel) { throw new Error(`Expected: "${expectedPasswordLabel}"; Actual: "${elementText}"`); } @@ -368,7 +382,7 @@ const steps = [ { description: 'Validate Password label text color', action: async () => { - const elementStyle = await driver.findElement(By.css('.form-group:nth-child(5) > label')).getCssValue('color'); + 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}"`); } @@ -564,10 +578,10 @@ try { const expectedEdGateCopyright = await driver.wait(until.elementLocated(By.css('.logincopyright > img')), 5000).catch(() => false); if (expectedEdGateCopyright && allStepsPassed) { - console.log('PASSED: ExACT Landing Page(ExACT_landingPage); All test steps completed successfully'); + console.log('PASSED: ExACT Login Page(ExACT_landingPage); All test steps completed successfully'); testStatus = 'Passed'; } else { - console.log('FAILED: ExACT Landing Page(ExACT_landingPage); One or more test steps failed'); + console.log('FAILED: ExACT Login Page(ExACT_landingPage); One or more test steps failed'); testStatus = 'Failed'; }