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

ExACT Automated Test Script - Dashboard - My Content: Initiated

'); (async function example() { let driver = await new Builder().forBrowser('chrome').build(); let testStatus = 'Failed'; let workbook; let worksheet; const startTime = new Date().toISOString(); //Constants const createContentSetName = 'Automated - QA Content Set - To be deleted'; 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') { throw new Error(`Expected: "Correlation Dashboard"; Actual: "${elementText}"`); } console.log('Passed: Dashboard title matched as expected'); } }, //Dashboard title text color -dark blue { description: 'Validate dashboard title text color', action: async () => { const elementStyle = await driver.findElement(By.css('.e-heading')).getCssValue('color'); if (elementStyle !== 'rgba(40, 39, 90, 1)') { throw new Error(`Dashboard title text color did not match; Actual: "${elementStyle}"`); } console.log('Passed: Dashboard title text color matched as expected'); } }, //Dashboard title text font { description: 'Validate dashboard title text font size', action: async () => { const elementStyle = await driver.findElement(By.css('.e-heading')).getCssValue('font-size'); if (elementStyle !== '32px') { throw new Error(`Dashboard title text font-size did not match; Actual: "${elementStyle}"`); } console.log('Passed: Dashboard title text font-size matched as expected'); } }, //MY CONTENT WIDGET //Dashboard My Content Widget title { description: 'Validate dashboard My Content widget title', action: async () => { const elementText = await driver.findElement(By.css('.h-100 h2:nth-child(2)')).getText(); if (elementText !== 'My Content') { throw new Error(`Expected: "My Content"; Actual: "${elementText}"`); } console.log('Passed: Dashboard - My Content Widget title matched as expected'); } }, //Dashboard My Content Widget title text color -dark blue { description: 'Validate dashboard My Content widget title text color', action: async () => { const elementStyle = await driver.findElement(By.css('.h-100 h2:nth-child(2)')).getCssValue('color'); if (elementStyle !== 'rgba(40, 39, 90, 1)') { throw new Error(`Dashboard - My Content Widget title text color did not match; Actual: "${elementStyle}"`); } console.log('Passed: Dashboard - My Content Widget title text color matched as expected'); } }, //Dashboard My Content Widget title text font { description: 'Validate dashboard My Content widget title text font size', action: async () => { const elementStyle = await driver.findElement(By.css('.h-100 h2:nth-child(2)')).getCssValue('font-size'); if (elementStyle !== '18px') { throw new Error(`Dashboard - My Content Widget title text font-size did not match; Actual: "${elementStyle}"`); } console.log('Passed: Dashboard - My Content Widget title text font-size matched as expected'); } }, //Dashboard My Content Item Count { description: 'Validate Dashboard My Content Item Count', action: async () => { const elementText = await driver.findElement(By.css('#badge_content_total')).getText(); if (elementText !== '3527 items') { throw new Error(`Expected: "3527 items"; Actual: "${elementText}"`); } console.log('Passed: Dashboard - My Content Item Count matched as expected'); } }, //Dashboard My Content Item Count button color -dark blue { description: 'Validate Dashboard My Content Item Count button color', action: async () => { const elementStyle = await driver.findElement(By.css('#badge_content_total')).getCssValue('background-color'); if (elementStyle !== 'rgba(40, 39, 90, 1)') { throw new Error(`Dashboard - My Content Item Count button color did not match; Actual: "${elementStyle}"`); } console.log('Passed: Dashboard - My Content Item Count button color matched as expected'); } }, //Dashboard My Content Item Count text color -white { description: 'Validate Dashboard My Content Item Count font color', action: async () => { const elementStyle = await driver.findElement(By.css('#badge_content_total')).getCssValue('color'); if (elementStyle !== 'rgba(255, 255, 255, 1)') { throw new Error(`Dashboard - My Content Item Count font color did not match; Actual: "${elementStyle}"`); } console.log('Passed: Dashboard - My Content Item Count font color matched as expected'); } }, //Ellipsis icon color -dark blue { description: 'Validate ellipsis icon color', action: async () => { const elementStyle = await driver.findElement(By.css('.fa-ellipsis-h')).getCssValue('color'); if (elementStyle !== 'rgba(40, 39, 90, 1)') { throw new Error(`Ellipsis icon color did not match; Actual: "${elementStyle}"`); } console.log('Passed: Ellipsis icon color matched as expected'); } }, //Search icon color -dark blue { description: 'Validate search icon color', action: async () => { const elementStyle = await driver.findElement(By.css('.col-12 > .fa')).getCssValue('color'); if (elementStyle !== 'rgba(40, 39, 90, 1)') { throw new Error(`Search icon color did not match; Actual: "${elementStyle}"`); } console.log('Passed: Search icon color matched as expected'); } }, //Filter textbox placeholder { description: 'Validate Filter placeholder text', action: async () => { const elementValue = await driver.findElement(By.css('#content-org-filter')).getAttribute('placeholder'); if (elementValue !== 'filter...') { throw new Error(`Expected: "filter..."; Actual: "${elementValue}"`); } console.log('Passed: Filter placeholder text matched as expected'); } }, //Sort label { description: 'Validate sort label', action: async () => { const elementText = await driver.findElement(By.css('.col-4')).getText(); if (elementText !== 'Sort:') { throw new Error(`Expected: "Sort:"; Actual: "${elementText}"`); } console.log('Passed: Sort label matched as expected'); } }, //Sort Dropdown [should be: "Count", option] { description: 'Validate sort dropdown option', action: async () => { const elementOption = await driver.findElement(By.css('#orgsort > option:nth-child(1)')).getAttribute('value'); if (elementOption !== 'count') { throw new Error(`Expected: "count"; Actual: "${elementOption}"`); } console.log('Passed: Sort dropdown option matched as expected'); } }, //Biology-QA { description: 'Validate Biology-QA title', action: async () => { const elementText = await driver.findElement(By.linkText('Biology - QA')).getText(); if (elementText !== 'Biology - QA') { throw new Error(`Expected: "Biology - QA"; Actual: "${elementText}"`); } console.log('Passed: Biology-QA title matched as expected'); } }, { description: 'Validate Biology-QA edit icon color', action: async () => { const elementStyle = await driver.findElement(By.css('#mycontentlist > #content-org-list > .content-org .fa')).getCssValue('color'); if (elementStyle !== 'rgba(73, 80, 87, 1)') { throw new Error(`Biology-QA edit icon color did not match; Actual: "${elementStyle}"`); } console.log('Passed: Bioloby-QA edit icon color matched as expected'); } }, //Biology-QA Count { description: 'Validate Biology-QA Count', action: async () => { const elementText = await driver.findElement(By.css('#mycontentlist > #content-org-list > .content-org .badge')).getText(); if (elementText !== '1046') { throw new Error(`Expected: "1046"; Actual: "${elementText}"`); } console.log('Passed: Biology-QA Count matched as expected'); } }, //MY CONTENT ITEM COUNT //Click My Content Items Count button { description: 'Click My Content Items Count button', action: async () => await driver.findElement(By.css('#content_total')).click() }, { description: 'Wait for My Content Totals DIV to open', action: async () => await driver.sleep(2000) }, //Wait for DIV REMOVE? { description: 'Wait for DIV to open', action: async () => { return await driver.wait(until.elementLocated(By.css('.content_modal_title')), 5000).catch(() => false); } }, //My Content Totals DIV title { description: 'Validate My Content Totals DIV title', action: async () => { const elementText = await driver.findElement(By.css('.content_modal_title')).getText(); if (elementText !== 'My Content Totals') { throw new Error(`Expected: "My Content Totals"; Actual: "${elementText}"`); } console.log('Passed: My Content Totals DIV title matched as expected'); } }, //My Content Totals DIV title text color -dark blue { description: 'Validate My Content Totals DIV title font color', action: async () => { const elementStyle = await driver.findElement(By.css('.content_modal_title')).getCssValue('color'); if (elementStyle !== 'rgba(40, 39, 90, 1)') { throw new Error(`My Content Totals DIV title font color did not match; Actual: "${elementStyle}"`); } console.log('Passed: My Content Totals DIV title font color matched as expected'); } }, //Total Items label { description: 'Validate My Content Totals DIV - Total Items label', action: async () => { const elementText = await driver.findElement(By.css('#total > p')).getText(); if (elementText !== 'Total Items') { throw new Error(`Expected: "My Content Totals"; Actual: "${elementText}"`); } console.log('Passed: My Content Totals DIV - Total Items label matched as expected'); } }, //Total Items Count { description: 'Validate My Content Totals DIV - Total Items Count', action: async () => { const elementText = await driver.findElement(By.css('#total > b')).getText(); if (elementText !== '3527') { throw new Error(`Expected: "3527"; Actual: "${elementText}"`); } console.log('Passed: My Content Totals DIV - Total Items Count matched as expected'); } }, //My Content Total Items Count font size { description: 'Validate My Content Totals DIV - Total Items Count text font size', action: async () => { const elementStyle = await driver.findElement(By.css('#total > b')).getCssValue('font-size'); if (elementStyle !== '36px') { throw new Error(`My Content Totals DIV - Items Count text font-size did not match; Actual: "${elementStyle}"`); } console.log('Passed: My Content Totals DIV - Items Count text font-size matched as expected'); } }, //My Content Unique Titles label { description: 'Validate My Content Totals DIV - Unique Titles label', action: async () => { const elementText = await driver.findElement(By.css('#total_titles > p')).getText(); if (elementText !== 'Unique Titles') { throw new Error(`Expected: "Unique Titles"; Actual: "${elementText}"`); } console.log('Passed: My Content Totals DIV - Unique Titles label matched as expected'); } }, //My Content Unique Titles Count { description: 'Validate My Content Totals DIV - Unique Titles Count', action: async () => { const elementText = await driver.findElement(By.css('#total_titles > b')).getText(); if (elementText !== '6433') { throw new Error(`Expected: "6433"; Actual: "${elementText}"`); } console.log('Passed: My Content Totals DIV - Unique Titles Count matched as expected'); } }, //My Content Unique Titles Count font size { description: 'Validate My Content Totals DIV - Unique Titles Count text font size', action: async () => { const elementStyle = await driver.findElement(By.css('#total_titles > b')).getCssValue('font-size'); if (elementStyle !== '36px') { throw new Error(`My Content Totals DIV - Unique Titles Count text font-size did not match; Actual: "${elementStyle}"`); } console.log('Passed: My Content Totals DIV - Unique Titles Count text font-size matched as expected'); } }, //My Content Unique IDs label { description: 'Validate My Content Totals DIV - Unique IDs', action: async () => { const elementText = await driver.findElement(By.css('#total_pubtotalids > p')).getText(); if (elementText !== 'Unique IDs') { throw new Error(`Expected: "Unique IDs"; Actual: "${elementText}"`); } console.log('Passed: My Content Totals DIV - Unique IDs label matched as expected'); } }, //My Content Unique IDs Count { description: 'Validate My Content Totals DIV - Unique Titles Count', action: async () => { const elementText = await driver.findElement(By.css('#total_pubtotalids > b')).getText(); if (elementText !== '5531') { throw new Error(`Expected: "5531"; Actual: "${elementText}"`); } console.log('Passed: My Content Totals DIV - Unique IDs Count matched as expected'); } }, //My Content Unique IDs Count font size { description: 'Validate My Content Totals DIV - Unique IDs Count text font size', action: async () => { const elementStyle = await driver.findElement(By.css('#total_pubtotalids > b')).getCssValue('font-size'); if (elementStyle !== '36px') { throw new Error(`My Content Totals DIV - Unique IDs Count text font-size did not match; Actual: "${elementStyle}"`); } console.log('Passed: My Content Totals DIV - Unique IDs Count text font-size matched as expected'); } }, //My Content; Content Set column label { description: 'Validate My Content Totals DIV - Content Set column label', action: async () => { const elementText = await driver.findElement(By.css('.card-body > .table-sm th:nth-child(1)')).getText(); if (elementText !== 'Content Set') { throw new Error(`Expected: "Content Set"; Actual: "${elementText}"`); } console.log('Passed: My Content Totals DIV - Content Set column label matched as expected'); } }, //My Content; Total Items column label { description: 'Validate My Content Totals DIV - Total Items column label', action: async () => { const elementText = await driver.findElement(By.css('.card-body > .table-sm th:nth-child(2)')).getText(); if (elementText !== 'Total Items') { throw new Error(`Expected: "Total Items"; Actual: "${elementText}"`); } console.log('Passed: My Content Totals DIV - Total Items column label matched as expected'); } }, //My Content; Unique Titles column label { description: 'Validate My Content Totals DIV - Unique Titles column label', action: async () => { const elementText = await driver.findElement(By.css('.card-body > .table-sm th:nth-child(3)')).getText(); if (elementText !== 'Unique Titles') { throw new Error(`Expected: "Unique Titles"; Actual: "${elementText}"`); } console.log('Passed: My Content Totals DIV - Unique Titles column label matched as expected'); } }, //My Content; Unique IDs column label { description: 'Validate My Content Totals DIV - Unique IDs column label', action: async () => { const elementText = await driver.findElement(By.css('.card-body > .table-sm th:nth-child(4)')).getText(); if (elementText !== 'Unique IDs') { throw new Error(`Expected: "Unique IDs"; Actual: "${elementText}"`); } console.log('Passed: My Content Totals DIV - Unique IDs column label matched as expected'); } }, //My Content; Biology - QA label { description: 'Validate My Content Totals DIV - Biology - QA label', action: async () => { const elementText = await driver.findElement(By.css('#content_tbody > tr:nth-child(1) > td:nth-child(1)')).getText(); if (elementText !== 'Biology - QA') { throw new Error(`Expected: "Biology - QA"; Actual: "${elementText}"`); } console.log('Passed: My Content Totals DIV - Biology - QA label matched as expected'); } }, //My Content; Biology - QA Total Items Count { description: 'Validate My Content Totals DIV - Biology - QA Total Items Count', action: async () => { const elementText = await driver.findElement(By.css('#content_tbody > tr:nth-child(1) > td:nth-child(2)')).getText(); if (elementText !== '1046') { throw new Error(`Expected: "1046"; Actual: "${elementText}"`); } console.log('Passed: My Content Totals DIV - Biology - QA Total Items Count matched as expected'); } }, //My Content; Biology - QA Unique Titles Count { description: 'Validate My Content Totals DIV - Biology - QA Unique Titles Count', action: async () => { const elementText = await driver.findElement(By.css('#content_tbody > tr:nth-child(1) > td:nth-child(3)')).getText(); if (elementText !== '1058') { throw new Error(`Expected: "1058"; Actual: "${elementText}"`); } console.log('Passed: My Content Totals DIV - Biology - QA Unique Titles Count matched as expected'); } }, //My Content; Biology - QA Unique IDs { description: 'Validate My Content Totals DIV - Biology - QA Unique IDs Count', action: async () => { const elementText = await driver.findElement(By.css('#content_tbody > tr:nth-child(1) > td:nth-child(4)')).getText(); if (elementText !== '1065') { throw new Error(`Expected: "1065"; Actual: "${elementText}"`); } console.log('Passed: My Content Totals DIV - Biology - QA Unique IDs Count matched as expected'); } }, //My Content; My Content Totals DIV - Close button { description: 'Validate My Content Totals DIV - Close button', action: async () => { const elementText = await driver.findElement(By.css('#all_content_modal .btn-secondary')).getText(); if (elementText !== 'Close') { throw new Error(`Expected: "Close"; Actual: "${elementText}"`); } console.log('Passed: Close button text matched as expected'); } }, //My Content Totals DIV - Close button color-white { description: 'Validate My Content Totals DIV - Export button background color', action: async () => { const elementStyle = await driver.findElement(By.css('#all_content_modal .btn-secondary')).getCssValue('background-color'); if (elementStyle !== 'rgba(0, 0, 0, 0)') { throw new Error(`Close button background color did not match; Actual: "${elementStyle}"`); } console.log('Passed: Close button background color matched as expected'); } }, //My Content Totals DIV - Export button { description: 'Validate My Content Totals DIV - Export button', action: async () => { const elementText = await driver.findElement(By.css('#export_btn')).getText(); if (elementText !== 'Export') { throw new Error(`Expected: "Export"; Actual: "${elementText}"`); } console.log('Passed: Export button text matched as expected'); } }, //My Content Totals DIV - Export button color-green { description: 'Validate My Content Totals DIV - Export button background color', action: async () => { const elementStyle = await driver.findElement(By.css('#export_btn')).getCssValue('background-color'); if (elementStyle !== 'rgba(48, 200, 172, 1)') { throw new Error(`Export button background color did not match; Actual: "${elementStyle}"`); } console.log('Passed: Export button background color matched as expected'); } }, //Close DIV button { description: 'Click My Contents Count DIV Close button', action: async () => await driver.findElement(By.css('#all_content_modal .btn-secondary')).click() }, { description: 'Wait for My Content Totals DIV to close', action: async () => await driver.sleep(2000) }, //EDIT BIOLOGY - QA CONTENT SET { description: 'Click Biology-QA edit icon', action: async () => await driver.findElement(By.css('#mycontentlist > #content-org-list > .content-org .fa')).click() }, { description: 'Wait for Edit Content DIV to open', action: async () => await driver.sleep(5000) }, //Wait for dashboard to load { description: 'Wait for DIV to open', action: async () => { return await driver.wait(until.elementLocated(By.css('.modal-lg .modal-title')), 10000).catch(() => false); } }, //Edit Content Set DIV { description: 'Validate Edit DIV title', action: async () => { const elementText = await driver.findElement(By.css('.modal-lg .modal-title')).getText(); if (elementText !== 'Edit Content Set') { throw new Error(`Edit DIV title did not match; Actual: "${elementText}"`); } console.log('Passed: Edit DIV title matched as expected'); } }, //Edit Content Set DIV - label { description: 'Validate Edit DIV label', action: async () => { const elementText = await driver.findElement(By.css('.modal-lg .form-label')).getText(); if (elementText !== 'Content Set Name') { throw new Error(`Expected: "Content Set Name"; Actual: "${elementText}"`); } console.log('Passed: Edit DIV label matched as expected'); } }, //Edit Content Set DIV - textbox { description: 'Validate Edit DIV textbox', action: async () => { const elementValue = await driver.findElement(By.css('#orgname')).getAttribute('value'); if (elementValue !== 'Biology - QA') { throw new Error(`Edit DIV textbox Expected: "Biology - QA"; Actual: "${elementValue}"`); } console.log('Passed: Edit DIV textbox matched as expected'); } }, //Edit Content Set DIV - Delete button { description: 'Validate Edit DIV delete text button', action: async () => { const elementText = await driver.findElement(By.css('.modal-lg #orgdelete')).getText(); if (elementText !== 'Delete') { throw new Error(`Expected: "Delete"; Actual: "${elementText}"`); } console.log('Passed: Edit DIV delete text button matched as expected'); } }, //Edit Content Set DIV - Delete button color -red { description: 'Validate Edit DIV delete button color', action: async () => { const elementStyle = await driver.findElement(By.css('.modal-lg #orgdelete')).getCssValue('background-color'); if (elementStyle !== 'rgba(220, 53, 69, 1)') { throw new Error(`Edit DIV delete button color did not match; Actual: "${elementStyle}"`); } console.log('Passed: Edit DIV delete button color matched as expected'); } }, //Edit Content Set DIV - Delete button disabled { description: 'Validate Edit DIV delete button is disabled', action: async () => { const elementStyle = await driver.findElement(By.css('.modal-lg #orgdelete')).getAttribute('disabled'); if (elementStyle !== 'true') { throw new Error(`Edit DIV delete button should be disabled; Actual: "${elementStyle}"`); } console.log('Passed: Edit DIV delete button disabled as expected'); } }, //Edit Content Set DIV - Delete button tool-tip { description: 'Validate Edit DIV delete button tool-tip', action: async () => { const elementStyle = await driver.findElement(By.css('.modal-lg #orgdelete')).getAttribute('title'); if (elementStyle !== 'You cannot delete a Content Set that has content items') { throw new Error(`Expected: "You cannot delete a Content Set that has content items"; Actual: "${elementStyle}"`); } console.log('Passed: Edit DIV delete button tool-tip matched as expected'); } }, //Edit Content Set DIV - Save button { description: 'Validate Edit DIV save text button', action: async () => { const elementText = await driver.findElement(By.css('#modalop')).getAttribute('value'); if (elementText !== 'Save') { throw new Error(`Expected: "Save"; Actual: "${elementText}"`); } console.log('Passed: Edit DIV save text button matched as expected'); } }, //Edit Content Set DIV - Save button color -green { description: 'Validate Edit DIV save button color', action: async () => { const elementStyle = await driver.findElement(By.css('#modalop')).getCssValue('background-color'); if (elementStyle !== 'rgba(48, 200, 172, 1)') { throw new Error(`Edit DIV save button color did not match; Actual: "${elementStyle}"`); } console.log('Passed: Edit DIV save button color matched as expected'); } }, //Edit Content Set DIV - Close button { description: 'Validate Edit DIV close text button', action: async () => { const elementText = await driver.findElement(By.css('#modalclose')).getText(); if (elementText !== 'Close') { throw new Error(`Expected: "Close"; Actual: "${elementText}"`); } console.log('Passed: Edit DIV close text button matched as expected'); } }, //Edit Content Set DIV - Close button color -white { description: 'Validate Edit DIV close button color', action: async () => { const elementStyle = await driver.findElement(By.css('#modalclose')).getCssValue('background-color'); if (elementStyle !== 'rgba(0, 0, 0, 0)') { throw new Error(`Edit DIV close button color did not match; Actual: "${elementStyle}"`); } console.log('Passed: Edit DIV close button color matched as expected'); } }, //Close edit DIV { description: 'Click X icon', action: async () => await driver.findElement(By.css('.modal-lg .modal-header span')).click() }, { description: 'Driver sleep', action: async () => await driver.sleep(2000) }, //BIOLOGY - QA ITEM COUNT CHECK //Verify Biology - QA item Count { description: 'Click Biology-QA item Count link', action: async () => await driver.findElement(By.css('#mycontentlist > #content-org-list > .content-org .badge')).click() }, { description: 'Wait for My Content Totals DIV to open', action: async () => await driver.sleep(5000) }, //Wait for dashboard to load { description: 'Wait for DIV to open', action: async () => { return await driver.wait(until.elementLocated(By.css('.modal-lg .modal-title')), 10000).catch(() => false); } }, //Biology - QA Totals DIV title { description: 'Validate Biology - QA Totals DIV title', action: async () => { const elementText = await driver.findElement(By.css('.content_modal_title')).getText(); if (elementText !== 'Biology - QA Totals') { throw new Error(`Expected: "Biology - QA Totals"; Actual: "${elementText}"`); } console.log('Passed: Biology - QA Totals DIV title matched as expected'); } }, //Biology - QA Totals DIV title text color -dark blue { description: 'Validate Biology - QA Totals DIV title font color', action: async () => { const elementStyle = await driver.findElement(By.css('.content_modal_title')).getCssValue('color'); if (elementStyle !== 'rgba(40, 39, 90, 1)') { throw new Error(`My Content Totals DIV title font color did not match; Actual: "${elementStyle}"`); } console.log('Passed: Biology - QA Totals DIV title font color matched as expected'); } }, //Biology - QA Total Items label { description: 'Validate Biology - QA Totals DIV - Total Items label', action: async () => { const elementText = await driver.findElement(By.css('#total')).getText(); if (elementText !== 'My Content Totals') { throw new Error(`Expected: "My Content Totals"; Actual: "${elementText}"`); } console.log('Passed: Biology - QA Totals DIV - Total Items label matched as expected'); } }, //Biology - QA Total Items Count ">"? { description: 'Validate Biology - QA Totals DIV - Total Items Count', action: async () => { const elementText = await driver.findElement(By.css('#total > b')).getText(); if (elementText !== '1046') { throw new Error(`Expected: "1046"; Actual: "${elementText}"`); } console.log('Passed: Biology - QA Totals DIV - Total Items Count matched as expected'); } }, //Biology - QA Total Items Count font size { description: 'Validate Biology - QA Totals DIV - Total Items Count text font size', action: async () => { const elementStyle = await driver.findElement(By.css('#total > b')).getCssValue('font-size'); if (elementStyle !== '36px') { throw new Error(`Biology - QA Totals DIV - Items Count text font-size did not match; Actual: "${elementStyle}"`); } console.log('Passed: Biology - QA Totals DIV - Items Count text font-size matched as expected'); } }, //Biology - QA Unique Titles label { description: 'Validate Biology - QA Totals DIV - Unique Titles label', action: async () => { const elementText = await driver.findElement(By.css('#total_titles')).getText(); if (elementText !== 'Unique Titles') { throw new Error(`Expected: "Unique Titles"; Actual: "${elementText}"`); } console.log('Passed: Biology - QA Totals DIV - Unique Titles label matched as expected'); } }, //Biology - QA Unique Titles Count { description: 'Validate Biology - QA Totals DIV - Unique Titles Count', action: async () => { const elementText = await driver.findElement(By.css('#total_titles > b')).getText(); if (elementText !== '1058') { throw new Error(`Expected: "1058"; Actual: "${elementText}"`); } console.log('Passed: Biology - QA Totals DIV - Unique Titles Count matched as expected'); } }, //Biology - QA Unique Titles Count font size { description: 'Validate Biology - QA Totals DIV - Unique Titles Count text font size', action: async () => { const elementStyle = await driver.findElement(By.css('#total_titles > b')).getCssValue('font-size'); if (elementStyle !== '36px') { throw new Error(`Biology - QA Total DIV - Unique Titles Count text font-size did not match; Actual: "${elementStyle}"`); } console.log('Passed: Biology - QA Totals DIV - Unique Titles Count text font-size matched as expected'); } }, //Biology - QA Unique IDs label { description: 'Validate Biology - QA Totals DIV - Unique IDs', action: async () => { const elementText = await driver.findElement(By.css('#total_pubtotalids')).getText(); if (elementText !== 'Unique IDs') { throw new Error(`Expected: "Unique IDs"; Actual: "${elementText}"`); } console.log('Passed: Biology - QA Totals DIV - Unique IDs label matched as expected'); } }, //Biology - QA Unique IDs Count { description: 'Validate Biology - QA Totals DIV - Unique Titles Count', action: async () => { const elementText = await driver.findElement(By.css('#total_pubtotalids > b')).getText(); if (elementText !== '1065') { throw new Error(`Expected: "1065"; Actual: "${elementText}"`); } console.log('Passed: Biology - QA Totals DIV - Unique IDs Count matched as expected'); } }, //Biology - QA Unique IDs Count font size { description: 'Validate Biology - QA Totals DIV - Unique IDs Count text font size', action: async () => { const elementStyle = await driver.findElement(By.css('#total_pubtotalids > b')).getCssValue('font-size'); if (elementStyle !== '36px') { throw new Error(`Biology - QA Totals DIV - Unique IDs Count text font-size did not match; Actual: "${elementStyle}"`); } console.log('Passed: Biology - QA Totals DIV - Count text font-size matched as expected'); } }, //My Content; My Content Totals DIV - Close button { description: 'Validate My Content Totals DIV - Close button', action: async () => { const elementText = await driver.findElement(By.css('#all_content_modal .btn-secondary')).getText(); if (elementText !== 'Close') { throw new Error(`Expected: "Close"; Actual: "${elementText}"`); } console.log('Passed: Close button text matched as expected'); } }, //My Content Totals DIV - Close button color-white { description: 'Validate My Content Totals DIV - Export button background color', action: async () => { const elementStyle = await driver.findElement(By.css('#all_content_modal .btn-secondary')).getCssValue('background-color'); if (elementStyle !== 'rgba(0, 0, 0, 0)') { throw new Error(`Close button background color did not match; Actual: "${elementStyle}"`); } console.log('Passed: Close button background color matched as expected'); } }, //My Content Totals DIV - Export button { description: 'Validate My Content Totals DIV - Export button', action: async () => { const elementText = await driver.findElement(By.css('#export_btn')).getText(); if (elementText !== 'Export') { throw new Error(`Expected: "Export"; Actual: "${elementText}"`); } console.log('Passed: Export button text matched as expected'); } }, //My Content Totals DIV - Export button color-green { description: 'Validate My Content Totals DIV - Export button background color', action: async () => { const elementStyle = await driver.findElement(By.css('#export_btn')).getCssValue('background-color'); if (elementStyle !== 'rgba(48, 200, 172, 1)') { throw new Error(`Export button background color did not match; Actual: "${elementStyle}"`); } console.log('Passed: Export button background color matched as expected'); } }, //Click Close DIV button { description: 'Click My Contents Count DIV Close button', action: async () => await driver.findElement(By.css('#all_content_modal .btn-secondary')).click() }, { description: 'Wait for My Content Totals DIV to close', action: async () => await driver.sleep(2000) }, //Click My Content ellipsis icon { description: 'Click Ellipsis icon', action: async () => await driver.findElement(By.css('.fa-ellipsis-h')).click() }, { description: 'Driver sleep', action: async () => await driver.sleep(2000) }, //Create Content Set icon color -dark blue { description: 'Validate create content set icon color', action: async () => { const elementStyle = await driver.findElement(By.css('.fa-plus')).getCssValue('color'); if (elementStyle !== 'rgba(33, 37, 41, 1)') { throw new Error(`Create Content Set icon color did not match; Actual: "${elementStyle}"`); } console.log('Passed: Create Content Set icon color matched as expected'); } }, //Create Content Set link text { description: 'Validate create content set link text', action: async () => { const elementText = await driver.findElement(By.linkText('Create Content Set')).getText(); if (elementText !== 'Create Content Set') { throw new Error(`Expected: "Create Content Set"; Actual: "${elementText}"`); } console.log('Passed: Create Content Set link text matched as expected'); } }, //Create Content Set link text color -dark blue { description: 'Validate create content set link text color', action: async () => { const elementStyle = await driver.findElement(By.linkText('Create Content Set')).getCssValue('color'); if (elementStyle !== 'rgba(33, 37, 41, 1)') { throw new Error(`Create Content Set link text color did not match; Actual: "${elementStyle}"`); } console.log('Passed: Create Content Set link text color matched as expected'); } }, //Export Content Set icon color -dark blue { description: 'Validate export content set icon color', action: async () => { const elementStyle = await driver.findElement(By.css('.fa-download')).getCssValue('color'); if (elementStyle !== 'rgba(33, 37, 41, 1)') { throw new Error(`Export Content icon color did not match; Actual: "${elementStyle}"`); } console.log('Passed: Export Content icon color matched as expected'); } }, //Export Content Set link text { description: 'Validate export content set link text', action: async () => { const elementText = await driver.findElement(By.linkText('Export Content Set')).getText(); if (elementText !== 'Export Content Set') { throw new Error(`Expected: "Export Content Set"; Actual: "${elementText}"`); } console.log('Passed: Export Content Set link text matched as expected'); } }, //Export Content Set link text color -dark blue { description: 'Validate export content set link text color', action: async () => { const elementStyle = await driver.findElement(By.linkText('Export Content Set')).getCssValue('color'); if (elementStyle !== 'rgba(33, 37, 41, 1)') { throw new Error(`Export Content Set icon color did not match; Actual: "${elementStyle}"`); } console.log('Passed: Export Content Set icon color matched as expected'); } }, //CREATE CONTENT SET { description: 'Click Create Content Set link', action: async () => await driver.findElement(By.linkText('Create Content Set')).click() }, { description: 'Driver sleep', action: async () => await driver.sleep(5000) }, //Wait for dashboard to load { description: 'Wait for DIV to open', action: async () => { return await driver.wait(until.elementLocated(By.css('.modal-lg .modal-title')), 10000).catch(() => false); } }, //Create Content Set DIV { description: 'Validate create content set DIV title', action: async () => { const elementText = await driver.findElement(By.css('.modal-lg .modal-title')).getText(); if (elementText !== 'Create Content Set') { throw new Error(`Content set DIV title did not match; Actual: "${elementText}"`); } console.log('Passed: Create Content Set DIV title matched as expected'); } }, //Create Content Set DIV - label { description: 'Validate create DIV label', action: async () => { const elementText = await driver.findElement(By.css('.form-row:nth-child(2) .form-label')).getText(); if (elementText !== 'Content Set Name') { throw new Error(`Expected: "Content Set Name"; Actual: "${elementText}"`); } console.log('Passed: Create DIV label matched as expected'); } }, //Create Content Set DIV - Create button text { description: 'Validate create DIV - Create button text', action: async () => { const elementText = await driver.findElement(By.css('.modal-lg #modalop')).getAttribute('value'); if (elementText !== 'Create') { throw new Error(`Expected: "Create"; Actual: "${elementText}"`); } console.log('Passed: Create button text matched as expected'); } }, //Create Content Set DIV - Create button color -green { description: 'Validate create DIV - Create button color', action: async () => { const elementStyle = await driver.findElement(By.css('.modal-lg #modalop')).getCssValue('background-color'); if (elementStyle !== 'rgba(48, 200, 172, 1)') { throw new Error(`Create button color did not match; Actual: "${elementStyle}"`); } console.log('Passed: Create button color matched as expected'); } }, //Create Content Set DIV - Close button text { description: 'Validate create DIV - Close button text', action: async () => { const elementText = await driver.findElement(By.css('#modalclose')).getText(); if (elementText !== 'Close') { throw new Error(`Expected: "Close"; Actual: "${elementText}"`); } console.log('Passed: Close DIV label matched as expected'); } }, //Create Content Set DIV - Close button color -white { description: 'Validate create DIV - Close button color', action: async () => { const elementStyle = await driver.findElement(By.css('#modalclose')).getCssValue('background-color'); if (elementStyle !== 'rgba(0, 0, 0, 0)') { throw new Error(`Close button color did not match; Actual: "${elementStyle}"`); } console.log('Passed: Close button color matched as expected'); } }, //Create Content Set Validation - No Name { description: 'Click create button without content set name', action: async () => await driver.findElement(By.css('.modal-lg #modalop')).click() }, { description: 'Driver sleep', action: async () => await driver.sleep(2000) }, //Validation { description: 'Validate text', action: async () => { const elementText = await driver.findElement(By.css('#metawarn > b')).getText(); if (elementText !== 'You must enter a Content Set name.') { throw new Error(`Expected: "You must enter a Content Set name."; Actual: "${elementText}"`); } console.log('Passed: Create DIV label matched as expected'); } }, //Validation text color -red { description: 'Validate Create Content Set validation text color', action: async () => { const elementStyle = await driver.findElement(By.css('#metawarn > b')).getCssValue('color'); if (elementStyle !== 'rgba(220, 53, 69, 1)') { throw new Error(`Create Content Set validation text color did not match; Actual: "${elementStyle}"`); } console.log('Passed: Create Content Set validation text color matched as expected'); } }, //Create Content Set Validation - Existing Name { description: 'Enter existing content set name', action: async () => await driver.findElement(By.css('#orgname')).sendKeys('Biology - QA') }, { description: 'Click create button', action: async () => await driver.findElement(By.css('.modal-lg #modalop')).click() }, { description: 'Driver sleep', action: async () => await driver.sleep(2000) }, //Validation { description: 'Validate text', action: async () => { const elementText = await driver.findElement(By.css('#namewarn')).getText(); if (elementText !== 'That name is already in use. Please enter a different name.') { throw new Error(`Expected: "That name is already in use. Please enter a different name."; Actual: "${elementText}"`); } console.log('Passed: Create DIV label matched as expected'); } }, //Validation text color -red { description: 'Validate Create Content Set validation text color', action: async () => { const elementStyle = await driver.findElement(By.css('#namewarn')).getCssValue('color'); if (elementStyle !== 'rgba(220, 53, 69, 1)') { throw new Error(`Create Content Set validation text color did not match; Actual: "${elementStyle}"`); } console.log('Passed: Create Content Set validation text color matched as expected'); } }, //Enter Content Set name: "Automated Content Set - To be deleted" { description: 'Clear content set name', action: async () => await driver.findElement(By.css('.form-row:nth-child(2) #orgname')).clear() }, { description: 'Driver sleep', action: async () => await driver.sleep(1000) }, { description: 'Enter content set name', action: async () => await driver.findElement(By.css('.form-row:nth-child(2) #orgname')).sendKeys(createContentSetName) }, { description: 'Click create button', action: async () => await driver.findElement(By.css('.modal-lg #modalop')).click() }, { description: 'Driver sleep', action: async () => await driver.sleep(2000) }, //Validate confirmation message { description: 'Validate confirmation message', action: async () => { const elementText = await driver.findElement(By.css('strong')).getText(); if (elementText !== 'The content set was successfuly created') { throw new Error(`Expected: confirmation message did not match; Actual: "${elementText}"`); } console.log('Passed: Confirmation message displayed as expected'); } }, //Validate confirmation message background color -green { description: 'Validate confirmation message background color', action: async () => { const elementStyle = await driver.findElement(By.css('#statalert')).getCssValue('background-color'); if (elementStyle !== 'rgba(40, 167, 69, 1)') { throw new Error(`Expected: Confirmation message background color did not match; Actual: "${elementStyle}"`); } console.log('Passed: Confirmation background color matched as expected'); } }, //Wait for dashboard to load { description: 'Wait for dashboard load to completely', action: async () => { return await driver.wait(until.elementLocated(By.linkText('View Details')), 10000).catch(() => false); } }, //Validate created content item count { description: 'Validate created content count', action: async () => { const elementText = await driver.findElement(By.css('#content-org-list > #content-org-list > #content-org-list > #content-org-list > #content-org-list > #content-org-list > #content-org-list > #content-org-list > #content-org-list > #content-org-list > #content-org-list > #content-org-list > #content-org-list > #content-org-list > #content-org-list > #content-org-list > #content-org-list .badge')).getText(); if (elementText !== '0') { throw new Error(`Expected: created content item count did not match; Actual: "${elementText}"`); } console.log('Passed: Created content item count matched as expected'); } }, //ITEMS PAGE //Click created content set link { description: 'Click created content set title link', action: async () => await driver.findElement(By.linkText(createContentSetName)).click() }, //Wait for DIV { description: 'Wait for contente page to load', action: async () => { return await driver.wait(until.elementLocated(By.css('b:nth-child(2)')), 5000).catch(() => false); } }, //Validate content item page - Filter Results label { description: 'Validate Filter Results label', action: async () => { const elementText = await driver.findElement(By.css('.well > b')).getText(); if (elementText !== 'Filter Results') { throw new Error(`Expected: Filter Results label did not match; Actual: "${elementText}"`); } console.log('Passed: Filter Results label matched as expected'); } }, //Validate content item page - Grade label { description: 'Validate filter - Grade label', action: async () => { const elementText = await driver.findElement(By.css('.form-group:nth-child(1) > b')).getText(); if (elementText !== 'Grade') { throw new Error(`Expected: Filter - Grade label did not match; Actual: "${elementText}"`); } console.log('Passed: Filter - Grade label matched as expected'); } }, //Validate content item page - Subject label { description: 'Validate filter - Subject label', action: async () => { const elementText = await driver.findElement(By.css('.form-group:nth-child(3) > b')).getText(); if (elementText !== 'Subject') { throw new Error(`Expected: Filter - Subject label did not match; Actual: "${elementText}"`); } console.log('Passed: Filter - Subject label matched as expected'); } }, //Validate content item page - Reset All link { description: 'Validate filter - Reset All link', action: async () => { const elementText = await driver.findElement(By.linkText('Reset All')).getText(); if (elementText !== 'Reset All') { throw new Error(`Expected: Filter - Reset All link did not match; Actual: "${elementText}"`); } console.log('Passed: Filter - Reset All link matched as expected'); } }, //Validate content item page - Results text { description: 'Validate Item - Results text', action: async () => { const elementText = await driver.findElement(By.css('b:nth-child(2)')).getText(); if (elementText !== 'There are no items that match your search criteria.') { throw new Error(`Expected: Item - Results text did not match; Actual: "${elementText}"`); } console.log('Passed: Item - Results text matched as expected'); } }, //NAVIGATE BACK TO DASHBOARD { description: 'Click Dashboard navigation link', action: async () => await driver.findElement(By.linkText('Dashboard')).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); } }, //EXPORT CONTENT { description: 'Click Ellipsis icon', action: async () => await driver.findElement(By.css('.fa-ellipsis-h')).click() }, { description: 'Driver sleep', action: async () => await driver.sleep(2000) }, //Create Content Set icon color -dark blue { description: 'Validate create content set icon color', action: async () => { const elementStyle = await driver.findElement(By.css('.fa-plus')).getCssValue('color'); if (elementStyle !== 'rgba(33, 37, 41, 1)') { throw new Error(`Create Content Set icon color did not match; Actual: "${elementStyle}"`); } console.log('Passed: Create Content Set icon color matched as expected'); } }, //Create Content Set link text { description: 'Validate create content set link text', action: async () => { const elementText = await driver.findElement(By.linkText('Create Content Set')).getText(); if (elementText !== 'Create Content Set') { throw new Error(`Expected: "Create Content Set"; Actual: "${elementText}"`); } console.log('Passed: Create Content Set link text matched as expected'); } }, //Create Content Set link text color -dark blue { description: 'Validate create content set link text color', action: async () => { const elementStyle = await driver.findElement(By.linkText('Create Content Set')).getCssValue('color'); if (elementStyle !== 'rgba(33, 37, 41, 1)') { throw new Error(`Create Content Set link text color did not match; Actual: "${elementStyle}"`); } console.log('Passed: Create Content Set link text color matched as expected'); } }, //Export Content Set icon color -dark blue { description: 'Validate export content set icon color', action: async () => { const elementStyle = await driver.findElement(By.css('.fa-download')).getCssValue('color'); if (elementStyle !== 'rgba(33, 37, 41, 1)') { throw new Error(`Export Content icon color did not match; Actual: "${elementStyle}"`); } console.log('Passed: Export Content icon color matched as expected'); } }, //Export Content Set link text { description: 'Validate export content set link text', action: async () => { const elementText = await driver.findElement(By.linkText('Export Content Set')).getText(); if (elementText !== 'Export Content Set') { throw new Error(`Expected: "Export Content Set"; Actual: "${elementText}"`); } console.log('Passed: Export Content Set link text matched as expected'); } }, //Export Content Set link text color -dark blue { description: 'Validate export content set link text color', action: async () => { const elementStyle = await driver.findElement(By.linkText('Export Content Set')).getCssValue('color'); if (elementStyle !== 'rgba(33, 37, 41, 1)') { throw new Error(`Export Content Set icon color did not match; Actual: "${elementStyle}"`); } console.log('Passed: Export Content Set icon color matched as expected'); } }, //Click Export Content Set link { description: 'Click Export Content Set link', action: async () => await driver.findElement(By.linkText('Export Content Set')).click() }, { description: 'Driver sleep', action: async () => await driver.sleep(2000) }, //Wait for dashboard to load { description: 'Wait for DIV to open', action: async () => { return await driver.wait(until.elementLocated(By.css('.modal-header:nth-child(4) > .modal-title')), 10000).catch(() => false); } }, //Export Content Set DIV { description: 'Validate export content set DIV title', action: async () => { const elementText = await driver.findElement(By.css('.modal-header:nth-child(4) > .modal-title')).getText(); if (elementText !== 'Export Content') { throw new Error(`Export set DIV title did not match; Actual: "${elementText}"`); } console.log('Passed: Export Content DIV title matched as expected'); } }, //Export Content Set DIV - title { description: 'Validate export DIV title text', action: async () => { const elementText = await driver.findElement(By.css('#content-export-container > h5')).getText(); if (elementText !== 'Please select one or more content sets to export:') { throw new Error(`Expected: "Please select one or more content sets to export:"; Actual: "${elementText}"`); } console.log('Passed: Export Content DIV title matched as expected'); } }, //Export Content Set DIV - title { description: 'Validate export DIV title text font size', action: async () => { const elementStyle = await driver.findElement(By.css('#content-export-container > h5')).getCssValue('font-size'); if (elementStyle !== '20px') { throw new Error(`Export Content title text font-size did not match; Actual: "${elementStyle}"`); } console.log('Passed: Export Content title text font-size matched as expected'); } }, //Export Content Set DIV - label { description: 'Validate export DIV label', action: async () => { const elementText = await driver.findElement(By.css('#content_export .form-label')).getText(); if (elementText !== 'Content Set') { throw new Error(`Expected: "Content Set"; Actual: "${elementText}"`); } console.log('Passed: Export Content DIV label matched as expected'); } }, //Export Content Set Dropdown { description: 'Validate export content set dropdown option', action: async () => { const elementOption = await driver.findElement(By.css('.form-group:nth-child(1) .multiselect-selected-text')).getText(); if (elementOption !== 'Please select a Content Set') { throw new Error(`Expected: "Please select a Content Set"; Actual: "${elementOption}"`); } console.log('Passed: Export Content Set dropdown option matched as expected'); } }, //Export Content Set DIV - Export button text { description: 'Validate export DIV - Export button text', action: async () => { const elementText = await driver.findElement(By.css('.modal-footer:nth-child(6) > .btn-primary')).getAttribute('value'); if (elementText !== 'Export') { throw new Error(`Expected: "Export"; Actual: "${elementText}"`); } console.log('Passed: Export button text matched as expected'); } }, //Export Content Set DIV - Export button color -green { description: 'Validate export DIV - Export button color', action: async () => { const elementStyle = await driver.findElement(By.css('.modal-footer:nth-child(6) > .btn-primary')).getCssValue('background-color'); if (elementStyle !== 'rgba(48, 200, 172, 1)') { throw new Error(`Export button color did not match; Actual: "${elementStyle}"`); } console.log('Passed: Export button color matched as expected'); } }, //Export Content Set DIV - Close button text { description: 'Validate export DIV - Close button text', action: async () => { const elementText = await driver.findElement(By.css('.btn:nth-child(3)')).getText(); if (elementText !== 'Close') { throw new Error(`Expected: "Close"; Actual: "${elementText}"`); } console.log('Passed: Close DIV label matched as expected'); } }, //Export Content Set DIV - Close button color -white { description: 'Validate export DIV - Close button color', action: async () => { const elementStyle = await driver.findElement(By.css('.btn:nth-child(3)')).getCssValue('background-color'); if (elementStyle !== 'rgba(0, 0, 0, 0)') { throw new Error(`Close button color did not match; Actual: "${elementStyle}"`); } console.log('Passed: Close button color matched as expected'); } }, //Click dropdown { description: 'Click Export Content dropdown', action: async () => await driver.findElement(By.css('.form-group:nth-child(1) .multiselect-selected-text')).click() }, { description: 'Driver sleep', action: async () => await driver.sleep(2000) }, //Export search icon { description: 'Verify export search icon is present', action: async () => { const expectedIcon = await driver.wait(until.elementLocated(By.css('.show .input-group-prepend img')), 5000).catch(() => false); if (!expectedIcon) { throw new Error('Export search icon not found'); } console.log('Passed: Export search icon present'); } }, //Export Content set dropdown placeholder { description: 'Validate dropdown placeholder text', action: async () => { const elementValue = await driver.findElement(By.css('.show > .multiselect-item .form-control')).getAttribute('placeholder'); if (elementValue !== 'Search') { throw new Error(`Expected: "Search"; Actual: "${elementValue}"`); } console.log('Passed: Export dropdown placeholder text matched as expected'); } }, //Export X icon { description: 'Verify export search X icon is present', action: async () => { const expectedIcon = await driver.wait(until.elementLocated(By.css('.form-group:nth-child(1) .input-group-append img')), 5000).catch(() => false); if (!expectedIcon) { throw new Error('Export search X icon not found'); } console.log('Passed: Export search X icon present'); } }, //SEARCH OPTIONS //Select All checkbox { description: 'Verify Select all checkbox icon is present', action: async () => { const expectedIcon = await driver.wait(until.elementLocated(By.css('.show .multiselect-all input')), 5000).catch(() => false); if (!expectedIcon) { throw new Error('Export selectd all checkbox icon not found'); } console.log('Passed: Export select all checkbox icon present'); } }, //Select all searcch text { description: 'Validate export Select all text', action: async () => { const elementText = await driver.findElement(By.css('.show > .multiselect-item .checkbox')).getText(); if (elementText !== 'Select all') { throw new Error(`Expected: "Select all"; Actual: "${elementText}"`); } console.log('Passed: Select all matched as expected'); } }, //Filter content list by QA { description: 'Filter Content Set Search list by QA', action: async () => await driver.findElement(By.css('.show > .multiselect-item .form-control')).sendKeys('QA') }, { description: 'Driver sleep', action: async () => await driver.sleep(2000) }, //FILTERED RESULTS //Select All checkbox { description: 'Verify Select all checkbox icon is present', action: async () => { const expectedIcon = await driver.wait(until.elementLocated(By.css('.show .multiselect-all input')), 5000).catch(() => false); if (!expectedIcon) { throw new Error('Export selectd all checkbox icon not found'); } console.log('Passed: Export select all checkbox icon present'); } }, //Select all searcch handle text { description: 'Validate export Select all handle text', action: async () => { const elementText = await driver.findElement(By.css('.show > .multiselect-item .checkbox')).getText(); if (elementText !== 'Select all') { throw new Error(`Expected: "Select all"; Actual: "${elementText}"`); } console.log('Passed: Select all handle text matched as expected'); } }, //Algebra - QA checkbox { description: 'Verify Algebra checkbox icon is present', action: async () => { const expectedIcon = await driver.wait(until.elementLocated(By.css('.show > li:nth-child(8) input')), 5000).catch(() => false); if (!expectedIcon) { throw new Error('Export Algebra - QA checkbox icon not found'); } console.log('Passed: Export Algebra - QA checkbox icon present'); } }, //Algebra - QA searcch handle text { description: 'Validate export Algebra handle text', action: async () => { const elementText = await driver.findElement(By.css('.show > li:nth-child(8) .checkbox')).getText(); if (elementText !== 'Algebra - QA') { throw new Error(`Expected: "Algebra - QA"; Actual: "${elementText}"`); } console.log('Passed: Algebra - QA handle text matched as expected'); } }, //Biology - QA checkbox { description: 'Verify Biology checkbox icon is present', action: async () => { const expectedIcon = await driver.wait(until.elementLocated(By.css('.show > li:nth-child(9) input')), 5000).catch(() => false); if (!expectedIcon) { throw new Error('Export Biology - QA checkbox icon not found'); } console.log('Passed: Export Biology - QA checkbox icon present'); } }, //Biology - QA searcch handle text { description: 'Validate export Biology handle text', action: async () => { const elementText = await driver.findElement(By.css('.show > li:nth-child(9) .checkbox')).getText(); if (elementText !== 'Biology - QA') { throw new Error(`Expected: "Biology - QA"; Actual: "${elementText}"`); } console.log('Passed: Biology - QA handle text matched as expected'); } }, //English II - QA checkbox { description: 'Verify English II checkbox icon is present', action: async () => { const expectedIcon = await driver.wait(until.elementLocated(By.css('.show > li:nth-child(10) input')), 5000).catch(() => false); if (!expectedIcon) { throw new Error('Export English II - QA checkbox icon not found'); } console.log('Passed: Export English II - QA checkbox icon present'); } }, //English II - QA searcch handle text { description: 'Validate export English II handle text', action: async () => { const elementText = await driver.findElement(By.css('.show > li:nth-child(10) .checkbox')).getText(); if (elementText !== 'English II - QA') { throw new Error(`Expected: "English II - QA"; Actual: "${elementText}"`); } console.log('Passed: English II - QA handle text matched as expected'); } }, //Geometry - QA checkbox { description: 'Verify Geometry checkbox icon is present', action: async () => { const expectedIcon = await driver.wait(until.elementLocated(By.css('.show > li:nth-child(11) input')), 5000).catch(() => false); if (!expectedIcon) { throw new Error('Export Geometry - QA checkbox icon not found'); } console.log('Passed: Export Geometry - QA checkbox icon present'); } }, //Geometry - QA searcch handle text { description: 'Validate export Geometry handle text', action: async () => { const elementText = await driver.findElement(By.css('.show > li:nth-child(11) .checkbox')).getText(); if (elementText !== 'Geometry - QA') { throw new Error(`Expected: "Geometry - QA"; Actual: "${elementText}"`); } console.log('Passed: Geometry - QA handle text matched as expected'); } }, //US History - QA checkbox { description: 'Verify US History checkbox icon is present', action: async () => { const expectedIcon = await driver.wait(until.elementLocated(By.css('.show > li:nth-child(12) input')), 5000).catch(() => false); if (!expectedIcon) { throw new Error('Export US History - QA checkbox icon not found'); } console.log('Passed: Export US History - QA checkbox icon present'); } }, //US History - QA searcch handle text { description: 'Validate export US History handle text', action: async () => { const elementText = await driver.findElement(By.css('.show > li:nth-child(12) .checkbox')).getText(); if (elementText !== 'US History - QA') { throw new Error(`Expected: "US History - QA"; Actual: "${elementText}"`); } console.log('Passed: US History - QA handle text matched as expected'); } }, //Automated - QA Content Set - To be deleted checkbox { description: 'Verify Automated - QA Content Set - To be deleted checkbox icon is present', action: async () => { const expectedIcon = await driver.wait(until.elementLocated(By.css('.show > li:nth-child(19) input')), 5000).catch(() => false); if (!expectedIcon) { throw new Error('Export Automated - QA Content Set - To be deleted checkbox icon not found'); } console.log('Passed: Export Automated - QA Content Set - To be deleted checkbox icon present'); } }, //Automated - QA Content Set - To be deleted searcch handle text { description: 'Validate export Automated - QA Content Set - To be deleted handle text', action: async () => { const elementText = await driver.findElement(By.css('.show > li:nth-child(19) .checkbox')).getText(); if (elementText !== 'Automated - QA Content Set - To be deleted') { throw new Error(`Expected: "Automated - QA Content Set - To be deleted"; Actual: "${elementText}"`); } console.log('Passed: Automated - QA Content Set - To be deleted handle text matched as expected'); } }, //Select created content set to export { description: 'Click Automated QA checkbox', action: async () => await driver.findElement(By.css('.show > li:nth-child(19) input')).click() }, { description: 'Wait for login process to complete', action: async () => await driver.sleep(2000) }, { description: 'Click Export button', action: async () => await driver.findElement(By.css('.modal-footer:nth-child(6) > .btn-primary')).click() }, { description: 'Wait for export page to load', action: async () => await driver.sleep(5000) }, //Export page title { description: 'Validate Export page title', action: async () => { const elementText = await driver.findElement(By.css('h2')).getText(); if (elementText !== 'Export') { throw new Error(`Expected: "Export"; Actual: "${elementText}"`); } console.log('Passed: Export page title matched as expected'); } }, //Export page title text color -dark blue { description: 'Validate Export page title text font color', action: async () => { const elementStyle = await driver.findElement(By.css('h2')).getCssValue('color'); if (elementStyle !== 'rgba(40, 39, 90, 1)') { throw new Error(`Export page title text font color did not match; Actual: "${elementStyle}"`); } console.log('Passed: Export page title text font color matched as expected'); } }, //Export page title text size { description: 'Validate Export page title text font size', action: async () => { const elementStyle = await driver.findElement(By.css('h2')).getCssValue('font-size'); if (elementStyle !== '32px') { throw new Error(`Export page title text font-size did not match; Actual: "${elementStyle}"`); } console.log('Passed: Export page title text font-size matched as expected'); } }, //Export complete label { description: 'Validate Export complete label', action: async () => { const elementText = await driver.findElement(By.css('b')).getText(); if (elementText !== 'Export complete!') { throw new Error(`Expected: "Export complete!"; Actual: "${elementText}"`); } console.log('Passed: Export complete! label matched as expected'); } }, //Download Export button icon { description: 'Verify Download Export button icon is present', action: async () => { const expectedIcon = await driver.wait(until.elementLocated(By.css('.fa-download')), 5000).catch(() => false); if (!expectedIcon) { throw new Error('Download Export button icon not found'); } console.log('Passed: Download Export button icon present'); } }, //Download Export button text { description: 'Validate Download Export button text', action: async () => { const elementText = await driver.findElement(By.linkText('Download Export')).getText(); if (elementText !== 'Download Export') { throw new Error(`Expected: "Download Export"; Actual: "${elementText}"`); } console.log('Passed: Download Export button text matched as expected'); } }, //Download Export button color -dark blue { description: 'Validate Download Export button color', action: async () => { const elementStyle = await driver.findElement(By.linkText('Download Export')).getCssValue('background-color'); if (elementStyle !== 'rgba(40, 39, 90, 1)') { throw new Error(`Download Export button color did not match; Actual: "${elementStyle}"`); } console.log('Passed: Download Export button color matched as expected'); } }, //NAVIGATE BACK TO DASHBOARD { description: 'Click Dashboard navigation link', action: async () => await driver.findElement(By.linkText('Dashboard')).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); } }, //Filter content list by - QA { description: 'Enter content set name', action: async () => await driver.findElement(By.css('#content-org-filter')).sendKeys('QA') }, { description: 'Wait for content list to filter', action: async () => await driver.sleep(2000) }, //Validate created content item count { description: 'Validate created content count', action: async () => { const elementText = await driver.findElement(By.css('#content-org-list > #content-org-list > #content-org-list > #content-org-list > #content-org-list > #content-org-list > #content-org-list > #content-org-list > #content-org-list > #content-org-list > #content-org-list > #content-org-list > #content-org-list > #content-org-list > #content-org-list > #content-org-list > #content-org-list .badge')).getText(); if (elementText !== '0') { throw new Error(`Expected: created content item count did not match; Actual: "${elementText}"`); } console.log('Passed: Created content item count matched as expected'); } }, //DELETE CREATED CONTENT SET { description: 'Click Automated - QA Content Set - To be deleted edit icon', action: async () => await driver.findElement(By.css('#content-org-list > #content-org-list > #content-org-list > #content-org-list > #content-org-list > #content-org-list > #content-org-list > #content-org-list > #content-org-list > #content-org-list > #content-org-list > #content-org-list > #content-org-list > #content-org-list > #content-org-list > #content-org-list > #content-org-list .fa')).click() }, { description: 'Wait for Edit Content DIV to open', action: async () => await driver.sleep(5000) }, //Wait for dashboard to load { description: 'Wait for DIV to open', action: async () => { return await driver.wait(until.elementLocated(By.css('.modal-lg .modal-title')), 10000).catch(() => false); } }, //Edit Content Set DIV { description: 'Validate Edit DIV title', action: async () => { const elementText = await driver.findElement(By.css('.modal-lg .modal-title')).getText(); if (elementText !== 'Edit Content Set') { throw new Error(`Edit DIV title did not match; Actual: "${elementText}"`); } console.log('Passed: Edit DIV title matched as expected'); } }, //Edit Content Set DIV - label { description: 'Validate Edit DIV label', action: async () => { const elementText = await driver.findElement(By.css('.modal-lg .form-label')).getText(); if (elementText !== 'Content Set Name') { throw new Error(`Expected: "Content Set Name"; Actual: "${elementText}"`); } console.log('Passed: Edit DIV label matched as expected'); } }, //Edit Content Set DIV - textbox { description: 'Validate Edit DIV textbox', action: async () => { const elementValue = await driver.findElement(By.css('#orgname')).getAttribute('value'); if (elementValue !== 'Automated - QA Content Set - To be deleted') { throw new Error(`Edit DIV textbox Expected: "Automated - QA Content Set - To be deleted"; Actual: "${elementValue}"`); } console.log('Passed: Edit DIV textbox matched as expected'); } }, //Edit Content Set DIV - Delete button { description: 'Validate Edit DIV delete text button', action: async () => { const elementText = await driver.findElement(By.css('.modal-lg #orgdelete')).getText(); if (elementText !== 'Delete') { throw new Error(`Expected: "Delete"; Actual: "${elementText}"`); } console.log('Passed: Edit DIV delete text button matched as expected'); } }, //Edit Content Set DIV - Delete button color -red { description: 'Validate Edit DIV delete button color', action: async () => { const elementStyle = await driver.findElement(By.css('.modal-lg #orgdelete')).getCssValue('background-color'); if (elementStyle !== 'rgba(220, 53, 69, 1)') { throw new Error(`Edit DIV delete button color did not match; Actual: "${elementStyle}"`); } console.log('Passed: Edit DIV delete button color matched as expected'); } }, //Edit Content Set DIV - Save button { description: 'Validate Edit DIV save text button', action: async () => { const elementText = await driver.findElement(By.css('#modalop')).getAttribute('value'); if (elementText !== 'Save') { throw new Error(`Expected: "Save"; Actual: "${elementText}"`); } console.log('Passed: Edit DIV save text button matched as expected'); } }, //Edit Content Set DIV - Save button color -green { description: 'Validate Edit DIV save button color', action: async () => { const elementStyle = await driver.findElement(By.css('#modalop')).getCssValue('background-color'); if (elementStyle !== 'rgba(48, 200, 172, 1)') { throw new Error(`Edit DIV save button color did not match; Actual: "${elementStyle}"`); } console.log('Passed: Edit DIV save button color matched as expected'); } }, //Edit Content Set DIV - Close button { description: 'Validate Edit DIV close text button', action: async () => { const elementText = await driver.findElement(By.css('#modalclose')).getText(); if (elementText !== 'Close') { throw new Error(`Expected: "Close"; Actual: "${elementText}"`); } console.log('Passed: Edit DIV close text button matched as expected'); } }, //Edit Content Set DIV - Close button color -white { description: 'Validate Edit DIV close button color', action: async () => { const elementStyle = await driver.findElement(By.css('#modalclose')).getCssValue('background-color'); if (elementStyle !== 'rgba(0, 0, 0, 0)') { throw new Error(`Edit DIV close button color did not match; Actual: "${elementStyle}"`); } console.log('Passed: Edit DIV close button color matched as expected'); } }, //Click Delete content button { description: 'Click Delete button', action: async () => await driver.findElement(By.css('#orgdelete')).click() }, { description: 'Driver sleep', action: async () => await driver.sleep(5000) }, //NEED TO READ ALERT MESSAGE AND CLICK OK TO DELETE CONTENT ]; 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', 'dashboardMyContent'); 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', 'dashboardMyContent'); if (fs.existsSync(screenshotDir)) { fs.rmSync(screenshotDir, { recursive: true, force: true }); } fs.mkdirSync(screenshotDir, { recursive: true }); // Remove old Excel file if (fs.existsSync('dashboardMyContentResults.xlsx')) { fs.unlinkSync('dashboardMyContentResults.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, ''); 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); console.error(`Step ${stepIndex} FAILED: ${error.message}`); testStatus = 'Failed'; } } //Check if login was successful const usernameValidation = await driver.wait(until.elementLocated(By.css('#navbarDropdown > span')), 5000).catch(() => false); if (usernameValidation) { console.log('PASSED: System logged in as expected'); testStatus = 'Passed'; } else { console.log('FAILED: Unable to log in'); 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, 'dashboardMyContentResults.xlsx'); } finally { await driver.quit(); } })(); } export default ExACT_dashboardMyContent;