Updated scripts

This commit is contained in:
2024-10-18 18:20:57 -07:00
parent 1272b1fdf9
commit b5c8c560d0
3 changed files with 261 additions and 156 deletions

View File

@@ -2,7 +2,6 @@ import { Builder, By, Key, until } from 'selenium-webdriver';
import fs from 'fs';
import XLSX from 'xlsx';
import path from 'path';
import { assert } from 'console';
const ExACT_landingPage = (req, res) => {
res.send('<h2>ExACT Automated Test Script - Landing Page: Initiated</h2>');
@@ -16,47 +15,34 @@ const ExACT_landingPage = (req, res) => {
//Left Panel:
//Title
const expectedTitleText = 'Empowering publishers with the ability to correlate their unique content to standards.';
const expectedTitleFont = '32px';
//Description
const expectedDescriptiveText1 = 'The ExACT platform is the education industry’s most trusted source to globally correlate content to standards and produce content alignment reports.';
const expectedDescriptiveText2 = 'With access to over five million learning outcomes, ExACT’s robust toolset allows end users to discover new markets for their content, find gaps, and adjust alignments for specific opportunities.';
//Sign Up
const expectedSignUpText = 'Sign Up For A 30 Day Free Trial';
const expectedFreeTrialLinkColor = 'rgba(255, 111, 97, 1)'; //Red/Orange
//Bullet Points
const expectedBulletPointText1 = 'Learn more about ExACT AutoAlign, the AI-based alignment tool.';
const expectedBulletPointLinkColor1 = 'rgba(48, 200, 172, 1)'; //teal
const expectedBulletPointText2 = 'See your Correlation Analytics.';
const expectedBulletPointLinkColor2 = 'rgba(48, 200, 172, 1)'; //teal
const expectedBulletPointText3 = 'Explore how your Content maps to International Standards.';
const expectedBulletPointLinkColor3 = 'rgba(48, 200, 172, 1)'; //teal
//Right Panel:
//Welcome back
const expectedWelcomeBackText = 'WELCOME BACK!';
const expectedWelcomeBackColor = 'rgba(117, 117, 117, 1)' //gray
//Login
const expectedLoginTitleText = 'Login to your account';
const expectedLoginTitleColor = 'rgba(40, 39, 90, 1)'; //navy blue
const expectedLoginTitleFont = '32px';
//Username
const expectedUsernameLabel = 'Username';
const expectedUsernameColor = 'rgba(40, 39, 90, 1)'; //navy blue
const expectedUsernamePlaceholder = 'Username';
//Password
const expectedPasswordLabel = 'Password';
const expectedPasswordColor = 'rgba(40, 39, 90, 1)'; //navy blue
const expectedPasswordPlaceholder = 'Password';
//Forgot password link
const expectedForgotPasswordLinkColor = 'rgba(40, 39, 90, 1)'; //navy blue
//Login button
const expectedLoginButtonText = 'Login';
const expectedLoginButtonColor = 'rgba(48, 200, 172, 1)'; //teal
//Don't have account text
const expectedDontHaveAccountText = `DON'T HAVE AN ACCOUNT?`;
//Free trial button
const expectedFreeTrialButtonText = '30 Day';
const expectedFreeTrialButtonColor = 'rgba(0, 0, 0, 0)'; //white
const steps = [
{ description: 'Navigate to ExACT Landing Page', action: async () => await driver.navigate().to('https://stage.edgate.com/exact/login.php') }, //PROD - https://correlation.edgate.com/exact/login.php
@@ -82,8 +68,8 @@ const steps = [
description: 'Validate Title text font size',
action: async () =>
{ const elementStyle = await driver.findElement(By.css('h2:nth-child(3)')).getCssValue('font-size');
if (elementStyle !== expectedTitleFont) {
throw new Error(`Title text font-size Expected: "${expectedTitleFont}"; Actual: "${elementStyle}"`);
if (elementStyle !== '32px') {
throw new Error(`Title text font-size did not match; Actual: "${elementStyle}"`);
}
console.log('Passed: Title text font-size matched as expected');
}
@@ -125,13 +111,13 @@ const steps = [
}
},
//Free trial link text color
//Free trial link text color -red/orange
{
description: 'Validate free trial link color',
action: async () =>
{ const elementStyle = await driver.findElement(By.linkText('30 Day Free Trial')).getCssValue('color');
if (elementStyle !== expectedFreeTrialLinkColor) {
throw new Error(`Free trial link text color Expected: "${expectedFreeTrialLinkColor}"; Actual: "${elementStyle}"`);
if (elementStyle !== 'rgba(255, 111, 97, 1)') {
throw new Error(`Free trial link text color did not match; Actual: "${elementStyle}"`);
}
console.log('Passed: Free trial link text color matched as expected');
}
@@ -161,13 +147,13 @@ const steps = [
}
},
//Bullet Point link 1 text color
//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 !== expectedBulletPointLinkColor1) {
throw new Error(`Bullet point link 1 text color Expected: "${expectedBulletPointLinkColor1}"; Actual: "${elementStyle}"`);
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');
}
@@ -197,13 +183,13 @@ const steps = [
}
},
//Bullet Point link 2 text color
//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 !== expectedBulletPointLinkColor2) {
throw new Error(`Bullet point link 2 text color Expected: "${expectedBulletPointLinkColor2}"; Actual: "${elementStyle}"`);
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');
}
@@ -233,13 +219,13 @@ const steps = [
}
},
//Bullet Point link 3 text color
//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 !== expectedBulletPointLinkColor3) {
throw new Error(`Bullet point link 3 text color Expected: "${expectedBulletPointLinkColor3}"; Actual: "${elementStyle}"`);
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');
}
@@ -270,13 +256,13 @@ const steps = [
}
},
//Welcome back text color
//Welcome back text color -gray
{
description: 'Validate Welcome back text color',
action: async () => {
const elementStyle = await driver.findElement(By.css('#formLogin > p')).getCssValue('color');
if (elementStyle !== expectedWelcomeBackColor) {
throw new Error(`Welcome back text color Expected: "${expectedWelcomeBackColor}"; Actual: "${elementStyle}"`);
if (elementStyle !== 'rgba(117, 117, 117, 1)') {
throw new Error(`Welcome back text color did not match; Actual: "${elementStyle}"`);
}
console.log('Passed: Welcome back text color matched as expected');
}
@@ -306,13 +292,13 @@ const steps = [
}
},
//Login title text color
//Login title text color -navy blue
{
description: 'Validate Login title text color',
action: async () => {
const elementStyle = await driver.findElement(By.css('h2:nth-child(3)')).getCssValue('color');
if (elementStyle !== expectedLoginTitleColor) {
throw new Error(`Login title text color Expected: "${expectedLoginTitleColor}"; Actual: "${elementStyle}"`);
if (elementStyle !== 'rgba(40, 39, 90, 1)') {
throw new Error(`Login title text color did not match; Actual: "${elementStyle}"`);
}
console.log('Passed: Login title text color matched as expected');
}
@@ -323,8 +309,8 @@ 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');
if (elementStyle !== expectedLoginTitleFont) {
throw new Error(`Login title text font-size Expected: "${expectedLoginTitleFont}"; Actual: "${elementStyle}"`);
if (elementStyle !== '32px') {
throw new Error(`Login title text font-size did not match; Actual: "${elementStyle}"`);
}
console.log('Passed: Login title text font-size matched as expected');
}
@@ -342,13 +328,13 @@ const steps = [
}
},
//Username label text color
//Username label text color -navy blue
{
description: 'Validate Username label text color',
action: async () => {
const elementStyle = await driver.findElement(By.css('.form-group:nth-child(4) > label')).getCssValue('color');
if (elementStyle !== expectedUsernameColor) {
throw new Error(`Username label text color Expected: "${expectedUsernameColor}"; Actual: "${elementStyle}"`);
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');
}
@@ -378,13 +364,13 @@ const steps = [
}
},
//Password label text color
//Password label text color -navy blue
{
description: 'Validate Password label text color',
action: async () => {
const elementStyle = await driver.findElement(By.css('.form-group:nth-child(5) > label')).getCssValue('color');
if (elementStyle !== expectedPasswordColor) {
throw new Error(`Password label text color Expected: "${expectedPasswordColor}"; Actual: "${elementStyle}"`);
if (elementStyle !== 'rgba(40, 39, 90, 1)') {
throw new Error(`Password label text color did not match; Actual: "${elementStyle}"`);
}
console.log('Passed: Password label text color matched as expected');
}
@@ -402,13 +388,13 @@ const steps = [
}
},
//Forgot password text link color
//Forgot password text link color -navy blue
{
description: 'Validate Forgot Password link text color',
action: async () => {
const elementStyle = await driver.findElement(By.linkText('Forgot Password?')).getCssValue('color');
if (elementStyle !== expectedForgotPasswordLinkColor) {
throw new Error(`Forgot password link text color Expected: "${expectedForgotPasswordLinkColor}"; Actual: "${elementStyle}"`);
if (elementStyle !== 'rgba(40, 39, 90, 1)') {
throw new Error(`Forgot password link text color did not match; Actual: "${elementStyle}"`);
}
console.log('Passed: Forgot password link text color matched as expected');
}
@@ -426,13 +412,13 @@ const steps = [
}
},
//Login button background color
//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 !== expectedLoginButtonColor) {
throw new Error(`Login button background color Expected: "${expectedLoginButtonColor}"; Actual: "${elementStyle}"`);
if (elementStyle !== 'rgba(48, 200, 172, 1)') {
throw new Error(`Login button background color did not match; Actual: "${elementStyle}"`);
}
console.log('Passed: Login button background color matched as expected');
}
@@ -462,13 +448,13 @@ const steps = [
}
},
//Free trial button background color
//Free trial button background color -white
{
description: 'Validate Free trial button background color',
action: async () => {
const elementStyle = await driver.findElement(By.css('.btn > span')).getCssValue('background-color');
if (elementStyle !== expectedFreeTrialButtonColor) {
throw new Error(`Free trial button background color Expected: "${expectedFreeTrialButtonColor}"; Actual: "${elementStyle}"`);
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');
}
@@ -542,7 +528,7 @@ try {
} catch (error) {
const screenshotPath = await takeScreenshot(driver, stepIndex, `${step.description}_Failed`);
worksheet = logStep(worksheet, step.description, 'Failed', stepIndex, timestamp, screenshotPath);
console.error(`Step ${stepIndex} failed: ${error.message}`);
console.error(`Step ${stepIndex} FAILED: ${error.message}`);
testStatus = 'Failed';
}
}