diff --git a/ExACTRegressionScripts/tests/ExACT_landingPage.js b/ExACTRegressionScripts/tests/ExACT_landingPage.js
new file mode 100644
index 0000000..21e3770
--- /dev/null
+++ b/ExACTRegressionScripts/tests/ExACT_landingPage.js
@@ -0,0 +1,112 @@
+import { Builder, By, Key, until } from 'selenium-webdriver';
+import fs from 'fs';
+import XLSX from 'xlsx';
+import path from 'path';
+import { assert } from 'console';
+import { elementTextIs } from 'selenium-webdriver/lib/until';
+
+const ExACT_landingPage = (req, res) => {
+ res.send('
ExACT Automated Test Script - Landing Page: Excecuted
');
+ (async function example() {
+ let driver = await new Builder().forBrowser('chrome').build();
+ let testStatus = 'Failed';
+ let workbook;
+ let worksheet;
+ const startTime = new Date().toISOString();
+
+ const steps = [
+ { description: 'Navigate to ExACT Landing Page', action: async () => await driver.navigate().to('https://stage.edgate.com/exact/login.php') },
+ { description: 'Expand browser', action: async () => await driver.manage().window().maximize() },
+
+ //Descriptive text 1
+ { description: 'Wait for descriptive text 1 to be present', action: async () => await driver.wait(until.elementLocated(By.css('h2:nth-child(1)')), 5000) },
+
+ { description: 'Validate descriptive text 1', action: elementTextIs(By.css('h2:nth-child(1)', "WTF Let's start with the basics."))},
+ //{ String actualText = driver.findElement(by.css('h2:nth-child(1)')).getAttribute("value")},
+ //{ description: 'Validate descriptive text 1', action: async () => await driver.findElement(By.css('h2:nth-child(1)'), "wtf") },
+
+/*
+ { description: 'Enter username', action: async () => await driver.findElement(By.id('txtU')).sendKeys('gnight147', Key.RETURN) },
+ { description: 'Wait for password field to be present', action: async () => await driver.sleep(3000) },
+ { description: 'Enter password', action: async () => await driver.findElement(By.id('txtP')).sendKeys('EDmin123', Key.RETURN) },
+ { description: 'Wait for login process to complete', action: async () => await driver.sleep(10000) },*/
+ ];
+
+ const logStep = (worksheet, stepDescription, status, stepIndex, timestamp, screenshotPath) => {
+ const json_data = XLSX.utils.sheet_to_json(worksheet, { header: 1 });
+ json_data.push([stepIndex, stepDescription, status, timestamp, screenshotPath]);
+ return XLSX.utils.aoa_to_sheet(json_data);
+ };
+
+ const takeScreenshot = async (driver, stepIndex, stepDescription) => {
+ const screenshot = await driver.takeScreenshot();
+
+ const dir = path.join('screenshots', 'landingPageScript');
+ if (!fs.existsSync(dir)) {
+ fs.mkdirSync(dir, { recursive: true });
+ }
+
+ const screenshotFileName = `step_${stepIndex}_${stepDescription.replace(/\s+/g, '_')}.png`;
+ const screenshotPath = path.join(dir, screenshotFileName);
+ fs.writeFileSync(screenshotPath, screenshot, 'base64');
+ return screenshotPath;
+ };
+
+ try {
+ // Initialize workbook and worksheet
+ if (!fs.existsSync('landingPageResult.xlsx')) {
+ workbook = XLSX.utils.book_new();
+ worksheet = XLSX.utils.aoa_to_sheet([
+ ['Step Number', 'Step Description', 'Status', 'Timestamp', 'Screenshot']
+ ]);
+ XLSX.utils.book_append_sheet(workbook, worksheet, 'Sheet1');
+ XLSX.writeFile(workbook, 'landingPageResult.xlsx');
+ } else {
+ workbook = XLSX.readFile('landingPageResult.xlsx', { cellStyles: true });
+ const sheetName = workbook.SheetNames[0];
+ worksheet = workbook.Sheets[sheetName];
+ }
+
+ // Log test start time
+ worksheet = logStep(worksheet, 'Test Start', 'Started', '', startTime, '');
+
+ for (const step of steps) {
+ const stepIndex = steps.indexOf(step) + 1;
+ const timestamp = new Date().toISOString();
+
+ try {
+ await step.action();
+ const screenshotPath = await takeScreenshot(driver, stepIndex, step.description);
+ worksheet = logStep(worksheet, step.description, 'Passed', stepIndex, timestamp, screenshotPath);
+ } catch (error) {
+ const screenshotPath = await takeScreenshot(driver, stepIndex, `${step.description}_Failed`);
+ worksheet = logStep(worksheet, step.description, 'Failed', stepIndex, timestamp, screenshotPath);
+ throw error; // Re-throw the error to stop further execution if necessary
+ }
+ }
+
+ // Check if landing page test was successful
+ //const ValidateText1 = await driver.wait(until.elementLocated(By.css('h2:nth-child(1)')), 5000).catch(() => false);
+ const ValidateText1 = await driver.findElement(By.css('h2:nth-child(1)'), 5000).catch(() => false);
+
+ if (ValidateText1) {
+ console.log('Text Validation 1: SUCCESSFUL');
+ testStatus = 'Passed';
+ } else {
+ console.log('Text Validation 1: FAILED');
+ }
+
+ // Log test end time
+ const endTime = new Date().toISOString();
+ worksheet = logStep(worksheet, 'Test End', 'Ended', '', endTime, '');
+
+ // Write the updated worksheet back to the workbook and save it
+ workbook.Sheets['Sheet1'] = worksheet;
+ XLSX.writeFile(workbook, 'landingPageResult.xlsx');
+ } finally {
+ await driver.quit();
+ }
+ })();
+}
+
+export default ExACT_landingPage;
diff --git a/ExACTRegressionScripts/tests/login.js b/ExACTRegressionScripts/tests/login.js
new file mode 100644
index 0000000..e821fc5
--- /dev/null
+++ b/ExACTRegressionScripts/tests/login.js
@@ -0,0 +1,101 @@
+import { Builder, By, Key, until } from 'selenium-webdriver';
+import fs from 'fs';
+import XLSX from 'xlsx';
+import path from 'path';
+
+const loginTest = (req, res) => {
+ res.send('Automated Login Test Script: Completed
');
+ (async function example() {
+ let driver = await new Builder().forBrowser('chrome').build();
+ let testStatus = 'Failed';
+ let workbook;
+ let worksheet;
+ const startTime = new Date().toISOString();
+
+ const steps = [
+ { description: 'Navigate to login page', action: async () => await driver.navigate().to('https://app-qa.journeysmap.com/UI/User/Login') },
+ { description: 'Expand browser', action: async () => await driver.manage().window().maximize() },
+ { description: 'Locate username field', action: async () => await driver.wait(until.elementLocated(By.id('txtU')), 5000) },
+ { description: 'Enter username', action: async () => await driver.findElement(By.id('txtU')).sendKeys('gnight147', Key.RETURN) },
+ { description: 'Wait for password field to be present', action: async () => await driver.sleep(3000) },
+ { description: 'Enter password', action: async () => await driver.findElement(By.id('txtP')).sendKeys('EDmin123', Key.RETURN) },
+ { description: 'Wait for login process to complete', action: async () => await driver.sleep(10000) },
+ ];
+
+ const logStep = (worksheet, stepDescription, status, stepIndex, timestamp, screenshotPath) => {
+ const json_data = XLSX.utils.sheet_to_json(worksheet, { header: 1 });
+ json_data.push([stepIndex, stepDescription, status, timestamp, screenshotPath]);
+ return XLSX.utils.aoa_to_sheet(json_data);
+ };
+
+ const takeScreenshot = async (driver, stepIndex, stepDescription) => {
+ const screenshot = await driver.takeScreenshot();
+
+ const dir = path.join('screenshots', 'loginScript');
+ if (!fs.existsSync(dir)) {
+ fs.mkdirSync(dir, { recursive: true });
+ }
+
+ const screenshotFileName = `step_${stepIndex}_${stepDescription.replace(/\s+/g, '_')}.png`;
+ const screenshotPath = path.join(dir, screenshotFileName);
+ fs.writeFileSync(screenshotPath, screenshot, 'base64');
+ return screenshotPath;
+ };
+
+ try {
+ // Initialize workbook and worksheet
+ if (!fs.existsSync('loginResult.xlsx')) {
+ workbook = XLSX.utils.book_new();
+ worksheet = XLSX.utils.aoa_to_sheet([
+ ['Step Number', 'Step Description', 'Status', 'Timestamp', 'Screenshot']
+ ]);
+ XLSX.utils.book_append_sheet(workbook, worksheet, 'Sheet1');
+ XLSX.writeFile(workbook, 'loginResult.xlsx');
+ } else {
+ workbook = XLSX.readFile('loginResult.xlsx', { cellStyles: true });
+ const sheetName = workbook.SheetNames[0];
+ worksheet = workbook.Sheets[sheetName];
+ }
+
+ // Log test start time
+ worksheet = logStep(worksheet, 'Test Start', 'Started', '', startTime, '');
+
+ for (const step of steps) {
+ const stepIndex = steps.indexOf(step) + 1;
+ const timestamp = new Date().toISOString();
+
+ try {
+ await step.action();
+ const screenshotPath = await takeScreenshot(driver, stepIndex, step.description);
+ worksheet = logStep(worksheet, step.description, 'Passed', stepIndex, timestamp, screenshotPath);
+ } catch (error) {
+ const screenshotPath = await takeScreenshot(driver, stepIndex, `${step.description}_Failed`);
+ worksheet = logStep(worksheet, step.description, 'Failed', stepIndex, timestamp, screenshotPath);
+ throw error; // Re-throw the error to stop further execution if necessary
+ }
+ }
+
+ // Check if login is successful
+ const logoutButton = await driver.wait(until.elementLocated(By.id('headerContainer')), 5000).catch(() => false);
+
+ if (logoutButton) {
+ console.log('Login successful');
+ testStatus = 'Passed';
+ } else {
+ console.log('Login failed');
+ }
+
+ // Log test end time
+ const endTime = new Date().toISOString();
+ worksheet = logStep(worksheet, 'Test End', 'Ended', '', endTime, '');
+
+ // Write the updated worksheet back to the workbook and save it
+ workbook.Sheets['Sheet1'] = worksheet;
+ XLSX.writeFile(workbook, 'loginResult.xlsx');
+ } finally {
+ await driver.quit();
+ }
+ })();
+}
+
+export default loginTest;
diff --git a/ExACTRegressionScripts/tests/readme.txt b/ExACTRegressionScripts/tests/readme.txt
new file mode 100644
index 0000000..e69de29
diff --git a/ExACTRegressionScripts/tests/register.js b/ExACTRegressionScripts/tests/register.js
new file mode 100644
index 0000000..a7077cb
--- /dev/null
+++ b/ExACTRegressionScripts/tests/register.js
@@ -0,0 +1,91 @@
+import { Builder, By, Key, until } from 'selenium-webdriver';
+import fs from 'fs';
+import XLSX from 'xlsx';
+
+const registerTest = (req, res) => {
+ res.send('The Register Test Case
');
+ (async function example() {
+ let driver = await new Builder().forBrowser('chrome').build();
+ let testStatus = 'Failed';
+
+ try {
+ await driver.navigate().to('https://app-qa.journeysmap.com/UI/User/Login');
+ await driver.sleep(10000);
+
+ //CLICK ON THE LINK USING TARGET: linkText=here
+
+ await driver.findElement(By.linkText('here')).click();
+ await driver.sleep(3000);
+ await driver.findElement(By.id('txtFirstName')).sendKeys('Amjad', Key.RETURN); // Replace with the correct password
+ await driver.sleep(3000);
+ await driver.findElement(By.id('txtLastName')).sendKeys('Awan', Key.RETURN); // Replace with the correct password
+ await driver.sleep(3000);
+ await driver.findElement(By.css('.btn')).click();
+ await driver.sleep(3000);
+ await driver.findElement(By.linkText('with a username')).click();
+ await driver.sleep(3000);
+ await driver.findElement(By.id('txtUsername')).sendKeys('AmjadQA16', Key.RETURN);
+ await driver.sleep(3000);
+ await driver.findElement(By.css('.btn')).click();
+ await driver.sleep(3000);
+ await driver.findElement(By.id('txtPw1')).sendKeys('edmin123', Key.RETURN);
+ await driver.sleep(3000);
+ await driver.findElement(By.id('txtPw2')).sendKeys('edmin123', Key.RETURN);
+ await driver.sleep(3000);
+ await driver.findElement(By.css('.btn')).click();
+ await driver.sleep(3000);
+ await driver.findElement(By.id('txtDobMonth')).sendKeys('01', Key.RETURN);
+ await driver.sleep(3000);
+ await driver.findElement(By.id('txtDobDate')).sendKeys('15', Key.RETURN);
+ await driver.sleep(3000);
+ await driver.findElement(By.id('txtDobYear')).sendKeys('1989', Key.RETURN);
+ await driver.sleep(3000);
+ await driver.findElement(By.css('.btn')).click();
+ await driver.sleep(3000);
+ await driver.findElement(By.css('.btn')).click();
+ await driver.sleep(3000);
+ await driver.findElement(By.css('.verticalSpacing25btm:nth-child(3) > .btn')).click();
+ await driver.sleep(10000);
+
+
+ // Check if Register is successful
+ const logoutButton = await driver.wait(until.elementLocated(By.id('headerContainer')), 5000).catch(() => false);
+
+ if (logoutButton) {
+ console.log('Register successful');
+ testStatus = 'Passed';
+ } else {
+ console.log('Register failed');
+ }
+
+ // Check if testResult.xlsx exists, and if not, create a new workbook with a sheet called "Sheet1" and add the headers ["Test Case","Status"]
+ if (!fs.existsSync('testResult.xlsx')) {
+ const workbook = XLSX.utils.book_new();
+ const worksheet = XLSX.utils.json_to_sheet([]);
+ XLSX.utils.book_append_sheet(workbook, worksheet, 'Sheet1');
+ XLSX.writeFile(workbook, 'testResult.xlsx');
+ }
+
+ // Read the existing workbook
+ const workbook = XLSX.readFile('testResult.xlsx', { cellStyles: true });
+ const sheetName = workbook.SheetNames[0];
+ const worksheet = workbook.Sheets[sheetName];
+
+ // Get the existing data as a JSON array, and add a new object to it with the test case and status
+ const json_data = XLSX.utils.sheet_to_json(worksheet);
+ const rowIndex = json_data.length + 1;
+ console.log(`Row Index is ${rowIndex}`);
+ json_data.push({ 'Test Case': 'SignUp into the application', Status: testStatus });
+
+ // Write the updated JSON array back to the workbook and save it
+ const new_worksheet = XLSX.utils.json_to_sheet(json_data);
+ workbook.Sheets[sheetName] = new_worksheet;
+ const buffer = XLSX.write(workbook, { bookType: 'xlsx', type: 'buffer' });
+ fs.writeFileSync('testResult.xlsx', buffer);
+ } finally {
+ await driver.quit();
+ }
+ })();
+}
+
+export default registerTest;
\ No newline at end of file