Updated to work on prod
This commit is contained in:
@@ -4,7 +4,7 @@ import XLSX from 'xlsx';
|
|||||||
import path from 'path';
|
import path from 'path';
|
||||||
|
|
||||||
const ExACT_landingPage = (req, res) => {
|
const ExACT_landingPage = (req, res) => {
|
||||||
res.send('<h2>ExACT Automated Test Script: ExACT Landing Page(ExACT_landingPage); Initiated</h2>');
|
res.send('<h2>ExACT Automated Test Script: ExACT Login Page(ExACT_landingPage); Initiated</h2>');
|
||||||
(async function example() {
|
(async function example() {
|
||||||
let driver = await new Builder().forBrowser('chrome').build();
|
let driver = await new Builder().forBrowser('chrome').build();
|
||||||
let testStatus = 'Failed';
|
let testStatus = 'Failed';
|
||||||
@@ -26,7 +26,7 @@ const expectedBulletPointText2 = 'See your Correlation Analytics.';
|
|||||||
const expectedBulletPointText3 = 'Explore how your Content maps to International Standards.';
|
const expectedBulletPointText3 = 'Explore how your Content maps to International Standards.';
|
||||||
|
|
||||||
//Right Panel:
|
//Right Panel:
|
||||||
//Welcome back
|
//Welcome back
|
||||||
const expectedWelcomeBackText = 'WELCOME BACK!';
|
const expectedWelcomeBackText = 'WELCOME BACK!';
|
||||||
//Login
|
//Login
|
||||||
const expectedLoginTitleText = 'Login to your account';
|
const expectedLoginTitleText = 'Login to your account';
|
||||||
@@ -45,12 +45,26 @@ const expectedDontHaveAccountText = `DON'T HAVE AN ACCOUNT?`;
|
|||||||
const expectedFreeTrialButtonText = '30 Day';
|
const expectedFreeTrialButtonText = '30 Day';
|
||||||
|
|
||||||
const steps = [
|
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: '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
|
//LEFT PANEL
|
||||||
//Title text
|
//Title text
|
||||||
{ description: 'Wait for title text to be present', action: async () => await driver.wait(until.elementLocated(By.css('h2:nth-child(1)')), 5000) },
|
{ description: 'Wait for title text to be present', action: async () => await driver.wait(until.elementsLocated(By.css('h2:nth-child(1)')), 5000) },
|
||||||
|
|
||||||
{
|
{
|
||||||
description: 'Validate title text',
|
description: 'Validate title text',
|
||||||
@@ -67,7 +81,7 @@ const steps = [
|
|||||||
{
|
{
|
||||||
description: 'Validate Title text font size',
|
description: 'Validate Title text font size',
|
||||||
action: async () =>
|
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') {
|
if (elementStyle !== '32px') {
|
||||||
throw new Error(`Title text font-size did not match; Actual: "${elementStyle}"`);
|
throw new Error(`Title text font-size did not match; Actual: "${elementStyle}"`);
|
||||||
}
|
}
|
||||||
@@ -284,7 +298,7 @@ const steps = [
|
|||||||
{
|
{
|
||||||
description: 'Validate Login title text',
|
description: 'Validate Login title text',
|
||||||
action: async () => {
|
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) {
|
if (elementText !== expectedLoginTitleText) {
|
||||||
throw new Error(`Expected: "${expectedLoginTitleText}"; Actual: "${elementText}"`);
|
throw new Error(`Expected: "${expectedLoginTitleText}"; Actual: "${elementText}"`);
|
||||||
}
|
}
|
||||||
@@ -296,7 +310,7 @@ const steps = [
|
|||||||
{
|
{
|
||||||
description: 'Validate Login title text color',
|
description: 'Validate Login title text color',
|
||||||
action: async () => {
|
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)') {
|
if (elementStyle !== 'rgba(40, 39, 90, 1)') {
|
||||||
throw new Error(`Login title text color did not match; Actual: "${elementStyle}"`);
|
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',
|
description: 'Validate Login title text font size',
|
||||||
action: async () => {
|
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') {
|
if (elementStyle !== '32px') {
|
||||||
throw new Error(`Login title text font-size did not match; Actual: "${elementStyle}"`);
|
throw new Error(`Login title text font-size did not match; Actual: "${elementStyle}"`);
|
||||||
}
|
}
|
||||||
@@ -320,7 +334,7 @@ const steps = [
|
|||||||
{
|
{
|
||||||
description: 'Validate Username label text',
|
description: 'Validate Username label text',
|
||||||
action: async () => {
|
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) {
|
if (elementText !== expectedUsernameLabel) {
|
||||||
throw new Error(`Expected: "${expectedUsernameLabel}"; Actual: "${elementText}"`);
|
throw new Error(`Expected: "${expectedUsernameLabel}"; Actual: "${elementText}"`);
|
||||||
}
|
}
|
||||||
@@ -332,7 +346,7 @@ const steps = [
|
|||||||
{
|
{
|
||||||
description: 'Validate Username label text color',
|
description: 'Validate Username label text color',
|
||||||
action: async () => {
|
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)') {
|
if (elementStyle !== 'rgba(40, 39, 90, 1)') {
|
||||||
throw new Error(`Username label text color did not match; Actual: "${elementStyle}"`);
|
throw new Error(`Username label text color did not match; Actual: "${elementStyle}"`);
|
||||||
}
|
}
|
||||||
@@ -356,7 +370,7 @@ const steps = [
|
|||||||
{
|
{
|
||||||
description: 'Validate Password label text',
|
description: 'Validate Password label text',
|
||||||
action: async () => {
|
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) {
|
if (elementText !== expectedPasswordLabel) {
|
||||||
throw new Error(`Expected: "${expectedPasswordLabel}"; Actual: "${elementText}"`);
|
throw new Error(`Expected: "${expectedPasswordLabel}"; Actual: "${elementText}"`);
|
||||||
}
|
}
|
||||||
@@ -368,7 +382,7 @@ const steps = [
|
|||||||
{
|
{
|
||||||
description: 'Validate Password label text color',
|
description: 'Validate Password label text color',
|
||||||
action: async () => {
|
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)') {
|
if (elementStyle !== 'rgba(40, 39, 90, 1)') {
|
||||||
throw new Error(`Password label text color did not match; Actual: "${elementStyle}"`);
|
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);
|
const expectedEdGateCopyright = await driver.wait(until.elementLocated(By.css('.logincopyright > img')), 5000).catch(() => false);
|
||||||
|
|
||||||
if (expectedEdGateCopyright && allStepsPassed) {
|
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';
|
testStatus = 'Passed';
|
||||||
} else {
|
} 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';
|
testStatus = 'Failed';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user