From 943554e6c0105cd5e9be328bf11379db873280d6 Mon Sep 17 00:00:00 2001 From: jhuerta Date: Wed, 27 Nov 2024 14:58:01 -0800 Subject: [PATCH] Added My Content Item count checks --- tests/ExACT_dashboardMyContent.js | 836 +++++++++++++++++++++++++----- 1 file changed, 720 insertions(+), 116 deletions(-) diff --git a/tests/ExACT_dashboardMyContent.js b/tests/ExACT_dashboardMyContent.js index 4b99d80..dc68d0e 100644 --- a/tests/ExACT_dashboardMyContent.js +++ b/tests/ExACT_dashboardMyContent.js @@ -15,7 +15,32 @@ const ExACT_dashboardMyContent = (req, res) => { //Page title const expectedDashboardTitle = 'Correlation Dashboard'; //My Content widget -const expectedMyContentWidgetTitle = 'My Content'; +const expectedDashboardMyContentWidgetTitle = 'My Content'; +const expectedDashboardMyContentWidgetItemCount = '3527 items'; +//My Content Totals DIV +const expectedMyContentTotalDIVtitle = 'My Content Totals'; +//Headers +const expectedTotalItemsLabel = 'Total Items'; + const expectedTotalItemsCount = '3527'; +const expectedUniqueTitlesLabel = 'Unique Titles'; + const expectedUniqueTitlesCount = '6433'; +const expectedUniqueIDsLabel = 'Unique IDs'; + const expectedUniqueIDsCount = '5531'; +//Columns +const expectedContentSetColumnLabel = 'Content Set'; +const expectedTotalItemsColumnLabel = 'Total Items'; +const expectedUniqueTitlesColumnLabel = 'Unique Titles'; +const expectedUniqueIDsColumnLabel = 'Unique IDs'; +//Biology - QA +const expectedBiologyQATotalsDIVtitle = 'Biology - QA Totals'; +const expectedBiologyQAContentSetLabel = 'Biology - QA'; +const expectedBiologyQATotalItems = '1046'; +const expectedBiologyQAUniqueTitles = '1058'; +const expectedBiologyQAUniqueIDs = '1065'; +//DIV Footer +const expectedMyContentTotalDIVcloseButton = 'Close'; +const expectedMyContentTotalDIVexportButton = 'Export'; + //Ellipsis //Create Content const expectedCreateContentSetLinkText = 'Create Content Set'; @@ -31,17 +56,21 @@ const expectedBiologyQALink = 'Biology - QA'; const expectedBiologyQACountLink = '1046'; //Edit Content Set DIV const expectedEditDIVLabel = 'Content Set Name'; + //Validation + const expectedCreateContentSetValidation = 'You must enter a Content Set name.'; const expectedEditDIVTextbox = 'Biology - QA'; - const expectedCreatedDIVTextbox = 'Automated Content Set - To be deleted' + const expectedCreatedDIVTextbox = 'Automated Content Set - To be deleted'; const expectedEditDIVDeleteBtn = 'Delete'; const expectedEditDIVSaveBtn = 'Save'; const expectedEditDIVCloseBtn = 'Close'; +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 + //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() }, @@ -52,8 +81,8 @@ const steps = [ description: 'Validate dashboard title', action: async () => { const elementText = await driver.findElement(By.css('.e-heading')).getText(); - if (elementText !== expectedDashboardTitle) { - throw new Error(`Expected: "${expectedWelcomeBackText}"; Actual: "${elementText}"`); + if (elementText !== 'Correlation Dashboard') { + throw new Error(`Expected: "Correlation Dashboard"; Actual: "${elementText}"`); } console.log('Passed: Dashboard title matched as expected'); } @@ -77,45 +106,82 @@ const steps = [ action: async () => { const elementStyle = await driver.findElement(By.css('.e-heading')).getCssValue('font-size'); if (elementStyle !== '32px') { - throw new Error(`Dashboard title text fond-size did not match; Actual: "${elementStyle}"`); + throw new Error(`Dashboard title text font-size did not match; Actual: "${elementStyle}"`); } console.log('Passed: Dashboard title text font-size matched as expected'); } }, - //Widget title + //MY CONTENT WIDGET + //Dashboard My Content Widget title { - description: 'Validate 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 !== expectedMyContentWidgetTitle) { - throw new Error(`Expected: "${expectedMyContentWidgetTitle}"; Actual: "${elementText}"`); + if (elementText !== 'My Content') { + throw new Error(`Expected: "My Content"; Actual: "${elementText}"`); } - console.log('Passed: Widget title matched as expected'); + console.log('Passed: Dashboard - My Content Widget title matched as expected'); } }, - //Widget title text color -navy blue + //Dashboard My Content Widget title text color -navy blue { - description: 'Validate widget title text color', + 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(`Widget title text color did not match; Actual: "${elementStyle}"`); + throw new Error(`Dashboard - My Content Widget title text color did not match; Actual: "${elementStyle}"`); } - console.log('Passed: Widget title text color matched as expected'); + console.log('Passed: Dashboard - My Content Widget title text color matched as expected'); } }, - //Widget title text font + //Dashboard My Content Widget title text font { - description: 'Validate widget title text font size', + 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(`Widget title text font-size did not match; Actual: "${elementStyle}"`); + throw new Error(`Dashboard - My Content Widget title text font-size did not match; Actual: "${elementStyle}"`); } - console.log('Passed: Widget title text font-size matched as expected'); + 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 -navy 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'); } }, @@ -148,32 +214,32 @@ const steps = [ description: 'Validate Filter placeholder text', action: async () => { const elementValue = await driver.findElement(By.css('#content-org-filter')).getAttribute('placeholder'); - if (elementValue !== expectedFilterPlaceholder) { - throw new Error(`Expected: "${expectedFilterPlaceholder}"; Actual: "${elementValue}"`); + if (elementValue !== 'filter...') { + throw new Error(`Expected: "filter..."; Actual: "${elementValue}"`); } console.log('Passed: Filter placeholder text matched as expected'); } }, - //Sort + //Sort label { description: 'Validate sort label', action: async () => { const elementText = await driver.findElement(By.css('.col-4')).getText(); - if (elementText !== expectedSortLabel) { - throw new Error(`Expected: "${expectedSortLabel}"; Actual: "${elementText}"`); + if (elementText !== 'Sort:') { + throw new Error(`Expected: "Sort:"; Actual: "${elementText}"`); } console.log('Passed: Sort label matched as expected'); } }, - //Sort Dropdown + //Sort Dropdown [should be: "Count", option] { description: 'Validate sort dropdown option', action: async () => { - const elementOption = await driver.findElement(By.css('#orgsort')).getAttribute('value'); - if (elementOption !== expectedSortDropDown) { - throw new Error(`Expected: "${expectedSortDropDown}"; Actual: "${elementOption}"`); + 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'); } @@ -184,8 +250,8 @@ const steps = [ description: 'Validate Biology-QA title', action: async () => { const elementText = await driver.findElement(By.linkText('Biology - QA')).getText(); - if (elementText !== expectedBiologyQALink) { - throw new Error(`Expected: "${expectedBiologyQALink}"; Actual: "${elementText}"`); + if (elementText !== 'Biology - QA') { + throw new Error(`Expected: "Biology - QA"; Actual: "${elementText}"`); } console.log('Passed: Biology-QA title matched as expected'); } @@ -203,34 +269,311 @@ const steps = [ } }, - //Biology-QA count + //Biology-QA Count { - description: 'Validate 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 !== expectedBiologyQACountLink) { - throw new Error(`Expected: "${expectedBiologyQACountLink}"; Actual: "${elementText}"`); + if (elementText !== '1046') { + throw new Error(`Expected: "1046"; Actual: "${elementText}"`); } - console.log('Passed: Biology-QA count matched as expected'); + console.log('Passed: Biology-QA Count matched as expected'); } }, - //Add Content Set - { description: 'Click Biology-QA edit icon', action: async () => await driver.findElement(By.css('#mycontentlist > #content-org-list > .content-org .fa')).click() }, - - //Wait for DIV - { - description: 'Wait for DIV to open', + //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(5000) }, + + //My Content Totals DIV title + { + description: 'Validate My Content Totals DIV title', action: async () => { - return await driver.wait(until.elementLocated(By.css('.modal-content .modal-title')), 50000).catch(() => false); - } + 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 -navy 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'); + } + }, + + //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) }, + //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) }, + //Edit Content Set DIV { - description: 'Validate edit DIV title', + description: 'Validate Edit DIV title', action: async () => { - const elementText = await driver.findElement(By.css('.modal-content .modal-title')).getText(); + 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}"`); } @@ -240,11 +583,11 @@ const steps = [ //Edit Content Set DIV - label { - description: 'Validate edit DIV label', + description: 'Validate Edit DIV label', action: async () => { - const elementText = await driver.findElement(By.css('.form-label')).getText(); - if (elementText !== expectedEditDIVLabel) { - throw new Error(`Expected: "${expectedEditDIVLabel}"; Actual: "${elementText}"`); + 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'); } @@ -252,11 +595,11 @@ const steps = [ //Edit Content Set DIV - textbox { - description: 'Validate edit DIV textbox', + description: 'Validate Edit DIV textbox', action: async () => { const elementValue = await driver.findElement(By.css('#orgname')).getAttribute('value'); - if (elementValue !== expectedEditDIVTextbox) { - throw new Error(`Edit DIV textbox Expected: "${expectedEditDIVTextbox}"; Actual: "${elementValue}"`); + if (elementValue !== 'Biology - QA') { + throw new Error(`Edit DIV textbox Expected: "Biology - QA"; Actual: "${elementValue}"`); } console.log('Passed: Edit DIV textbox matched as expected'); } @@ -264,11 +607,11 @@ const steps = [ //Edit Content Set DIV - Delete button { - description: 'Validate edit DIV delete text button', + description: 'Validate Edit DIV delete text button', action: async () => { - const elementText = await driver.findElement(By.css('#orgdelete')).getText(); - if (elementText !== expectedEditDIVDeleteBtn) { - throw new Error(`Expected: "${expectedEditDIVDeleteBtn}"; Actual: "${elementText}"`); + 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'); } @@ -276,9 +619,9 @@ const steps = [ //Edit Content Set DIV - Delete button color -red { - description: 'Validate edit DIV delete button color', + description: 'Validate Edit DIV delete button color', action: async () => { - const elementStyle = await driver.findElement(By.css('#orgdelete')).getCssValue('background-color'); + 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}"`); } @@ -286,13 +629,37 @@ const steps = [ } }, + //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', + description: 'Validate Edit DIV save text button', action: async () => { const elementText = await driver.findElement(By.css('#modalop')).getAttribute('value'); - if (elementText !== expectedEditDIVSaveBtn) { - throw new Error(`Expected: "${expectedEditDIVSaveBtn}"; Actual: "${elementText}"`); + if (elementText !== 'Save') { + throw new Error(`Expected: "Save"; Actual: "${elementText}"`); } console.log('Passed: Edit DIV save text button matched as expected'); } @@ -300,7 +667,7 @@ const steps = [ //Edit Content Set DIV - Save button color -green { - description: 'Validate edit DIV save button color', + 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)') { @@ -312,11 +679,11 @@ const steps = [ //Edit Content Set DIV - Close button { - description: 'Validate edit DIV close text button', + description: 'Validate Edit DIV close text button', action: async () => { - const elementText = await driver.findElement(By.css('#modalclose')).getText(); - if (elementText !== expectedEditDIVCloseBtn) { - throw new Error(`Expected: "${expectedEditDIVCloseBtn}"; Actual: "${elementText}"`); + const elementText = await driver.findElement(By.css('.modal-lg #modalclose')).getText(); + if (elementText !== 'Close') { + throw new Error(`Expected: "Close"; Actual: "${elementText}"`); } console.log('Passed: Edit DIV close text button matched as expected'); } @@ -324,9 +691,9 @@ const steps = [ //Edit Content Set DIV - Close button color -white { - description: 'Validate edit DIV close button color', + description: 'Validate Edit DIV close button color', action: async () => { - const elementStyle = await driver.findElement(By.css('#modalclose')).getCssValue('background-color'); + const elementStyle = await driver.findElement(By.css('.modal-lg #modalclose')).getCssValue('background-color'); if (elementStyle !== 'rgba(0, 0, 0, 0)') { throw new Error(`Edit DIV close button color did not match; Actual: "${elementStyle}"`); } @@ -335,10 +702,150 @@ const steps = [ }, //Close edit DIV - { description: 'Click X icon', action: async () => await driver.findElement(By.css('.modal-content > .modal-header span')).click() }, + { 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) }, - //Ellipsis - { description: 'Click ellipsis icon', action: async () => await driver.findElement(By.css('.fa-ellipsis-h')).click() }, + //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 -navy 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'); + } + }, + + //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) }, + //CREATE CONTENT SET + { 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 @@ -358,8 +865,8 @@ const steps = [ description: 'Validate create content set link text', action: async () => { const elementText = await driver.findElement(By.linkText('Create Content Set')).getText(); - if (elementText !== expectedCreateContentSetLinkText) { - throw new Error(`Expected: "${expectedCreateContentSetLinkText}"; Actual: "${elementText}"`); + 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'); } @@ -394,8 +901,8 @@ const steps = [ description: 'Validate export content set link text', action: async () => { const elementText = await driver.findElement(By.linkText('Export Content Set')).getText(); - if (elementText !== expectedExportContentSetLinkText) { - throw new Error(`Expected: "${expectedExportContentSetLinkText}"; Actual: "${elementText}"`); + 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'); } @@ -413,26 +920,18 @@ const steps = [ } }, - //Create Content Set - { description: 'Click ellipsis icon', action: async () => await driver.findElement(By.linkText('Create Content Set')).click() }, - - //Wait for DIV - { - description: 'Wait for DIV to open', - action: async () => { - return await driver.wait(until.elementLocated(By.css('.modal-content .modal-title')), 50000).catch(() => false); - } - }, + { 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) }, //Create Content Set DIV { description: 'Validate create content set DIV title', action: async () => { - const elementText = await driver.findElement(By.css('.modal-content .modal-title')).getText(); + 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'); + console.log('Passed: Create Content Set DIV title matched as expected'); } }, @@ -440,34 +939,133 @@ const steps = [ { description: 'Validate create DIV label', action: async () => { - const elementText = await driver.findElement(By.css('.form-label')).getText(); - if (elementText !== expectedEditDIVLabel) { - throw new Error(`Expected: "${expectedEditDIVLabel}"; Actual: "${elementText}"`); + 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'); } }, - //Enter Content Set Name - { description: 'Enter content set name', action: async () => await driver.findElement(By.css('#orgname')).sendKeys('Automated Content Set - To be deleted') }, - { description: 'Click create button', action: async () => await driver.findElement(By.css('#modalop')).click() }, - //{ description: 'Driver sleep', action: async () => await driver.sleep(5000) }, - - //Wait for confirmation message - { - description: 'Wait for DIV to open', + //Create Content Set DIV - Create button text + { + description: 'Validate create DIV - Create button text', action: async () => { - return await driver.wait(until.elementLocated(By.css('strong:nth-child(1)')), 50000).catch(() => false); - } + 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('.modal-lg #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('.modal-lg #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'); + } + }, + + //Click Create button - without Content Set 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'); + } + }, + + //Enter duplicate Content Set 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:nth-child(1)')).getText(); + 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}"`); + throw new Error(`Expected: confirmation message did not match; Actual: "${elementText}"`); } console.log('Passed: Confirmation message displayed as expected'); } @@ -479,32 +1077,36 @@ const steps = [ action: async () => { const elementStyle = await driver.findElement(By.css('#statalert')).getCssValue('background-color'); if (elementStyle !== 'rgba(40, 167, 69, 1)') { - throw new Error(`Confirmation message background color did not match; Actual: "${elementStyle}"`); + throw new Error(`Expected: Confirmation message background color did not match; Actual: "${elementStyle}"`); } console.log('Passed: Confirmation background color matched as expected'); } }, + //Driver sleep + { description: 'Driver sleep', action: async () => await driver.sleep(5000) }, + //Validate created content set { description: 'Verify created automated content set', action: async () => { - const expectedCreatedContentSet = await driver.wait(until.elementLocated(By.linkText('Automated Content Set - To be deleted')), 5000).catch(() => false); + const expectedCreatedContentSet = await driver.wait(until.elementLocated(By.linkText(createContentSetName)), 5000).catch(() => false); if (!expectedCreatedContentSet) { - throw new Error('Automated created content set not found'); + throw new Error(`Expected: "${createContentSetName}" content set not found`); } console.log('Passed: Automated content set present'); } }, //Click created content set - { description: 'Click created content set 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 .fa')).click() }, + { description: 'Click created content set edit icon', action: async () => await driver.findElement(By.linkText(createContentSetName)).click() }, + { description: 'Driver sleep', action: async () => await driver.sleep(5000) }, //Wait for DIV { description: 'Wait for DIV to open', action: async () => { - return await driver.wait(until.elementLocated(By.css('.modal-content .modal-title')), 50000).catch(() => false); + return await driver.wait(until.elementLocated(By.css('.modal-lg .modal-title')), 5000).catch(() => false); } }, @@ -512,7 +1114,7 @@ const steps = [ { description: 'Validate edit DIV title', action: async () => { - const elementText = await driver.findElement(By.css('.modal-content .modal-title')).getText(); + 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}"`); } @@ -524,9 +1126,9 @@ const steps = [ { description: 'Validate edit DIV label', action: async () => { - const elementText = await driver.findElement(By.css('.form-label')).getText(); - if (elementText !== expectedEditDIVLabel) { - throw new Error(`Expected: "${expectedEditDIVLabel}"; Actual: "${elementText}"`); + 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'); } @@ -537,16 +1139,18 @@ const steps = [ description: 'Validate edit DIV textbox', action: async () => { const elementValue = await driver.findElement(By.css('#orgname')).getAttribute('value'); - if (elementValue !== expectedCreatedDIVTextbox) { - throw new Error(`Edit DIV textbox Expected: "${expectedCreatedDIVTextbox}"; Actual: "${elementValue}"`); + if (elementValue !== createContentSetName) { + throw new Error(`Expected: "${createContentSetName}"; Actual: "${elementValue}"`); } console.log('Passed: Edit DIV textbox matched as expected'); } }, - //Delete created content set - { description: 'Click delete button', action: async () => await driver.findElement(By.css('#orgdelete')).click() }, - { description: 'Driver sleep', action: async () => await driver.sleep(2000) }, + //DELETE CREATED CONTENT SET + /*Delete created content set + { description: 'Click delete button', action: async () => await driver.findElement(By.css('.modal-lg #orgdelete')).click() }, + { description: 'Driver sleep', action: async () => await driver.sleep(5000) }, + */