import { Builder, By, Key, until } from 'selenium-webdriver'; import fs from 'fs'; import XLSX from 'xlsx'; import path from 'path'; const ExACT_frameworkFrameworkGroupsDIV = (req, res) => { res.send('

ExACT Automated Test Script: Publish Framework DIV(ExACT_frameworkFrameworkGroupsDIV); Initiated

'); (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') }, //PROD - https://correlation.edgate.com/exact/login.php { description: 'Expand browser', action: async () => await driver.manage().window().maximize() }, //LOGIN { description: 'Enter username', action: async () => await driver.findElement(By.css('.form-control:nth-child(2)')).sendKeys('exact_juan') }, { description: 'Enter password', action: async () => await driver.findElement(By.css('.passfield')).sendKeys('Edgate1!') }, { description: 'Click Login button', action: async () => await driver.findElement(By.css('.login')).click() }, { description: 'Wait for login process to complete', action: async () => await driver.sleep(10000) }, //Wait for dashboard to load - Correlation Coverages View Details button { description: 'Wait for dashboard load to completely', action: async () => { return await driver.wait(until.elementLocated(By.linkText('View Details')), 10000).catch(() => false); } }, //Dashboard title { description: 'Validate dashboard title', action: async () => { const elementText = await driver.findElement(By.css('.e-heading')).getText(); if (elementText === 'Correlation Dashboard') { console.log(`Passed: "${elementText}" title matched as expected`); } else { throw new Error(`Expected: "Correlation Dashboard"; Actual: "${elementText}"`); } } }, //Align icon color -gray { description: 'Validate Align icon color', action: async () => { const elementStyle = await driver.findElement(By.css('.fb-align')).getCssValue('color'); if (elementStyle === 'rgba(99, 99, 99, 1)') { console.log('Passed: Align icon color matched as expected'); } else { throw new Error(`Align icon color did not match; Actual: "${elementStyle}"`); } } }, //NEXT ACTION - Navigate to Framework Management page { description: 'Click Frameworks navigation link', action: async () => await driver.findElement(By.linkText('Frameworks')).click() }, //Wait for page to load - Correlation Coverages View Details button { description: 'Wait for page to load', action: async () => { return await driver.wait(until.elementLocated(By.css('h2')), 10000).catch(() => false); } }, //Framework Management page title { description: 'Validate Framework Management page title', action: async () => { const elementText = await driver.findElement(By.css('h2')).getText(); if (elementText === 'Framework Management') { console.log('Passed: Framework Management page title matched as expected'); } else { throw new Error(`Expected: "Framework Management" page title; Actual: "${elementText}"`); } } }, //Framework Management page title text color -dark blue { description: 'Validate Framework Management page title text color', action: async () => { const elementStyle = await driver.findElement(By.css('h2')).getCssValue('color'); if (elementStyle === 'rgba(40, 39, 90, 1)') { console.log('Passed: Align icon color matched as expected'); } else { throw new Error(`Align icon color did not match; Actual: "${elementStyle}"`); } } }, //Framework Management page title text font { description: 'Validate Framework Management page title text font size', action: async () => { const elementStyle = await driver.findElement(By.css('h2')).getCssValue('font-size'); if (elementStyle === '32px') { console.log('Passed: Framework Management page title text font-size matched as expected'); } else { throw new Error(`Framework Management page title text font-size did not match; Actual: "${elementStyle}"`); } } }, //Publishing button icon { description: 'Verify Publishing buttion icon is present', action: async () => { const expectedIcon = await driver.wait(until.elementLocated(By.css('.btn > .fa-cloud-upload')), 5000).catch(() => false); if (!expectedIcon) { throw new Error('Publishing button icon not found'); } console.log('Passed: Publishing button icon present'); } }, //Publishing button text { description: 'Validate Publishing button text', action: async () => { const elementText = await driver.findElement(By.linkText('Publishing')).getText(); if (elementText === 'Publishing') { console.log('Passed: Publishing button text matched as expected'); } else { throw new Error(`Expected: "Publishing" button text; Actual: "${elementText}"`); } } }, //Publishing button color -green { description: 'Validate Publishing button color', action: async () => { const elementStyle = await driver.findElement(By.linkText('Publishing')).getCssValue('background-color'); if (elementStyle === 'rgba(48, 200, 172, 1)') { console.log('Passed: Align icon color matched as expected'); } else { throw new Error(`Align icon color did not match; Actual: "${elementStyle}"`); } } }, //NEXT ACTION - Click Publishing button { description: 'Click Publishing button', action: async () => await driver.findElement(By.linkText('Publishing')).click() }, //Publishing Page { description: 'Wait for Publishing page to load', action: async () => { const expectedIcon = await driver.wait(until.elementLocated(By.css('h2')), 5000).catch(() => false); if (!expectedIcon) { throw new Error('Publishing page did not load'); } console.log('Passed: Publishing page loaded'); } }, //Framework Publishing page title { description: 'Validate Framework Publishing page title', action: async () => { const elementText = await driver.findElement(By.css('h2')).getText(); if (elementText === 'Framework Publishing') { console.log('Passed: Framework Publishing page title text matched as expected'); } else { throw new Error(`Expected: "Framework Publishing" page title text; Actual: "${elementText}"`); } } }, //Framework Publishing page title text color -dark blue { description: 'Validate Framework Publishing page title text color', action: async () => { const elementStyle = await driver.findElement(By.css('h2')).getCssValue('color'); if (elementStyle === 'rgba(40, 39, 90, 1)') { console.log('Passed: Framework Publishing page title text color matched as expected'); } else { throw new Error(`Framework Publishing page title text color did not match; Actual: "${elementStyle}"`); } } }, //Framework Publishing page title text font { description: 'Validate Framework Publishing page title text font size', action: async () => { const elementStyle = await driver.findElement(By.css('h2')).getCssValue('font-size'); if (elementStyle === '32px') { console.log('Passed: Framework Publishing page title text font-size matched as expected'); } else { throw new Error(`Framework Publishing page title text font-size did not match; Actual: "${elementStyle}"`); } } }, //Publish Framework button icon { description: 'Verify Publish Framework buttion icon is present', action: async () => { const expectedIcon = await driver.wait(until.elementLocated(By.css('.fa-cloud-upload')), 5000).catch(() => false); if (!expectedIcon) { throw new Error('Publish Framework button icon not found'); } console.log('Passed: Publish Framework button icon present'); } }, //Publish Framework button text { description: 'Validate Publish Framework button text', action: async () => { const elementText = await driver.findElement(By.linkText('Publish Framework')).getText(); if (elementText === 'Publish Framework') { console.log('Passed: Publish Framework button text matched as expected'); } else { throw new Error(`Expected: "Publish Framework" button text; Actual: "${elementText}"`); } } }, //Publish Framework button color -green { description: 'Validate Publish Framework button color', action: async () => { const elementStyle = await driver.findElement(By.linkText('Publish Framework')).getCssValue('background-color'); if (elementStyle === 'rgba(48, 200, 172, 1)') { console.log('Passed: Publish Framework button color matched as expected'); } else { throw new Error(`Publish Framework button color did not match; Actual: "${elementStyle}"`); } } }, //Groups button icon { description: 'Verify Groups buttion icon is present', action: async () => { const expectedIcon = await driver.wait(until.elementLocated(By.css('.fa-th-list')), 5000).catch(() => false); if (!expectedIcon) { throw new Error('Groups button icon not found'); } console.log('Passed: Groups button icon present'); } }, //Groups button text { description: 'Validate Groups button text', action: async () => { const elementText = await driver.findElement(By.linkText('Groups')).getText(); if (elementText === 'Groups') { console.log('Passed: Groups button text matched as expected'); } else { throw new Error(`Expected: "Groups" button text; Actual: "${elementText}"`); } } }, //Groups button color -navy blue { description: 'Validate Groups button color', action: async () => { const elementStyle = await driver.findElement(By.linkText('Groups')).getCssValue('background-color'); if (elementStyle === 'rgba(40, 39, 90, 1)') { console.log('Passed: Groups button color matched as expected'); } else { throw new Error(`Groups button color did not match; Actual: "${elementStyle}"`); } } }, //Settings button icon { description: 'Verify Settings buttion icon is present', action: async () => { const expectedIcon = await driver.wait(until.elementLocated(By.css('.fa-cog')), 5000).catch(() => false); if (!expectedIcon) { throw new Error('Settings button icon not found'); } console.log('Passed: Settings button icon present'); } }, //Settings button text { description: 'Validate Settings button text', action: async () => { const elementText = await driver.findElement(By.linkText('Settings')).getText(); if (elementText === 'Settings') { console.log('Passed: Settings button text matched as expected'); } else { throw new Error(`Expected: "Settings" button text; Actual: "${elementText}"`); } } }, //Settings button color -green { description: 'Validate Settings button color', action: async () => { const elementStyle = await driver.findElement(By.linkText('Settings')).getCssValue('background-color'); if (elementStyle === 'rgba(48, 200, 172, 1)') { console.log('Passed: Settings button color matched as expected'); } else { throw new Error(`Settings button color did not match; Actual: "${elementStyle}"`); } } }, //Publishing History sub title { description: 'Validate Publishing History sub title', action: async () => { const elementText = await driver.findElement(By.css('h4')).getText(); if (elementText === 'Publishing History http://qaclient.esp.edgate.com') { console.log('Passed: Publishing History sub title text matched as expected'); } else { throw new Error(`Expected: "Publishing History" sub title text; Actual: "${elementText}"`); } } }, //Publishing History sub title text color -navy blue { description: 'Validate Publishing History sub title text color', action: async () => { const elementStyle = await driver.findElement(By.css('h4')).getCssValue('color'); if (elementStyle === 'rgba(40, 39, 90, 1)') { console.log('Passed: Publishing History sub title text color matched as expected'); } else { throw new Error(`Publishing History sub title text color did not match; Actual: "${elementStyle}"`); } } }, //Publishing History Sub title text font { description: 'Validate Publishing History sub title text font size', action: async () => { const elementStyle = await driver.findElement(By.css('h4')).getCssValue('font-size'); if (elementStyle === '24px') { console.log('Passed: Publishing History sub title text font-size matched as expected'); } else { throw new Error(`Publishing History sub title text font-size did not match; Actual: "${elementStyle}"`); } } }, //Publishing History button text { description: 'Validate Publish History button text', action: async () => { const elementText = await driver.findElement(By.css('body > div.container.body > div > div.right_col > div > h4 > a')).getText(); if (elementText === 'http://qaclient.esp.edgate.com') { console.log('Passed: http://qaclient.esp.edgate.com button text matched as expected'); } else { throw new Error(`Expected: "http://qaclient.esp.edgate.com" button text; Actual: "${elementText}"`); } } }, //Publishing History button color -green { description: 'Validate Publishing History button color', action: async () => { const elementStyle = await driver.findElement(By.css('.btn-sm')).getCssValue('background-color'); if (elementStyle === 'rgba(48, 200, 172, 1)') { console.log('Passed: Publishing History button color matched as expected'); } else { throw new Error(`Publishing History button color did not match; Actual: "${elementStyle}"`); } } }, //Publishing History button icon { description: 'Verify Publishing History buttion icon is present', action: async () => { const expectedIcon = await driver.wait(until.elementLocated(By.css('.btn-sm > .fa')), 5000).catch(() => false); if (!expectedIcon) { throw new Error('Publishing History button icon not found'); } console.log('Passed: Publishing History button icon present'); } }, //Framework column title { description: 'Validate Framework column title', action: async () => { const elementText = await driver.findElement(By.css('th:nth-child(1)')).getText(); if (elementText === 'Framework') { console.log('Passed: Framework column title text matched as expected'); } else { throw new Error(`Expected: "Framework" column title text; Actual: "${elementText}"`); } } }, //Framework column title text color -dark blue { description: 'Validate Framework column title text color', action: async () => { const elementStyle = await driver.findElement(By.css('th:nth-child(1)')).getCssValue('color'); if (elementStyle === 'rgba(33, 37, 41, 1)') { console.log('Passed: Framework column title text color matched as expected'); } else { throw new Error(`Framework column title text color did not match; Actual: "${elementStyle}"`); } } }, //Framework column title text font { description: 'Validate Framework column title text font size', action: async () => { const elementStyle = await driver.findElement(By.css('th:nth-child(1)')).getCssValue('font-size'); if (elementStyle === '14.3px') { console.log('Passed: Framework column title text font-size matched as expected'); } else { throw new Error(`Framework column title text font-size did not match; Actual: "${elementStyle}"`); } } }, //Version column title { description: 'Validate Version column title', action: async () => { const elementText = await driver.findElement(By.css('th:nth-child(2)')).getText(); if (elementText === 'Version') { console.log('Passed: Version column title text matched as expected'); } else { throw new Error(`Expected: "Version" column title text; Actual: "${elementText}"`); } } }, //Version column title text color -dark blue { description: 'Validate Version column title text color', action: async () => { const elementStyle = await driver.findElement(By.css('th:nth-child(2)')).getCssValue('color'); if (elementStyle === 'rgba(33, 37, 41, 1)') { console.log('Passed: Version column title text color matched as expected'); } else { throw new Error(`Version column title text color did not match; Actual: "${elementStyle}"`); } } }, //Version column title text font { description: 'Validate Version column title text font size', action: async () => { const elementStyle = await driver.findElement(By.css('th:nth-child(2)')).getCssValue('font-size'); if (elementStyle === '14.3px') { console.log('Passed: Version column title text font-size matched as expected'); } else { throw new Error(`Version column title text font-size did not match; Actual: "${elementStyle}"`); } } }, //Revision column title { description: 'Validate Revision column title', action: async () => { const elementText = await driver.findElement(By.css('th:nth-child(3)')).getText(); if (elementText === 'Revision') { console.log('Passed: Revision column title text matched as expected'); } else { throw new Error(`Expected: "Revision" column title text; Actual: "${elementText}"`); } } }, //Revision column title text color -dark blue { description: 'Validate Revision column title text color', action: async () => { const elementStyle = await driver.findElement(By.css('th:nth-child(3)')).getCssValue('color'); if (elementStyle === 'rgba(33, 37, 41, 1)') { console.log('Passed: Revision column title text color matched as expected'); } else { throw new Error(`Revision column title text color did not match; Actual: "${elementStyle}"`); } } }, //Revision column title text font { description: 'Validate Revision column title text font size', action: async () => { const elementStyle = await driver.findElement(By.css('th:nth-child(3)')).getCssValue('font-size'); if (elementStyle === '14.3px') { console.log('Passed: Revision column title text font-size matched as expected'); } else { throw new Error(`Revision column title text font-size did not match; Actual: "${elementStyle}"`); } } }, //Status column title { description: 'Validate Status column title', action: async () => { const elementText = await driver.findElement(By.css('th:nth-child(4)')).getText(); if (elementText === 'Status') { console.log('Passed: Status column title text matched as expected'); } else { throw new Error(`Expected: "Status" column title text; Actual: "${elementText}"`); } } }, //Status column title text color -dark blue { description: 'Validate Status column title text color', action: async () => { const elementStyle = await driver.findElement(By.css('th:nth-child(4)')).getCssValue('color'); if (elementStyle === 'rgba(33, 37, 41, 1)') { console.log('Passed: Status column title text color matched as expected'); } else { throw new Error(`Status column title text color did not match; Actual: "${elementStyle}"`); } } }, //Status column title text font { description: 'Validate Status column title text font size', action: async () => { const elementStyle = await driver.findElement(By.css('th:nth-child(4)')).getCssValue('font-size'); if (elementStyle === '14.3px') { console.log('Passed: Status column title text font-size matched as expected'); } else { throw new Error(`Status column title text font-size did not match; Actual: "${elementStyle}"`); } } }, //Visibility column title { description: 'Validate Visibility column title', action: async () => { const elementText = await driver.findElement(By.css('th:nth-child(5)')).getText(); if (elementText === 'Visibility') { console.log('Passed: Visibility column title text matched as expected'); } else { throw new Error(`Expected: "Visibility" column title text; Actual: "${elementText}"`); } } }, //Visibility column title text color -dark blue { description: 'Validate Visibility column title text color', action: async () => { const elementStyle = await driver.findElement(By.css('th:nth-child(5)')).getCssValue('color'); if (elementStyle === 'rgba(33, 37, 41, 1)') { console.log('Passed: Visibility column title text color matched as expected'); } else { throw new Error(`Visibility column title text color did not match; Actual: "${elementStyle}"`); } } }, //Visibility column title text font { description: 'Validate Visibility column title text font size', action: async () => { const elementStyle = await driver.findElement(By.css('th:nth-child(5)')).getCssValue('font-size'); if (elementStyle === '14.3px') { console.log('Passed: Visibility column title text font-size matched as expected'); } else { throw new Error(`Visibility column title text font-size did not match; Actual: "${elementStyle}"`); } } }, //Group column title { description: 'Validate Group column title', action: async () => { const elementText = await driver.findElement(By.css('th:nth-child(6)')).getText(); if (elementText === 'Group') { console.log('Passed: Group column title text matched as expected'); } else { throw new Error(`Expected: "Group" column title text; Actual: "${elementText}"`); } } }, //Group column title text color -dark blue { description: 'Validate Group column title text color', action: async () => { const elementStyle = await driver.findElement(By.css('th:nth-child(6)')).getCssValue('color'); if (elementStyle === 'rgba(33, 37, 41, 1)') { console.log('Passed: Group column title text color matched as expected'); } else { throw new Error(`Group column title text color did not match; Actual: "${elementStyle}"`); } } }, //Group column title text font { description: 'Validate Group column title text font size', action: async () => { const elementStyle = await driver.findElement(By.css('th:nth-child(6)')).getCssValue('font-size'); if (elementStyle === '14.3px') { console.log('Passed: Group column title text font-size matched as expected'); } else { throw new Error(`Group column title text font-size did not match; Actual: "${elementStyle}"`); } } }, //Published At column title { description: 'Validate Published At column title', action: async () => { const elementText = await driver.findElement(By.css('th:nth-child(7)')).getText(); if (elementText === 'Published At') { console.log('Passed: Published At column title text matched as expected'); } else { throw new Error(`Expected: "Published At" column title text; Actual: "${elementText}"`); } } }, //Published At column title text color -dark blue { description: 'Validate Published At column title text color', action: async () => { const elementStyle = await driver.findElement(By.css('th:nth-child(7)')).getCssValue('color'); if (elementStyle === 'rgba(33, 37, 41, 1)') { console.log('Passed: Published At column title text color matched as expected'); } else { throw new Error(`Published At column title text color did not match; Actual: "${elementStyle}"`); } } }, //Published At column title text font { description: 'Validate Published At column title text font size', action: async () => { const elementStyle = await driver.findElement(By.css('th:nth-child(7)')).getCssValue('font-size'); if (elementStyle === '14.3px') { console.log('Passed: Published At column title text font-size matched as expected'); } else { throw new Error(`Published At column title text font-size did not match; Actual: "${elementStyle}"`); } } }, //By column title { description: 'Validate By column title', action: async () => { const elementText = await driver.findElement(By.css('th:nth-child(8)')).getText(); if (elementText === 'By') { console.log('Passed: By column title text matched as expected'); } else { throw new Error(`Expected: "By" column title text; Actual: "${elementText}"`); } } }, //By column title text color -dark blue { description: 'Validate By column title text color', action: async () => { const elementStyle = await driver.findElement(By.css('th:nth-child(8)')).getCssValue('color'); if (elementStyle === 'rgba(33, 37, 41, 1)') { console.log('Passed: By column title text color matched as expected'); } else { throw new Error(`By column title text color did not match; Actual: "${elementStyle}"`); } } }, //By column title text font { description: 'Validate By column title text font size', action: async () => { const elementStyle = await driver.findElement(By.css('th:nth-child(8)')).getCssValue('font-size'); if (elementStyle === '14.3px') { console.log('Passed: By column title text font-size matched as expected'); } else { throw new Error(`By column title text font-size did not match; Actual: "${elementStyle}"`); } } }, //Comments column title { description: 'Validate Comments column title', action: async () => { const elementText = await driver.findElement(By.css('th:nth-child(9)')).getText(); if (elementText === 'Comments') { console.log('Passed: Comments column title text matched as expected'); } else { throw new Error(`Expected: "Comments" column title text; Actual: "${elementText}"`); } } }, //Comments column title text color -dark blue { description: 'Validate Comments column title text color', action: async () => { const elementStyle = await driver.findElement(By.css('th:nth-child(9)')).getCssValue('color'); if (elementStyle === 'rgba(33, 37, 41, 1)') { console.log('Passed: Comments column title text color matched as expected'); } else { throw new Error(`Comments column title text color did not match; Actual: "${elementStyle}"`); } } }, //Comments column title text font { description: 'Validate Comments column title text font size', action: async () => { const elementStyle = await driver.findElement(By.css('th:nth-child(9)')).getCssValue('font-size'); if (elementStyle === '14.3px') { console.log('Passed: Comments column title text font-size matched as expected'); } else { throw new Error(`Comments column title text font-size did not match; Actual: "${elementStyle}"`); } } }, //Action column title { description: 'Validate Action column title', action: async () => { const elementText = await driver.findElement(By.css('th:nth-child(10)')).getText(); if (elementText === 'Action') { console.log('Passed: Action column title text matched as expected'); } else { throw new Error(`Expected: "Action" column title text; Actual: "${elementText}"`); } } }, //Action column title text color -dark blue { description: 'Validate Action column title text color', action: async () => { const elementStyle = await driver.findElement(By.css('th:nth-child(10)')).getCssValue('color'); if (elementStyle === 'rgba(33, 37, 41, 1)') { console.log('Passed: Action column title text color matched as expected'); } else { throw new Error(`Action column title text color did not match; Actual: "${elementStyle}"`); } } }, //Action column title text font { description: 'Validate Action column title text font size', action: async () => { const elementStyle = await driver.findElement(By.css('th:nth-child(10)')).getCssValue('font-size'); if (elementStyle === '14.3px') { console.log('Passed: Action column title text font-size matched as expected'); } else { throw new Error(`Action column title text font-size did not match; Actual: "${elementStyle}"`); } } }, //Published Framework 1 display title { description: 'Validate Published Framework 1 display title', action: async () => { try { const element = await driver.findElement(By.css('tr:nth-child(2) > td:nth-child(1)')); //Get different versions of the text for debugging const fullText = await element.getText(); //Check for the expected text in different ways const expectedText = 'Painting Done Today'; const trimmedFullText = fullText.trim(); const firstLine = trimmedFullText.split('\n')[0].trim(); //Try multiple matching strategies if (firstLine.includes(expectedText)) { console.log(`Passed: Framework title row 1 "${expectedText}" text in first line`); } else if (trimmedFullText.includes(expectedText)) { console.log(`Passed: Framework title row 1 "${expectedText}" text within full text`); } else { throw new Error( `Text validation failed.\nExpected: "${expectedText}"\n` + `Full text: "${fullText}"\n` + `First line: "${firstLine}"\n` ); } } catch (error) { console.error('Detailed error during validation:', error); throw error; //Re-throw after logging } } }, //Published Framework 1 Notes icon { description: 'Verify Published Framework 1 notes icon is present', action: async () => { const expectedIcon = await driver.wait(until.elementLocated(By.css('.fa-sticky-note-o')), 5000).catch(() => false); if (!expectedIcon) { throw new Error('Published Framework 1 Notes icon not found'); } console.log('Passed: Published Framework 1 Notes icon present'); } }, //Published Framework 1 title { description: 'Validate Published Framework 1 title', action: async () => { const elementText = await driver.findElement(By.css('tr:nth-child(2) em')).getText(); if (elementText === 'Juan Testing Again & Again') { console.log('Passed: Juan Testing Again & Again row 1 title text matched as expected'); } else { throw new Error(`Expected: "Juan Testing Again & Again" row 1 title text; Actual: "${elementText}"`); } } }, //Published Framework 1 Version { description: 'Validate Published Framework 1 version', action: async () => { const elementText = await driver.findElement(By.css('tr:nth-child(2) > td:nth-child(2)')).getText(); if (elementText === '1.1') { console.log('Passed: Version 1.1 row 1 title text matched as expected'); } else { throw new Error(`Expected: Version "1.1" row 1 title text; Actual: "${elementText}"`); } } }, //Published Framework 1 Revision { description: 'Validate Published Framework 1 revision', action: async () => { const elementText = await driver.findElement(By.css('tr:nth-child(2) > td:nth-child(3)')).getText(); if (elementText === '5') { console.log('Passed: Revision 5 row 1 title text matched as expected'); } else { throw new Error(`Expected: Revision "5" row 1 title text; Actual: "${elementText}"`); } } }, //Published Framework 1 Status button text { description: 'Validate Published Framework 1 status button text', action: async () => { const elementText = await driver.findElement(By.css('tr:nth-child(2) > td > .badge')).getText(); if (elementText === 'Implemented') { console.log('Passed: Implemented row 1 title text matched as expected'); } else { throw new Error(`Expected: "Implemented" row 1 title text; Actual: "${elementText}"`); } } }, //Published Framework 1 Status button color -green { description: 'Validate Action column title text color', action: async () => { const elementStyle = await driver.findElement(By.css('tr:nth-child(2) > td > .badge')).getCssValue('background-color'); if (elementStyle === 'rgba(40, 167, 69, 1)') { console.log('Passed: Published Framework row 1 Status button color matched as expected'); } else { throw new Error(`Published Framework row 1 Status button color did not match; Actual: "${elementStyle}"`); } } }, //Published Framework 1 Visibility { description: 'Validate Published Framework 1 visibility', action: async () => { const elementText = await driver.findElement(By.css('tr:nth-child(2) > td:nth-child(5)')).getText(); if (elementText === 'Public') { console.log('Passed: Public row 1 title text matched as expected'); } else { throw new Error(`Expected: "Public" row 1 title text; Actual: "${elementText}"`); } } }, //Published Framework 1 Group { description: 'Validate Published Framework 1 group', action: async () => { const elementText = await driver.findElement(By.css('tr:nth-child(2) > td:nth-child(6)')).getText(); if (elementText === 'Initial Framework Group for Testing') { console.log('Passed: Initial Framework Group for Testing row 1 title text matched as expected'); } else { throw new Error(`Expected: "Initial Framework Group for Testing" row 1 title text; Actual: "${elementText}"`); } } }, //Published Framework 1 Published At { description: 'Validate Published Framework 1 published at', action: async () => { const elementText = await driver.findElement(By.css('tr:nth-child(2) > td:nth-child(7) > small')).getText(); if (elementText === 'Apr 15, 2025 10:29pm PDT') { console.log('Passed: Apr 15, 2025 10:29pm PDT row 1 title text matched as expected'); } else { throw new Error(`Expected: "Apr 15, 2025 10:29pm PDT" row 1 title text; Actual: "${elementText}"`); } } }, //Published Framework 1 By { description: 'Validate Published Framework 1 by', action: async () => { const elementText = await driver.findElement(By.css('tr:nth-child(2) > td:nth-child(8)')).getText(); if (elementText === 'exact_juan') { console.log('Passed: exact_juan row 1 title text matched as expected'); } else { throw new Error(`Expected: "exact_juan" row 1 title text; Actual: "${elementText}"`); } } }, //Published Framework 1 Comments icon { description: 'Verify Published Framework 1 comments icon is present', action: async () => { const expectedIcon = await driver.wait(until.elementLocated(By.css('tr:nth-child(2) .fa-check-circle')), 5000).catch(() => false); if (!expectedIcon) { throw new Error('Published Framework row 1 comments icon not found'); } console.log('Passed: Published Framework row 1 comments icon present'); } }, //Published Framework 1 Comments Count icon { description: 'Validate Published Framework 1 comments count icon', action: async () => { const elementText = await driver.findElement(By.css('tr:nth-child(2) a > .badge')).getText(); if (elementText === '3') { console.log('Passed: Comments count 3 row 1 title text matched as expected'); } else { throw new Error(`Expected: Comments count "3" row 1 title text; Actual: "${elementText}"`); } } }, //Published Framework 1 ellipsis icon { description: 'Verify Published Framework 1 ellipsis icon is present', action: async () => { const expectedIcon = await driver.wait(until.elementLocated(By.css('#dropdownMenu17 > .fa')), 5000).catch(() => false); if (!expectedIcon) { throw new Error('Published Framework row 1 ellipsis icon not found'); } console.log('Passed: Published Framework row 1 ellipsis icon present'); } }, //Published Framework 2 display title { description: 'Validate Published Framework 2 display title', action: async () => { try { const element = await driver.findElement(By.css('tr:nth-child(3) > td:nth-child(1)')); //Get different versions of the text for debugging const fullText = await element.getText(); //Check for the expected text in different ways const expectedText = 'KathleenTest DontBringBack Comments'; const trimmedFullText = fullText.trim(); const firstLine = trimmedFullText.split('\n')[0].trim(); //Try multiple matching strategies if (firstLine.includes(expectedText)) { console.log(`Passed: Framework title row 2 "${expectedText}" text found in first line`); } else if (trimmedFullText.includes(expectedText)) { console.log(`Passed: Framework title row 2 "${expectedText}" text found within full text`); } else { throw new Error( `Text validation failed.\nExpected: "${expectedText}"\n` + `Full text: "${fullText}"\n` + `First line: "${firstLine}"\n` ); } } catch (error) { console.error('Detailed error during validation:', error); throw error; //Re-throw after logging } } }, //Published Framework 2 title { description: 'Validate Published Framework 2 title', action: async () => { const elementText = await driver.findElement(By.css('tr:nth-child(3) em')).getText(); if (elementText === 'Kathleen Test') { console.log('Passed: Kathleen Test row 2 title text matched as expected'); } else { throw new Error(`Expected: "Kathleen Test" row 2 title text; Actual: "${elementText}"`); } } }, //Published Framework 2 Version { description: 'Validate Published Framework 2 version', action: async () => { const elementText = await driver.findElement(By.css('tr:nth-child(3) > td:nth-child(2)')).getText(); if (elementText === '10.1') { console.log('Passed: Version 10.1 row 2 title text matched as expected'); } else { throw new Error(`Expected: Version "10.1" row 2 title text; Actual: "${elementText}"`); } } }, //Published Framework 2 Revision { description: 'Validate Published Framework 2 revision', action: async () => { const elementText = await driver.findElement(By.css('tr:nth-child(3) > td:nth-child(3)')).getText(); if (elementText === '2') { console.log('Passed: Revision 2 row 2 title text matched as expected'); } else { throw new Error(`Expected: Revision "2" row 2 title text; Actual: "${elementText}"`); } } }, //Published Framework 2 Status button text { description: 'Validate Published Framework 2 status button text', action: async () => { const elementText = await driver.findElement(By.css('tr:nth-child(3) > td > .badge')).getText(); if (elementText === 'Adopted') { console.log('Passed: Adopted row 2 title text matched as expected'); } else { throw new Error(`Expected: "Adopted" row 2 title text; Actual: "${elementText}"`); } } }, //Published Framework 2 Status button color -teal { description: 'Validate Action column title text color', action: async () => { const elementStyle = await driver.findElement(By.css('tr:nth-child(3) > td > .badge')).getCssValue('background-color'); if (elementStyle === 'rgba(23, 162, 184, 1)') { console.log('Passed: Published Framework row 2 Status button color matched as expected'); } else { throw new Error(`Published Framework row 2 Status button color did not match; Actual: "${elementStyle}"`); } } }, //Published Framework 2 Visibility { description: 'Validate Published Framework 2 visibility', action: async () => { const elementText = await driver.findElement(By.css('tr:nth-child(3) > td:nth-child(5)')).getText(); if (elementText === 'Hidden') { console.log('Passed: Hidden row 2 title text matched as expected'); } else { throw new Error(`Expected: "Hidden" row 2 title text; Actual: "${elementText}"`); } } }, //Published Framework 2 Group { description: 'Validate Published Framework 2 group', action: async () => { const elementText = await driver.findElement(By.css('tr:nth-child(3) > td:nth-child(6)')).getText(); if (elementText === 'Another Group To Use') { console.log('Passed: Another Group To Use row 2 title text matched as expected'); } else { throw new Error(`Expected: "Another Group To Use" row 2 title text; Actual: "${elementText}"`); } } }, //Published Framework 2 Published At { description: 'Validate Published Framework 2 published at', action: async () => { const elementText = await driver.findElement(By.css('tr:nth-child(3) > td:nth-child(7) > small')).getText(); if (elementText === 'Mar 01, 2025 09:56pm PST') { console.log('Passed: Apr 15, 2025 10:29pm PDT row 2 title text matched as expected'); } else { throw new Error(`Expected: "Apr 15, 2025 10:29pm PDT" row 2 title text; Actual: "${elementText}"`); } } }, //Published Framework 2 By { description: 'Validate Published Framework 2 by', action: async () => { const elementText = await driver.findElement(By.css('tr:nth-child(3) > td:nth-child(8)')).getText(); if (elementText === 'exact_juan') { console.log('Passed: exact_juan row 2 title text matched as expected'); } else { throw new Error(`Expected: "exact_juan" row 2 title text; Actual: "${elementText}"`); } } }, //Published Framework 2 Comments icon { description: 'Verify Published Framework 2 comments icon is present', action: async () => { const expectedIcon = await driver.wait(until.elementLocated(By.css('tr:nth-child(3) > td > .fa')), 5000).catch(() => false); if (!expectedIcon) { throw new Error('Published Framework row 2 comments icon not found'); } console.log('Passed: Published Framework row 2 comments icon present'); } }, //Published Framework 2 Comments Count icon { description: 'Validate Published Framework 2 comments count icon', action: async () => { const elementText = await driver.findElement(By.css('tr:nth-child(3) a > .badge')).getText(); if (elementText === '4') { console.log('Passed: Comments count 4 row 2 title text matched as expected'); } else { throw new Error(`Expected: Comments count "4" row 2 title text; Actual: "${elementText}"`); } } }, //Published Framework 2 ellipsis icon { description: 'Verify Published Framework 2 ellipsis icon is present', action: async () => { const expectedIcon = await driver.wait(until.elementLocated(By.css('#dropdownMenu14 > .fa')), 5000).catch(() => false); if (!expectedIcon) { throw new Error('Published Framework row 2 ellipsis icon not found'); } console.log('Passed: Published Framework row 2 ellipsis icon present'); } }, //NEXT ACTION - Click Groups button { description: 'Click Groups button', action: async () => await driver.findElement(By.linkText('Groups')).click() }, //Wait for DIV to open { description: 'Wait for DIV to open', action: async () => { return await driver.wait(until.elementLocated(By.css('.modal-title')), 10000).catch(() => false); } }, //DIV title text { description: 'Validate DIV title', action: async () => { const elementText = await driver.findElement(By.css('.modal-title')).getText(); if (elementText === 'Framework Groups') { console.log('Passed: Framework Groups DIV title text matched as expected'); } else { throw new Error(`Expected: "Framework Groups" DIV title text; Actual: "${elementText}"`); } } }, //DIV X icon color -red { description: 'Validate X icon color', action: async () => { const elementStyle = await driver.findElement(By.css('.close > span')).getCssValue('color'); if (elementStyle === 'rgba(246, 60, 40, 1)') { console.log('Passed: Align icon color matched as expected'); } else { throw new Error(`Align icon color did not match; Actual: "${elementStyle}"`); } } }, //DIV textbox placeholder { description: 'Validate textbox placeholder', action: async () => { const elementValue = await driver.findElement(By.css('#groupname')).getAttribute('placeholder'); if (elementValue === '') { console.log('Passed: "blank" placeholder text, matched as expected'); } else { throw new Error(`Expected: "blank" placeholder text; Actual: "${elementValue}"`); } } }, //DIV Add New Group button text { description: 'Validate Add New Group button text', action: async () => { const elementText = await driver.findElement(By.css('#groupsubmit')).getText(); if (elementText === 'Add New Group') { console.log('Passed: Add New Group button text matched as expected'); } else { throw new Error(`Expected: "Add New Group" button text; Actual: "${elementText}"`); } } }, //DIV Add New Group button color -green { description: 'Validate Add New Group button color', action: async () => { const elementStyle = await driver.findElement(By.css('#groupsubmit')).getCssValue('background-color'); if (elementStyle === 'rgba(48, 200, 172, 1)') { console.log('Passed: Add New Group button color matched as expected'); } else { throw new Error(`Add New Group button color did not match; Actual: "${elementStyle}"`); } } }, //DIV Group column header text { description: 'Validate Group column header text', action: async () => { const elementText = await driver.findElement(By.css('thead th:nth-child(1)')).getText(); if (elementText === 'Group') { console.log('Passed: Group column header text matched as expected'); } else { throw new Error(`Expected: "Group" column header text; Actual: "${elementText}"`); } } }, //DIV Edit column header text { description: 'Validate Edit column header text', action: async () => { const elementText = await driver.findElement(By.css('thead th:nth-child(2)')).getText(); if (elementText === 'Edit') { console.log('Passed: Edit column header text matched as expected'); } else { throw new Error(`Expected: "Edit" column header text; Actual: "${elementText}"`); } } }, //DIV Order column header text { description: 'Validate Order column header text', action: async () => { const elementText = await driver.findElement(By.css('thead th:nth-child(3)')).getText(); if (elementText === 'Order') { console.log('Passed: Order column header text matched as expected'); } else { throw new Error(`Expected: "Order" column header text; Actual: "${elementText}"`); } } }, //DIV Delete column header text { description: 'Validate Delete column header text', action: async () => { const elementText = await driver.findElement(By.css('thead th:nth-child(4)')).getText(); if (elementText === 'Delete') { console.log('Passed: Delete column header text matched as expected'); } else { throw new Error(`Expected: "Delete" column header text; Actual: "${elementText}"`); } } }, //DIV Group 1 text { description: 'Validate Group 1 text', action: async () => { const elementText = await driver.findElement(By.xpath('//div[2]/table/tbody/tr/td/div')).getText(); if (elementText === 'Initial Framework Group for Testing') { console.log('Passed: Initial Framework Group for Testing text matched as expected'); } else { throw new Error(`Expected: "Initial Framework Group for Testing" text; Actual: "${elementText}"`); } } }, //DIV - edit icon 1 { description: 'Verify edit icon 1 is present', action: async () => { const expectedIcon = await driver.wait(until.elementLocated(By.css('tr:nth-child(1) .fa-pencil-square')), 5000).catch(() => false); if (!expectedIcon) { throw new Error('Edit icon 1 not found'); } console.log('Passed: Edit icon 1 present'); } }, //DIV - order down icon 1 { description: 'Verify order down icon 1 is present', action: async () => { const expectedIcon = await driver.wait(until.elementLocated(By.css('tr:nth-child(1) .fa-arrow-down')), 5000).catch(() => false); if (!expectedIcon) { throw new Error('Order down icon 1 not found'); } console.log('Passed: Order down icon 1 present'); } }, //DIV - order up icon 1 { description: 'Verify order up icon 1 is present', action: async () => { const expectedIcon = await driver.wait(until.elementLocated(By.css('tr:nth-child(1) .fa-arrow-up')), 5000).catch(() => false); if (!expectedIcon) { throw new Error('Order up icon 1 not found'); } console.log('Passed: Order up icon 1 present'); } }, //DIV - delete icon 1 { description: 'Verify delete icon 1 is present', action: async () => { const expectedIcon = await driver.wait(until.elementLocated(By.css('tr:nth-child(1) .fa-times-circle')), 5000).catch(() => false); if (!expectedIcon) { throw new Error('Delete icon 1 not found'); } console.log('Passed: Delete icon 1 present'); } }, //DIV Group 2 text { description: 'Validate Group 2 text', action: async () => { const elementText = await driver.findElement(By.xpath('//div[2]/table/tbody/tr[2]/td/div')).getText(); if (elementText === 'Another Group To Use') { console.log('Passed: Another Group To Use text matched as expected'); } else { throw new Error(`Expected: "Another Group To Use" text; Actual: "${elementText}"`); } } }, //DIV - edit icon 2 { description: 'Verify edit icon 2 is present', action: async () => { const expectedIcon = await driver.wait(until.elementLocated(By.css('tr:nth-child(2) .fa-pencil-square')), 5000).catch(() => false); if (!expectedIcon) { throw new Error('Edit icon 2 not found'); } console.log('Passed: Edit icon 2 present'); } }, //DIV - order down icon 2 { description: 'Verify order down icon 2 is present', action: async () => { const expectedIcon = await driver.wait(until.elementLocated(By.css('tr:nth-child(2) .fa-arrow-down')), 5000).catch(() => false); if (!expectedIcon) { throw new Error('Order down icon 2 not found'); } console.log('Passed: Order down icon 2 present'); } }, //DIV - order up icon 2 { description: 'Verify order up icon 2 is present', action: async () => { const expectedIcon = await driver.wait(until.elementLocated(By.css('tr:nth-child(2) .fa-arrow-up')), 5000).catch(() => false); if (!expectedIcon) { throw new Error('Order up icon 2 not found'); } console.log('Passed: Order up icon 2 present'); } }, //DIV - delete icon 2 { description: 'Verify delete icon 2 is present', action: async () => { const expectedIcon = await driver.wait(until.elementLocated(By.css('tr:nth-child(2) .fa-times-circle')), 5000).catch(() => false); if (!expectedIcon) { throw new Error('Delete icon 2 not found'); } console.log('Passed: Delete icon 2 present'); } }, //DIV Group 3 text { description: 'Validate Group 3 text', action: async () => { const elementText = await driver.findElement(By.xpath('//div[2]/table/tbody/tr[3]/td/div')).getText(); if (elementText === 'Empty Group Set') { console.log('Passed: Empty Group Set text matched as expected'); } else { throw new Error(`Expected: "Empty Group Set" text; Actual: "${elementText}"`); } } }, //DIV - edit icon 3 { description: 'Verify edit icon 3 is present', action: async () => { const expectedIcon = await driver.wait(until.elementLocated(By.css('tr:nth-child(3) .fa-pencil-square')), 5000).catch(() => false); if (!expectedIcon) { throw new Error('Edit icon 3 not found'); } console.log('Passed: Edit icon 3 present'); } }, //DIV - order down icon 3 { description: 'Verify order down icon 3 is present', action: async () => { const expectedIcon = await driver.wait(until.elementLocated(By.css('tr:nth-child(3) .fa-arrow-down')), 5000).catch(() => false); if (!expectedIcon) { throw new Error('Order down icon 3 not found'); } console.log('Passed: Order down icon 3 present'); } }, //DIV - order up icon 3 { description: 'Verify order up icon 3 is present', action: async () => { const expectedIcon = await driver.wait(until.elementLocated(By.css('tr:nth-child(3) .fa-arrow-up')), 5000).catch(() => false); if (!expectedIcon) { throw new Error('Order up icon 3 not found'); } console.log('Passed: Order up icon 3 present'); } }, //DIV - delete icon 3 { description: 'Verify delete icon 3 is present', action: async () => { const expectedIcon = await driver.wait(until.elementLocated(By.css('tr:nth-child(3) .fa-times-circle')), 5000).catch(() => false); if (!expectedIcon) { throw new Error('Delete icon 3 not found'); } console.log('Passed: Delete icon 3 present'); } }, //DIV Close button text { description: 'Validate Close button text', action: async () => { const elementText = await driver.findElement(By.css('#modalclose')).getText(); if (elementText === 'Close') { console.log('Passed: Close button text matched as expected'); } else { throw new Error(`Expected: "Close" button text; Actual: "${elementText}"`); } } }, //DIV Close button color -white { description: 'Validate Close button color', action: async () => { const elementStyle = await driver.findElement(By.css('#modalclose')).getCssValue('background-color'); if (elementStyle === 'rgba(0, 0, 0, 0)') { console.log('Passed: Close button color matched as expected'); } else { throw new Error(`Close button color did not match; Actual: "${elementStyle}"`); } } }, //NEXT ACTION - Click the Add New Group - validation { description: 'Click Add New Group button', action: async () => await driver.findElement(By.css('#groupsubmit')).click() }, //DIV Validation { description: 'Validate empty group name validation text', action: async () => { const elementText = await driver.findElement(By.css('#validationServer03Feedback')).getText(); if (elementText === 'You must enter a valid group name') { console.log('Passed: You must enter a valid group name validation text matched as expected'); } else { throw new Error(`Expected: "You must enter a valid group name" validation text; Actual: "${elementText}"`); } } }, //DIV Validation color -red { description: 'Validate Close button color', action: async () => { const elementStyle = await driver.findElement(By.css('#validationServer03Feedback')).getCssValue('color'); if (elementStyle === 'rgba(220, 53, 69, 1)') { console.log('Passed: Validation text color matched as expected'); } else { throw new Error(`Validation text color did not match; Actual: "${elementStyle}"`); } } }, //NEXT ACTION - Add new group { description: 'Enter new framework name', action: async () => await driver.findElement(By.css('#groupname')).sendKeys('Automated Framework to be deleted') }, { description: 'Click Add New Group button', action: async () => await driver.findElement(By.css('#groupsubmit')).click() }, { description: 'Wait for action to complete', action: async () => await driver.sleep(2000) }, //DIV Group column header text { description: 'Validate Group column header text', action: async () => { const elementText = await driver.findElement(By.css('thead th:nth-child(1)')).getText(); if (elementText === 'Group') { console.log('Passed: Group column header text matched as expected'); } else { throw new Error(`Expected: "Group" column header text; Actual: "${elementText}"`); } } }, //DIV Edit column header text { description: 'Validate Edit column header text', action: async () => { const elementText = await driver.findElement(By.css('thead th:nth-child(2)')).getText(); if (elementText === 'Edit') { console.log('Passed: Edit column header text matched as expected'); } else { throw new Error(`Expected: "Edit" column header text; Actual: "${elementText}"`); } } }, //DIV Order column header text { description: 'Validate Order column header text', action: async () => { const elementText = await driver.findElement(By.css('thead th:nth-child(3)')).getText(); if (elementText === 'Order') { console.log('Passed: Order column header text matched as expected'); } else { throw new Error(`Expected: "Order" column header text; Actual: "${elementText}"`); } } }, //DIV Delete column header text { description: 'Validate Delete column header text', action: async () => { const elementText = await driver.findElement(By.css('thead th:nth-child(4)')).getText(); if (elementText === 'Delete') { console.log('Passed: Delete column header text matched as expected'); } else { throw new Error(`Expected: "Delete" column header text; Actual: "${elementText}"`); } } }, //DIV Group 1 text { description: 'Validate Group 1 text', action: async () => { const elementText = await driver.findElement(By.xpath('//div[2]/table/tbody/tr/td/div')).getText(); if (elementText === 'Initial Framework Group for Testing') { console.log('Passed: Initial Framework Group for Testing text matched as expected'); } else { throw new Error(`Expected: "Initial Framework Group for Testing" text; Actual: "${elementText}"`); } } }, //DIV - edit icon 1 { description: 'Verify edit icon 1 is present', action: async () => { const expectedIcon = await driver.wait(until.elementLocated(By.css('tr:nth-child(1) .fa-pencil-square')), 5000).catch(() => false); if (!expectedIcon) { throw new Error('Edit icon 1 not found'); } console.log('Passed: Edit icon 1 present'); } }, //DIV - order down icon 1 { description: 'Verify order down icon 1 is present', action: async () => { const expectedIcon = await driver.wait(until.elementLocated(By.css('tr:nth-child(1) .fa-arrow-down')), 5000).catch(() => false); if (!expectedIcon) { throw new Error('Order down icon 1 not found'); } console.log('Passed: Order down icon 1 present'); } }, //DIV - order up icon 1 { description: 'Verify order up icon 1 is present', action: async () => { const expectedIcon = await driver.wait(until.elementLocated(By.css('tr:nth-child(1) .fa-arrow-up')), 5000).catch(() => false); if (!expectedIcon) { throw new Error('Order up icon 1 not found'); } console.log('Passed: Order up icon 1 present'); } }, //DIV - delete icon 1 { description: 'Verify delete icon 1 is present', action: async () => { const expectedIcon = await driver.wait(until.elementLocated(By.css('tr:nth-child(1) .fa-times-circle')), 5000).catch(() => false); if (!expectedIcon) { throw new Error('Delete icon 1 not found'); } console.log('Passed: Delete icon 1 present'); } }, //DIV Group 2 text { description: 'Validate Group 2 text', action: async () => { const elementText = await driver.findElement(By.xpath('//div[2]/table/tbody/tr[2]/td/div')).getText(); if (elementText === 'Another Group To Use') { console.log('Passed: Another Group To Use text matched as expected'); } else { throw new Error(`Expected: "Another Group To Use" text; Actual: "${elementText}"`); } } }, //DIV - edit icon 2 { description: 'Verify edit icon 2 is present', action: async () => { const expectedIcon = await driver.wait(until.elementLocated(By.css('tr:nth-child(2) .fa-pencil-square')), 5000).catch(() => false); if (!expectedIcon) { throw new Error('Edit icon 2 not found'); } console.log('Passed: Edit icon 2 present'); } }, //DIV - order down icon 2 { description: 'Verify order down icon 2 is present', action: async () => { const expectedIcon = await driver.wait(until.elementLocated(By.css('tr:nth-child(2) .fa-arrow-down')), 5000).catch(() => false); if (!expectedIcon) { throw new Error('Order down icon 2 not found'); } console.log('Passed: Order down icon 2 present'); } }, //DIV - order up icon 2 { description: 'Verify order up icon 2 is present', action: async () => { const expectedIcon = await driver.wait(until.elementLocated(By.css('tr:nth-child(2) .fa-arrow-up')), 5000).catch(() => false); if (!expectedIcon) { throw new Error('Order up icon 2 not found'); } console.log('Passed: Order up icon 2 present'); } }, //DIV - delete icon 2 { description: 'Verify delete icon 2 is present', action: async () => { const expectedIcon = await driver.wait(until.elementLocated(By.css('tr:nth-child(2) .fa-times-circle')), 5000).catch(() => false); if (!expectedIcon) { throw new Error('Delete icon 2 not found'); } console.log('Passed: Delete icon 2 present'); } }, //DIV Group 3 text { description: 'Validate Group 3 text', action: async () => { const elementText = await driver.findElement(By.xpath('//div[2]/table/tbody/tr[3]/td/div')).getText(); if (elementText === 'Empty Group Set') { console.log('Passed: Empty Group Set text matched as expected'); } else { throw new Error(`Expected: "Empty Group Set" text; Actual: "${elementText}"`); } } }, //DIV - edit icon 3 { description: 'Verify edit icon 3 is present', action: async () => { const expectedIcon = await driver.wait(until.elementLocated(By.css('tr:nth-child(3) .fa-pencil-square')), 5000).catch(() => false); if (!expectedIcon) { throw new Error('Edit icon 3 not found'); } console.log('Passed: Edit icon 3 present'); } }, //DIV - order down icon 3 { description: 'Verify order down icon 3 is present', action: async () => { const expectedIcon = await driver.wait(until.elementLocated(By.css('tr:nth-child(3) .fa-arrow-down')), 5000).catch(() => false); if (!expectedIcon) { throw new Error('Order down icon 3 not found'); } console.log('Passed: Order down icon 3 present'); } }, //DIV - order up icon 3 { description: 'Verify order up icon 3 is present', action: async () => { const expectedIcon = await driver.wait(until.elementLocated(By.css('tr:nth-child(3) .fa-arrow-up')), 5000).catch(() => false); if (!expectedIcon) { throw new Error('Order up icon 3 not found'); } console.log('Passed: Order up icon 3 present'); } }, //DIV - delete icon 3 { description: 'Verify delete icon 3 is present', action: async () => { const expectedIcon = await driver.wait(until.elementLocated(By.css('tr:nth-child(3) .fa-times-circle')), 5000).catch(() => false); if (!expectedIcon) { throw new Error('Delete icon 3 not found'); } console.log('Passed: Delete icon 3 present'); } }, //DIV Group 4 text { description: 'Validate Group 4 text', action: async () => { const elementText = await driver.findElement(By.xpath('//div[2]/table/tbody/tr[4]/td/div')).getText(); if (elementText === 'Automated Framework to be deleted') { console.log('Passed: Automated Framework to be deleted text matched as expected'); } else { throw new Error(`Expected: "Automated Framework to be deleted" text; Actual: "${elementText}"`); } } }, //DIV - edit icon 4 { description: 'Verify edit icon 4 is present', action: async () => { const expectedIcon = await driver.wait(until.elementLocated(By.css('tr:nth-child(4) .fa-pencil-square')), 5000).catch(() => false); if (!expectedIcon) { throw new Error('Edit icon 4 not found'); } console.log('Passed: Edit icon 4 present'); } }, //DIV - order down icon 4 { description: 'Verify order down icon 4 is present', action: async () => { const expectedIcon = await driver.wait(until.elementLocated(By.css('tr:nth-child(4) .fa-arrow-down')), 5000).catch(() => false); if (!expectedIcon) { throw new Error('Order down icon 4 not found'); } console.log('Passed: Order down icon 4 present'); } }, //DIV - order up icon 4 { description: 'Verify order up icon 4 is present', action: async () => { const expectedIcon = await driver.wait(until.elementLocated(By.css('tr:nth-child(4) .fa-arrow-up')), 5000).catch(() => false); if (!expectedIcon) { throw new Error('Order up icon 4 not found'); } console.log('Passed: Order up icon 4 present'); } }, //DIV - delete icon 4 { description: 'Verify delete icon 4 is present', action: async () => { const expectedIcon = await driver.wait(until.elementLocated(By.css('tr:nth-child(4) .fa-times-circle')), 5000).catch(() => false); if (!expectedIcon) { throw new Error('Delete icon 4 not found'); } console.log('Passed: Delete icon 4 present'); } }, //NEXT ACTION - Click edit icon for newly created group { description: 'Click Edit icon', action: async () => await driver.findElement(By.css('tr:nth-child(4) .fa-pencil-square')).click() }, //Save button text { description: 'Validate Save button text', action: async () => { const elementText = await driver.findElement(By.css('.mt-1')).getText(); if (elementText === 'Save') { console.log('Passed: Save button text matched as expected'); } else { throw new Error(`Expected: "Save" button text; Actual: "${elementText}"`); } } }, //Save button color -green { description: 'Validate Save button color', action: async () => { const elementStyle = await driver.findElement(By.css('.mt-1')).getCssValue('background-color'); if (elementStyle === 'rgba(48, 200, 172, 1)') { console.log('Passed: Save button color matched as expected'); } else { throw new Error(`Save button color did not match; Actual: "${elementStyle}"`); } } }, //NEXT ACTION - Edit name and click the save button { description: 'Edit framework name', action: async () => await driver.findElement(By.xpath('//div/form/input')).sendKeys(' now') }, { description: 'Click Save icon', action: async () => await driver.findElement(By.css('.mt-1')).click() }, { description: 'Wait for action to complete', action: async () => await driver.sleep(2000) }, //DIV Group 4 text { description: 'Validate Group 4 text', action: async () => { const elementText = await driver.findElement(By.xpath('//div[2]/table/tbody/tr[4]/td/div')).getText(); if (elementText === 'Automated Framework to be deleted now') { console.log('Passed: Automated Framework to be deleted now text matched as expected'); } else { throw new Error(`Expected: "Automated Framework to be deleted now" text; Actual: "${elementText}"`); } } }, //NEXT ACTION - Click newly created group up arrow icon { description: 'Click up arrow icon', action: async () => await driver.findElement(By.css('tr:nth-child(4) .fa-arrow-up')).click() }, { description: 'Wait for action to complete', action: async () => await driver.sleep(2000) }, //DIV Group column header text { description: 'Validate Group column header text', action: async () => { const elementText = await driver.findElement(By.css('thead th:nth-child(1)')).getText(); if (elementText === 'Group') { console.log('Passed: Group column header text matched as expected'); } else { throw new Error(`Expected: "Group" column header text; Actual: "${elementText}"`); } } }, //DIV Edit column header text { description: 'Validate Edit column header text', action: async () => { const elementText = await driver.findElement(By.css('thead th:nth-child(2)')).getText(); if (elementText === 'Edit') { console.log('Passed: Edit column header text matched as expected'); } else { throw new Error(`Expected: "Edit" column header text; Actual: "${elementText}"`); } } }, //DIV Order column header text { description: 'Validate Order column header text', action: async () => { const elementText = await driver.findElement(By.css('thead th:nth-child(3)')).getText(); if (elementText === 'Order') { console.log('Passed: Order column header text matched as expected'); } else { throw new Error(`Expected: "Order" column header text; Actual: "${elementText}"`); } } }, //DIV Delete column header text { description: 'Validate Delete column header text', action: async () => { const elementText = await driver.findElement(By.css('thead th:nth-child(4)')).getText(); if (elementText === 'Delete') { console.log('Passed: Delete column header text matched as expected'); } else { throw new Error(`Expected: "Delete" column header text; Actual: "${elementText}"`); } } }, //DIV Group 1 text { description: 'Validate Group 1 text', action: async () => { const elementText = await driver.findElement(By.xpath('//div[2]/table/tbody/tr/td/div')).getText(); if (elementText === 'Initial Framework Group for Testing') { console.log('Passed: Initial Framework Group for Testing text matched as expected'); } else { throw new Error(`Expected: "Initial Framework Group for Testing" text; Actual: "${elementText}"`); } } }, //DIV - edit icon 1 { description: 'Verify edit icon 1 is present', action: async () => { const expectedIcon = await driver.wait(until.elementLocated(By.css('tr:nth-child(1) .fa-pencil-square')), 5000).catch(() => false); if (!expectedIcon) { throw new Error('Edit icon 1 not found'); } console.log('Passed: Edit icon 1 present'); } }, //DIV - order down icon 1 { description: 'Verify order down icon 1 is present', action: async () => { const expectedIcon = await driver.wait(until.elementLocated(By.css('tr:nth-child(1) .fa-arrow-down')), 5000).catch(() => false); if (!expectedIcon) { throw new Error('Order down icon 1 not found'); } console.log('Passed: Order down icon 1 present'); } }, //DIV - order up icon 1 { description: 'Verify order up icon 1 is present', action: async () => { const expectedIcon = await driver.wait(until.elementLocated(By.css('tr:nth-child(1) .fa-arrow-up')), 5000).catch(() => false); if (!expectedIcon) { throw new Error('Order up icon 1 not found'); } console.log('Passed: Order up icon 1 present'); } }, //DIV - delete icon 1 { description: 'Verify delete icon 1 is present', action: async () => { const expectedIcon = await driver.wait(until.elementLocated(By.css('tr:nth-child(1) .fa-times-circle')), 5000).catch(() => false); if (!expectedIcon) { throw new Error('Delete icon 1 not found'); } console.log('Passed: Delete icon 1 present'); } }, //DIV Group 2 text { description: 'Validate Group 2 text', action: async () => { const elementText = await driver.findElement(By.xpath('//div[2]/table/tbody/tr[2]/td/div')).getText(); if (elementText === 'Another Group To Use') { console.log('Passed: Another Group To Use text matched as expected'); } else { throw new Error(`Expected: "Another Group To Use" text; Actual: "${elementText}"`); } } }, //DIV - edit icon 2 { description: 'Verify edit icon 2 is present', action: async () => { const expectedIcon = await driver.wait(until.elementLocated(By.css('tr:nth-child(2) .fa-pencil-square')), 5000).catch(() => false); if (!expectedIcon) { throw new Error('Edit icon 2 not found'); } console.log('Passed: Edit icon 2 present'); } }, //DIV - order down icon 2 { description: 'Verify order down icon 2 is present', action: async () => { const expectedIcon = await driver.wait(until.elementLocated(By.css('tr:nth-child(2) .fa-arrow-down')), 5000).catch(() => false); if (!expectedIcon) { throw new Error('Order down icon 2 not found'); } console.log('Passed: Order down icon 2 present'); } }, //DIV - order up icon 2 { description: 'Verify order up icon 2 is present', action: async () => { const expectedIcon = await driver.wait(until.elementLocated(By.css('tr:nth-child(2) .fa-arrow-up')), 5000).catch(() => false); if (!expectedIcon) { throw new Error('Order up icon 2 not found'); } console.log('Passed: Order up icon 2 present'); } }, //DIV - delete icon 2 { description: 'Verify delete icon 2 is present', action: async () => { const expectedIcon = await driver.wait(until.elementLocated(By.css('tr:nth-child(2) .fa-times-circle')), 5000).catch(() => false); if (!expectedIcon) { throw new Error('Delete icon 2 not found'); } console.log('Passed: Delete icon 2 present'); } }, //DIV Group 3 text { description: 'Validate Group 3 text', action: async () => { const elementText = await driver.findElement(By.xpath('//div[2]/table/tbody/tr[3]/td/div')).getText(); if (elementText === 'Automated Framework to be deleted now') { console.log('Passed: Automated Framework to be deleted now text matched as expected'); } else { throw new Error(`Expected: "Automated Framework to be deleted now" text; Actual: "${elementText}"`); } } }, //DIV - edit icon 3 { description: 'Verify edit icon 3 is present', action: async () => { const expectedIcon = await driver.wait(until.elementLocated(By.css('tr:nth-child(3) .fa-pencil-square')), 5000).catch(() => false); if (!expectedIcon) { throw new Error('Edit icon 3 not found'); } console.log('Passed: Edit icon 3 present'); } }, //DIV - order down icon 3 { description: 'Verify order down icon 3 is present', action: async () => { const expectedIcon = await driver.wait(until.elementLocated(By.css('tr:nth-child(3) .fa-arrow-down')), 5000).catch(() => false); if (!expectedIcon) { throw new Error('Order down icon 3 not found'); } console.log('Passed: Order down icon 3 present'); } }, //DIV - order up icon 3 { description: 'Verify order up icon 3 is present', action: async () => { const expectedIcon = await driver.wait(until.elementLocated(By.css('tr:nth-child(3) .fa-arrow-up')), 5000).catch(() => false); if (!expectedIcon) { throw new Error('Order up icon 3 not found'); } console.log('Passed: Order up icon 3 present'); } }, //DIV - delete icon 3 { description: 'Verify delete icon 3 is present', action: async () => { const expectedIcon = await driver.wait(until.elementLocated(By.css('tr:nth-child(3) .fa-times-circle')), 5000).catch(() => false); if (!expectedIcon) { throw new Error('Delete icon 3 not found'); } console.log('Passed: Delete icon 3 present'); } }, //DIV Group 4 text { description: 'Validate Group 4 text', action: async () => { const elementText = await driver.findElement(By.xpath('//div[2]/table/tbody/tr[4]/td/div')).getText(); if (elementText === 'Empty Group Set') { console.log('Passed: Empty Group Set text matched as expected'); } else { throw new Error(`Expected: "Empty Group Set" text; Actual: "${elementText}"`); } } }, //DIV - edit icon 4 { description: 'Verify edit icon 4 is present', action: async () => { const expectedIcon = await driver.wait(until.elementLocated(By.css('tr:nth-child(4) .fa-pencil-square')), 5000).catch(() => false); if (!expectedIcon) { throw new Error('Edit icon 4 not found'); } console.log('Passed: Edit icon 4 present'); } }, //DIV - order down icon 4 { description: 'Verify order down icon 4 is present', action: async () => { const expectedIcon = await driver.wait(until.elementLocated(By.css('tr:nth-child(4) .fa-arrow-down')), 5000).catch(() => false); if (!expectedIcon) { throw new Error('Order down icon 4 not found'); } console.log('Passed: Order down icon 4 present'); } }, //DIV - order up icon 4 { description: 'Verify order up icon 4 is present', action: async () => { const expectedIcon = await driver.wait(until.elementLocated(By.css('tr:nth-child(4) .fa-arrow-up')), 5000).catch(() => false); if (!expectedIcon) { throw new Error('Order up icon 4 not found'); } console.log('Passed: Order up icon 4 present'); } }, //DIV - delete icon 4 { description: 'Verify delete icon 4 is present', action: async () => { const expectedIcon = await driver.wait(until.elementLocated(By.css('tr:nth-child(4) .fa-times-circle')), 5000).catch(() => false); if (!expectedIcon) { throw new Error('Delete icon 4 not found'); } console.log('Passed: Delete icon 4 present'); } }, //NEXT ACTION - Click newly created group down arrow icon { description: 'Click down arrow icon', action: async () => await driver.findElement(By.css('tr:nth-child(3) .fa-arrow-down')).click() }, { description: 'Wait for action to complete', action: async () => await driver.sleep(2000) }, //DIV Group column header text { description: 'Validate Group column header text', action: async () => { const elementText = await driver.findElement(By.css('thead th:nth-child(1)')).getText(); if (elementText === 'Group') { console.log('Passed: Group column header text matched as expected'); } else { throw new Error(`Expected: "Group" column header text; Actual: "${elementText}"`); } } }, //DIV Edit column header text { description: 'Validate Edit column header text', action: async () => { const elementText = await driver.findElement(By.css('thead th:nth-child(2)')).getText(); if (elementText === 'Edit') { console.log('Passed: Edit column header text matched as expected'); } else { throw new Error(`Expected: "Edit" column header text; Actual: "${elementText}"`); } } }, //DIV Order column header text { description: 'Validate Order column header text', action: async () => { const elementText = await driver.findElement(By.css('thead th:nth-child(3)')).getText(); if (elementText === 'Order') { console.log('Passed: Order column header text matched as expected'); } else { throw new Error(`Expected: "Order" column header text; Actual: "${elementText}"`); } } }, //DIV Delete column header text { description: 'Validate Delete column header text', action: async () => { const elementText = await driver.findElement(By.css('thead th:nth-child(4)')).getText(); if (elementText === 'Delete') { console.log('Passed: Delete column header text matched as expected'); } else { throw new Error(`Expected: "Delete" column header text; Actual: "${elementText}"`); } } }, //DIV Group 1 text { description: 'Validate Group 1 text', action: async () => { const elementText = await driver.findElement(By.xpath('//div[2]/table/tbody/tr/td/div')).getText(); if (elementText === 'Initial Framework Group for Testing') { console.log('Passed: Initial Framework Group for Testing text matched as expected'); } else { throw new Error(`Expected: "Initial Framework Group for Testing" text; Actual: "${elementText}"`); } } }, //DIV - edit icon 1 { description: 'Verify edit icon 1 is present', action: async () => { const expectedIcon = await driver.wait(until.elementLocated(By.css('tr:nth-child(1) .fa-pencil-square')), 5000).catch(() => false); if (!expectedIcon) { throw new Error('Edit icon 1 not found'); } console.log('Passed: Edit icon 1 present'); } }, //DIV - order down icon 1 { description: 'Verify order down icon 1 is present', action: async () => { const expectedIcon = await driver.wait(until.elementLocated(By.css('tr:nth-child(1) .fa-arrow-down')), 5000).catch(() => false); if (!expectedIcon) { throw new Error('Order down icon 1 not found'); } console.log('Passed: Order down icon 1 present'); } }, //DIV - order up icon 1 { description: 'Verify order up icon 1 is present', action: async () => { const expectedIcon = await driver.wait(until.elementLocated(By.css('tr:nth-child(1) .fa-arrow-up')), 5000).catch(() => false); if (!expectedIcon) { throw new Error('Order up icon 1 not found'); } console.log('Passed: Order up icon 1 present'); } }, //DIV - delete icon 1 { description: 'Verify delete icon 1 is present', action: async () => { const expectedIcon = await driver.wait(until.elementLocated(By.css('tr:nth-child(1) .fa-times-circle')), 5000).catch(() => false); if (!expectedIcon) { throw new Error('Delete icon 1 not found'); } console.log('Passed: Delete icon 1 present'); } }, //DIV Group 2 text { description: 'Validate Group 2 text', action: async () => { const elementText = await driver.findElement(By.xpath('//div[2]/table/tbody/tr[2]/td/div')).getText(); if (elementText === 'Another Group To Use') { console.log('Passed: Another Group To Use text matched as expected'); } else { throw new Error(`Expected: "Another Group To Use" text; Actual: "${elementText}"`); } } }, //DIV - edit icon 2 { description: 'Verify edit icon 2 is present', action: async () => { const expectedIcon = await driver.wait(until.elementLocated(By.css('tr:nth-child(2) .fa-pencil-square')), 5000).catch(() => false); if (!expectedIcon) { throw new Error('Edit icon 2 not found'); } console.log('Passed: Edit icon 2 present'); } }, //DIV - order down icon 2 { description: 'Verify order down icon 2 is present', action: async () => { const expectedIcon = await driver.wait(until.elementLocated(By.css('tr:nth-child(2) .fa-arrow-down')), 5000).catch(() => false); if (!expectedIcon) { throw new Error('Order down icon 2 not found'); } console.log('Passed: Order down icon 2 present'); } }, //DIV - order up icon 2 { description: 'Verify order up icon 2 is present', action: async () => { const expectedIcon = await driver.wait(until.elementLocated(By.css('tr:nth-child(2) .fa-arrow-up')), 5000).catch(() => false); if (!expectedIcon) { throw new Error('Order up icon 2 not found'); } console.log('Passed: Order up icon 2 present'); } }, //DIV - delete icon 2 { description: 'Verify delete icon 2 is present', action: async () => { const expectedIcon = await driver.wait(until.elementLocated(By.css('tr:nth-child(2) .fa-times-circle')), 5000).catch(() => false); if (!expectedIcon) { throw new Error('Delete icon 2 not found'); } console.log('Passed: Delete icon 2 present'); } }, //DIV Group 3 text { description: 'Validate Group 3 text', action: async () => { const elementText = await driver.findElement(By.xpath('//div[2]/table/tbody/tr[3]/td/div')).getText(); if (elementText === 'Empty Group Set') { console.log('Passed: Empty Group Set text matched as expected'); } else { throw new Error(`Expected: "Empty Group Set" text; Actual: "${elementText}"`); } } }, //DIV - edit icon 3 { description: 'Verify edit icon 3 is present', action: async () => { const expectedIcon = await driver.wait(until.elementLocated(By.css('tr:nth-child(3) .fa-pencil-square')), 5000).catch(() => false); if (!expectedIcon) { throw new Error('Edit icon 3 not found'); } console.log('Passed: Edit icon 3 present'); } }, //DIV - order down icon 3 { description: 'Verify order down icon 3 is present', action: async () => { const expectedIcon = await driver.wait(until.elementLocated(By.css('tr:nth-child(3) .fa-arrow-down')), 5000).catch(() => false); if (!expectedIcon) { throw new Error('Order down icon 3 not found'); } console.log('Passed: Order down icon 3 present'); } }, //DIV - order up icon 3 { description: 'Verify order up icon 3 is present', action: async () => { const expectedIcon = await driver.wait(until.elementLocated(By.css('tr:nth-child(3) .fa-arrow-up')), 5000).catch(() => false); if (!expectedIcon) { throw new Error('Order up icon 3 not found'); } console.log('Passed: Order up icon 3 present'); } }, //DIV - delete icon 3 { description: 'Verify delete icon 3 is present', action: async () => { const expectedIcon = await driver.wait(until.elementLocated(By.css('tr:nth-child(3) .fa-times-circle')), 5000).catch(() => false); if (!expectedIcon) { throw new Error('Delete icon 3 not found'); } console.log('Passed: Delete icon 3 present'); } }, //DIV Group 4 text { description: 'Validate Group 4 text', action: async () => { const elementText = await driver.findElement(By.xpath('//div[2]/table/tbody/tr[4]/td/div')).getText(); if (elementText === 'Automated Framework to be deleted now') { console.log('Passed: Automated Framework to be deleted now text matched as expected'); } else { throw new Error(`Expected: "Automated Framework to be deleted now" text; Actual: "${elementText}"`); } } }, //DIV - edit icon 4 { description: 'Verify edit icon 4 is present', action: async () => { const expectedIcon = await driver.wait(until.elementLocated(By.css('tr:nth-child(4) .fa-pencil-square')), 5000).catch(() => false); if (!expectedIcon) { throw new Error('Edit icon 4 not found'); } console.log('Passed: Edit icon 4 present'); } }, //DIV - order down icon 4 { description: 'Verify order down icon 4 is present', action: async () => { const expectedIcon = await driver.wait(until.elementLocated(By.css('tr:nth-child(4) .fa-arrow-down')), 5000).catch(() => false); if (!expectedIcon) { throw new Error('Order down icon 4 not found'); } console.log('Passed: Order down icon 4 present'); } }, //DIV - order up icon 4 { description: 'Verify order up icon 4 is present', action: async () => { const expectedIcon = await driver.wait(until.elementLocated(By.css('tr:nth-child(4) .fa-arrow-up')), 5000).catch(() => false); if (!expectedIcon) { throw new Error('Order up icon 4 not found'); } console.log('Passed: Order up icon 4 present'); } }, //DIV - delete icon 4 { description: 'Verify delete icon 4 is present', action: async () => { const expectedIcon = await driver.wait(until.elementLocated(By.css('tr:nth-child(4) .fa-times-circle')), 5000).catch(() => false); if (!expectedIcon) { throw new Error('Delete icon 4 not found'); } console.log('Passed: Delete icon 4 present'); } }, //NEXT ACTION - Close delete icon for newly created group { description: 'Validate delete alert message', action: async () => { await driver.sleep(2000); const deleteIcon = await driver.wait( until.elementLocated(By.css('tr:nth-child(4) .fa-times-circle')), 5000 ); await deleteIcon.click(); await driver.sleep(2000); const alert = await driver.wait( until.alertIsPresent(), 5000 ); const alertText = await alert.getText(); try { if (alertText !== 'Are you sure you want to delete this group?') { throw new Error('Expected: "Are you sure you want to delete this group?"'); } console.log('Passed: Delete Alert DIV text matched as expected'); } catch (error) { console.error('FAILED: Delete Alert DIV, unable to validate text; Error Message: ', error.message); await alert.dismiss(); throw error; } await alert.accept(); await driver.sleep(2000); } }, //DIV Group 1 text { description: 'Validate Group 1 text', action: async () => { const elementText = await driver.findElement(By.xpath('//div[2]/table/tbody/tr/td/div')).getText(); if (elementText === 'Initial Framework Group for Testing') { console.log('Passed: Initial Framework Group for Testing text matched as expected'); } else { throw new Error(`Expected: "Initial Framework Group for Testing" text; Actual: "${elementText}"`); } } }, //DIV - edit icon 1 { description: 'Verify edit icon 1 is present', action: async () => { const expectedIcon = await driver.wait(until.elementLocated(By.css('tr:nth-child(1) .fa-pencil-square')), 5000).catch(() => false); if (!expectedIcon) { throw new Error('Edit icon 1 not found'); } console.log('Passed: Edit icon 1 present'); } }, //DIV - order down icon 1 { description: 'Verify order down icon 1 is present', action: async () => { const expectedIcon = await driver.wait(until.elementLocated(By.css('tr:nth-child(1) .fa-arrow-down')), 5000).catch(() => false); if (!expectedIcon) { throw new Error('Order down icon 1 not found'); } console.log('Passed: Order down icon 1 present'); } }, //DIV - order up icon 1 { description: 'Verify order up icon 1 is present', action: async () => { const expectedIcon = await driver.wait(until.elementLocated(By.css('tr:nth-child(1) .fa-arrow-up')), 5000).catch(() => false); if (!expectedIcon) { throw new Error('Order up icon 1 not found'); } console.log('Passed: Order up icon 1 present'); } }, //DIV - delete icon 1 { description: 'Verify delete icon 1 is present', action: async () => { const expectedIcon = await driver.wait(until.elementLocated(By.css('tr:nth-child(1) .fa-times-circle')), 5000).catch(() => false); if (!expectedIcon) { throw new Error('Delete icon 1 not found'); } console.log('Passed: Delete icon 1 present'); } }, //DIV Group 2 text { description: 'Validate Group 2 text', action: async () => { const elementText = await driver.findElement(By.xpath('//div[2]/table/tbody/tr[2]/td/div')).getText(); if (elementText === 'Another Group To Use') { console.log('Passed: Another Group To Use text matched as expected'); } else { throw new Error(`Expected: "Another Group To Use" text; Actual: "${elementText}"`); } } }, //DIV - edit icon 2 { description: 'Verify edit icon 2 is present', action: async () => { const expectedIcon = await driver.wait(until.elementLocated(By.css('tr:nth-child(2) .fa-pencil-square')), 5000).catch(() => false); if (!expectedIcon) { throw new Error('Edit icon 2 not found'); } console.log('Passed: Edit icon 2 present'); } }, //DIV - order down icon 2 { description: 'Verify order down icon 2 is present', action: async () => { const expectedIcon = await driver.wait(until.elementLocated(By.css('tr:nth-child(2) .fa-arrow-down')), 5000).catch(() => false); if (!expectedIcon) { throw new Error('Order down icon 2 not found'); } console.log('Passed: Order down icon 2 present'); } }, //DIV - order up icon 2 { description: 'Verify order up icon 2 is present', action: async () => { const expectedIcon = await driver.wait(until.elementLocated(By.css('tr:nth-child(2) .fa-arrow-up')), 5000).catch(() => false); if (!expectedIcon) { throw new Error('Order up icon 2 not found'); } console.log('Passed: Order up icon 2 present'); } }, //DIV - delete icon 2 { description: 'Verify delete icon 2 is present', action: async () => { const expectedIcon = await driver.wait(until.elementLocated(By.css('tr:nth-child(2) .fa-times-circle')), 5000).catch(() => false); if (!expectedIcon) { throw new Error('Delete icon 2 not found'); } console.log('Passed: Delete icon 2 present'); } }, //DIV Group 3 text { description: 'Validate Group 3 text', action: async () => { const elementText = await driver.findElement(By.xpath('//div[2]/table/tbody/tr[3]/td/div')).getText(); if (elementText === 'Empty Group Set') { console.log('Passed: Empty Group Set text matched as expected'); } else { throw new Error(`Expected: "Empty Group Set" text; Actual: "${elementText}"`); } } }, //DIV - edit icon 3 { description: 'Verify edit icon 3 is present', action: async () => { const expectedIcon = await driver.wait(until.elementLocated(By.css('tr:nth-child(3) .fa-pencil-square')), 5000).catch(() => false); if (!expectedIcon) { throw new Error('Edit icon 3 not found'); } console.log('Passed: Edit icon 3 present'); } }, //DIV - order down icon 3 { description: 'Verify order down icon 3 is present', action: async () => { const expectedIcon = await driver.wait(until.elementLocated(By.css('tr:nth-child(3) .fa-arrow-down')), 5000).catch(() => false); if (!expectedIcon) { throw new Error('Order down icon 3 not found'); } console.log('Passed: Order down icon 3 present'); } }, //DIV - order up icon 3 { description: 'Verify order up icon 3 is present', action: async () => { const expectedIcon = await driver.wait(until.elementLocated(By.css('tr:nth-child(3) .fa-arrow-up')), 5000).catch(() => false); if (!expectedIcon) { throw new Error('Order up icon 3 not found'); } console.log('Passed: Order up icon 3 present'); } }, //DIV - delete icon 3 { description: 'Verify delete icon 3 is present', action: async () => { const expectedIcon = await driver.wait(until.elementLocated(By.css('tr:nth-child(3) .fa-times-circle')), 5000).catch(() => false); if (!expectedIcon) { throw new Error('Delete icon 3 not found'); } console.log('Passed: Delete icon 3 present'); } }, //DIV Close button text { description: 'Validate Close button text', action: async () => { const elementText = await driver.findElement(By.css('#modalclose')).getText(); if (elementText === 'Close') { console.log('Passed: Close button text matched as expected'); } else { throw new Error(`Expected: "Close" button text; Actual: "${elementText}"`); } } }, //DIV Close button color -white { description: 'Validate Close button color', action: async () => { const elementStyle = await driver.findElement(By.css('#modalclose')).getCssValue('background-color'); if (elementStyle === 'rgba(0, 0, 0, 0)') { console.log('Passed: Close button color matched as expected'); } else { throw new Error(`Close button color did not match; Actual: "${elementStyle}"`); } } }, //NEXT ACTION - Close DIV { description: 'Click Close button', action: async () => await driver.findElement(By.css('#modalclose')).click() }, { description: 'Wait for action to complete', action: async () => await driver.sleep(2000) }, //LOG OUT //NEXT ACTION - Log out { description: 'Click Username dropdown', action: async () => await driver.findElement(By.css('#navbarDropdown > span')).click() }, { description: 'Wait for action to complete', action: async () => await driver.sleep(2000) }, //Log Out icon { description: 'Verify Log Out icon is present', action: async () => { const expectedIcon = await driver.wait(until.elementLocated(By.css('.fa-sign-out')), 5000).catch(() => false); if (!expectedIcon) { throw new Error('Log Out icon not found'); } console.log('Passed: Log Out icon present'); } }, { description: 'Click Log Out link', action: async () => await driver.findElement(By.linkText('Log Out')).click() }, //Wait for login screen to load { description: 'Wait for log out process to complete', action: async () => { return await driver.wait(until.elementLocated(By.css('.login')), 10000).catch(() => false); } }, //Log Out button { description: 'Verify Log Out button is present', action: async () => { const expectedIcon = await driver.wait(until.elementLocated(By.css('.login')), 5000).catch(() => false); if (!expectedIcon) { throw new Error('Log Out button not found'); } console.log('Passed: Log Out button present; Script completed'); } }, ]; 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', 'frameworkFrameworkGroupsDIV'); const screenshotFileName = `step_${stepIndex}_${stepDescription.replace(/\s+/g, '_')}.png`; const screenshotPath = path.join(dir, screenshotFileName); fs.writeFileSync(screenshotPath, screenshot, 'base64'); return screenshotPath; }; const clearOldResults = () => { //Remove old screenshots const screenshotDir = path.join('screenshots', 'frameworkFrameworkGroupsDIV'); if (fs.existsSync(screenshotDir)) { fs.rmSync(screenshotDir, { recursive: true, force: true }); } fs.mkdirSync(screenshotDir, { recursive: true }); //Remove old Excel file if (fs.existsSync('frameworkFrameworkGroupsDIVResults.xlsx')) { fs.unlinkSync('frameworkFrameworkGroupsDIVResults.xlsx'); } }; try { //Initialize workbook and worksheet clearOldResults(); //Initialize workbook and worksheet 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'); //Log test start time worksheet = logStep(worksheet, 'Test Start', 'Started', '', startTime, ''); let allStepsPassed = true; for (const step of steps) { const stepIndex = steps.indexOf(step) + 1; const timestamp = new Date().toISOString(); try { //Screenshot of failed step await step.action(); //Log a successful step with no screenshot worksheet = logStep( worksheet, step.description, 'Passed', stepIndex, timestamp, null //No screenshot for passed steps ); } catch (error) { //Only take screenshot if the step fails 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}`); testStatus = 'Failed'; allStepsPassed = false; } } //Check if log out was successful const loginButton = await driver.wait(until.elementLocated(By.css('.login')), 5000).catch(() => false); if (loginButton && allStepsPassed) { console.log('PASSED: Framework Groups DIV(ExACT_frameworkFrameworkGroupsDIV); All test steps completed successfully'); testStatus = 'Passed'; } else { console.log('FAILED: Framework Groups DIV(ExACT_frameworkFrameworkGroupsDIV); One or more test steps failed'); testStatus = 'Failed'; } //Log test end time const endTime = new Date().toISOString(); worksheet = logStep(worksheet, 'Test End', testStatus, '', endTime, ''); //Write the updated worksheet back to the workbook and save it workbook.Sheets['Sheet1'] = worksheet; XLSX.writeFile(workbook, 'frameworkFrameworkGroupsDIVResults.xlsx'); } finally { await driver.quit(); } })(); } export default ExACT_frameworkFrameworkGroupsDIV;