From 9edfd048d7be41dad29056a46ffde86f748cf118 Mon Sep 17 00:00:00 2001 From: jhuerta Date: Mon, 13 Jan 2025 12:39:19 -0800 Subject: [PATCH] Updated scripts --- tests/ExACT_contentPage.js | 3 +- tests/ExACT_dashboardMyContent.js | 476 ++++++++++++++++++++++++++---- tests/ExACT_editItem.js | 144 +++++++-- 3 files changed, 548 insertions(+), 75 deletions(-) diff --git a/tests/ExACT_contentPage.js b/tests/ExACT_contentPage.js index 39b0cc8..4ab46a3 100644 --- a/tests/ExACT_contentPage.js +++ b/tests/ExACT_contentPage.js @@ -214,6 +214,7 @@ const steps = [ } }, + //Biology-QA edit icon color { description: 'Validate Biology-QA edit icon color', action: async () => { @@ -1631,7 +1632,7 @@ const steps = [ description: 'Validate Filtered Content 1 Alignment Pending label', action: async () => { const elementText = await driver.findElement(By.css('#alignstatuslink873578654 > .display-alignment')).getText(); - if (elementText !== 'Aligned (reset)') { + if (elementText !== 'Alignment Pending (reset)') { throw new Error(`Expected: Filtered Content 1 Alignment Pending label did not match; Actual: "${elementText}"`); } console.log('Passed: Filtered Content 1 Alignment Pending label matched as expected'); diff --git a/tests/ExACT_dashboardMyContent.js b/tests/ExACT_dashboardMyContent.js index ac0f9aa..8effd97 100644 --- a/tests/ExACT_dashboardMyContent.js +++ b/tests/ExACT_dashboardMyContent.js @@ -4,7 +4,7 @@ import XLSX from 'xlsx'; import path from 'path'; const ExACT_dashboardMyContent = (req, res) => { - res.send('

ExACT Automated Test Script - Dashboard - My Content: Initiated

'); + res.send('

ExACT Automated Test Script - Dashboard - My Content widget: Initiated

'); (async function example() { let driver = await new Builder().forBrowser('chrome').build(); let testStatus = 'Failed'; @@ -221,28 +221,89 @@ const steps = [ 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'); + console.log('Passed: Biology-QA edit icon color matched as expected'); } }, - //Biology-QA Count + //Validate default sort order top6 + //Biology - QA = 1046 (1st) { - description: 'Validate Biology-QA Count', + description: 'Validate default QA: Biology - QA 1046 count in 1st place', action: async () => { - const elementText = await driver.findElement(By.css('#mycontentlist > #content-org-list > .content-org .badge')).getText(); + const elementText = await driver.findElement(By.xpath('//li/div/span')).getText(); if (elementText !== '1046') { - throw new Error(`Expected: "1046"; Actual: "${elementText}"`); + throw new Error(`Expected: Default content set order: Biology - QA count "1046" not listed in 1st place; Actual: "${elementText}"`); } - console.log('Passed: Biology-QA Count matched as expected'); + console.log('Passed: Default content set order: Biology - QA count 1046 listed in 1st place'); + } + }, + + //Geometry - QA = 981 (2nd) + { + description: 'Validate default QA: Geometry - QA 981 count in 2nd place', + action: async () => { + const elementText = await driver.findElement(By.xpath('//ul/ul/li/div/span')).getText(); + if (elementText !== '981') { + throw new Error(`Expected: Default content set order: Geometry - QA count "981" not listed in 2nd place; Actual: "${elementText}"`); + } + console.log('Passed: Default content set order: Geometry - QA count 981 listed in 2nd place'); + } + }, + + //Math Alignment Import Test = 730 (3rd) + { + description: 'Validate default QA: Math Alignment Import Test 730 count in 3rd place', + action: async () => { + const elementText = await driver.findElement(By.xpath('//ul/ul/ul/li/div/span')).getText(); + if (elementText !== '730') { + throw new Error(`Expected: Default content set order: Math Alignment Import Testcount "730" not listed in 3rd place; Actual: "${elementText}"`); + } + console.log('Passed: Default content set order: Math Alignment Import Test count 730 listed in 3rd place'); + } + }, + + //English - QA = 409 (4th) + { + description: 'Validate default QA: English - QA 409 count in 4th place', + action: async () => { + const elementText = await driver.findElement(By.xpath('//ul/ul/ul/ul/li/div/span')).getText(); + if (elementText !== '409') { + throw new Error(`Expected: Default content set order: English - QA count "409" not listed in 4th place; Actual: "${elementText}"`); + } + console.log('Passed: Default content set order: English - QA count 409 listed in 4th place'); + } + }, + + //Algebra - QA = 188 (5th) + { + description: 'Validate default QA: Algebra- QA 188 count in 5th place', + action: async () => { + const elementText = await driver.findElement(By.xpath('//ul/ul/ul/ul/ul/li/div/span')).getText(); + if (elementText !== '188') { + throw new Error(`Expected: Default content set order: Algebra - QA count "1882" not listed in 5th place; Actual: "${elementText}"`); + } + console.log('Passed: Default content set order: Algebra - QA count 188 listed in 5th place'); + } + }, + + //US History - QA = 62 (6th) + { + description: `Validate default QA: US History - QA 62 count in 6th place`, + action: async () => { + const elementText = await driver.findElement(By.xpath('//ul/ul/ul/ul/ul/ul/li/div/span')).getText(); + if (elementText !== '62') { + throw new Error(`Expected: Default content set order: US History - QA count "62" not listed in 6th place; Actual: "${elementText}"`); + } + console.log(`Passed: Default content set order: US History - QA count 62 listed in 6th place`); } }, //MY CONTENT ITEM COUNT - //Click My Content Items Count button + //NEXT ACTION -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? + //Wait for DIV { description: 'Wait for DIV to open', action: async () => { @@ -526,11 +587,11 @@ const steps = [ } }, - //Close DIV button + //NEXT ACTION -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 + //NEXT ACTION -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) }, @@ -674,12 +735,12 @@ const steps = [ } }, - //Close edit DIV + //NEXT ACTION -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 + //NEXT ACTION -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) }, @@ -871,11 +932,11 @@ const steps = [ } }, - //Click Close DIV button + //NEXT ACTION -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 + //NEXT ACTION -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) }, @@ -951,11 +1012,11 @@ const steps = [ } }, - //CREATE CONTENT SET + //NEXT ACTION -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 + //Wait for DIV to open { description: 'Wait for DIV to open', action: async () => { @@ -1035,7 +1096,7 @@ const steps = [ } }, - //Create Content Set Validation - No Name + //NEXT ACTION -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) }, @@ -1063,7 +1124,7 @@ const steps = [ } }, - //Create Content Set Validation - Existing Name + //NEXT ACTION -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) }, @@ -1092,7 +1153,7 @@ const steps = [ } }, - //Enter Content Set name: "Automated Content Set - To be deleted" + //NEXT ACTION -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) }, @@ -1105,9 +1166,9 @@ const steps = [ 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}"`); + throw new Error(`Expected: Alert banner created confirmation message did not match; Actual: "${elementText}"`); } - console.log('Passed: Confirmation message displayed as expected'); + console.log('Passed: Alert banner created confirmation message displayed as expected'); } }, @@ -1117,9 +1178,9 @@ 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(`Expected: Confirmation message background color did not match; Actual: "${elementStyle}"`); + throw new Error(`Expected: Alert banner background color did not match; Actual: "${elementStyle}"`); } - console.log('Passed: Confirmation background color matched as expected'); + console.log('Passed: Alert banner background color matched as expected'); } }, @@ -1144,7 +1205,7 @@ const steps = [ }, //ITEMS PAGE - //Click created content set link + //NEXT ACTION -Click created content set link { description: 'Click created content set title link', action: async () => await driver.findElement(By.linkText(createContentSetName)).click() }, //Wait for DIV @@ -1215,7 +1276,7 @@ const steps = [ } }, - //NAVIGATE BACK TO DASHBOARD + //NEXT ACTION -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) }, @@ -1227,7 +1288,7 @@ const steps = [ } }, - //EXPORT CONTENT + //NEXT ACTION -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) }, @@ -1303,7 +1364,7 @@ const steps = [ } }, - //Click Export Content Set link + //NEXT ACTION -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) }, @@ -1423,7 +1484,7 @@ const steps = [ } }, - //Click dropdown + //NEXT ACTION -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) }, @@ -1488,7 +1549,7 @@ const steps = [ } }, - //Filter content list by QA + //NEXT ACTION -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) }, @@ -1637,31 +1698,31 @@ const steps = [ } }, - //Automated - QA Content Set - To be deleted checkbox + //Created Content Set Name checkbox { - description: 'Verify Automated - QA Content Set - To be deleted checkbox icon is present', + description: `Verify ${createContentSetName} 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'); + throw new Error(`Export "${createContentSetName}" checkbox icon not found`); } - console.log('Passed: Export Automated - QA Content Set - To be deleted checkbox icon present'); + console.log(`Passed: Export "${createContentSetName}" checkbox icon present`); } }, - //Automated - QA Content Set - To be deleted search handle text + //Created Content Set Name search handle text { - description: 'Validate export Automated - QA Content Set - To be deleted handle text', + description: `Validate export ${createContentSetName} 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}"`); + if (elementText !== createContentSetName) { + throw new Error(`Expected: "${createContentSetName}"; Actual: "${elementText}"`); } - console.log('Passed: Automated - QA Content Set - To be deleted handle text matched as expected'); + console.log(`Passed: "${createContentSetName}" handle text matched as expected`); } }, - //Select created content set to export + //NEXT ACTION -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() }, @@ -1751,7 +1812,7 @@ const steps = [ } }, - //NAVIGATE BACK TO DASHBOARD + //NEXT ACTION -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) }, @@ -1763,24 +1824,237 @@ const steps = [ } }, - //Filter content list by - QA + //NEXT ACTION -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 + //Validate sort order by applying filter QA + //Biology - QA = 1046 (1st) { - description: 'Validate created content count', + description: 'Validate by filter QA: Biology - QA 1046 count in 1st place', 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}"`); + const elementText = await driver.findElement(By.xpath('//li/div/span')).getText(); + if (elementText !== '1046') { + throw new Error(`Expected: Filtered by QA: Biology - QA count "1046" not sorted in 1st place; Actual: "${elementText}"`); } - console.log('Passed: Created content item count matched as expected'); + console.log('Passed: Filtered by QA: Biology - QA count 1046 sorted in 1st place'); } }, - //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() }, + //Geometry - QA = 981 (2nd) + { + description: 'Validate by filter QA: Geometry - QA 981 count in 2nd place', + action: async () => { + const elementText = await driver.findElement(By.xpath('//ul/ul/li/div/span')).getText(); + if (elementText !== '981') { + throw new Error(`Expected: Filtered by QA: Geometry - QA count "981" not sorted in 2nd place; Actual: "${elementText}"`); + } + console.log('Passed: Filtered by QA: Geometry - QA count 981 sorted in 2nd place'); + } + }, + + //English II - QA = 409 (3rd) + { + description: 'Validate by filter QA: English II - QA 409 count in 3rd place', + action: async () => { + const elementText = await driver.findElement(By.xpath('//ul/ul/ul/ul/li/div/span')).getText(); + if (elementText !== '409') { + throw new Error(`Expected: Filtered by QA: English II - QA count "409" not sorted in 3rd place; Actual: "${elementText}"`); + } + console.log('Passed: Filtered by QA: English II - QA count 409 sorted in 3rd place'); + } + }, + + //Algebra - QA = 188 (4th) + { + description: 'Validate by filter QA: Algebra - QA 188 count in 4th place', + action: async () => { + const elementText = await driver.findElement(By.xpath('//ul/ul/ul/ul/ul/li/div/span')).getText(); + if (elementText !== '188') { + throw new Error(`Expected: Filtered by QA: Algebra - QA count "188" not sorted in 4th place; Actual: "${elementText}"`); + } + console.log('Passed: Filtered by QA: Algebra - QA count 188 sorted in 4th place'); + } + }, + + //US History - QA = 62 (5th) + { + description: 'Validate by filter QA: US History - QA 162 count in 5th place', + action: async () => { + const elementText = await driver.findElement(By.xpath('//ul/ul/ul/ul/ul/ul/li/div/span')).getText(); + if (elementText !== '62') { + throw new Error(`Expected: Filtered by QA: US History - QA count "62" not sorted in 5th place; Actual: "${elementText}"`); + } + console.log('Passed: Filtered by QA: US History - QA count 62 sorted in 5th place'); + } + }, + + //Created Content Set = 0 (6th) + { + description: `Validate by filter QA: ${createContentSetName} 0 count in 6th place`, + action: async () => { + const elementText = await driver.findElement(By.xpath('//ul/ul/ul/ul/ul/ul/ul/ul/ul/ul/ul/ul/ul/ul/ul/ul/ul/li/div/span')).getText(); + if (elementText !== '0') { + throw new Error(`Expected: Filtered by QA: ${createContentSetName} count "0" not sorted in 6th place; Actual: "${elementText}"`); + } + console.log(`Passed: Filtered by QA: ${createContentSetName} count 0 sorted in 6th place`); + } + }, + + //NEXT ACTION -Sort content set list by applying sort by Name + { description: 'Select filter sort order by Name', action: async () => await driver.findElement(By.css('#orgsort > option:nth-child(2)')).click() }, + { description: 'Wait for content list to filter', action: async () => await driver.sleep(2000) }, + + //Algebra - QA = 188 (1st) + { + description: 'Validate by filter name: Algebra - QA 188 count in 1st place', + action: async () => { + const elementText = await driver.findElement(By.xpath('//li/div/span')).getText(); + if (elementText !== '188') { + throw new Error(`Expected: Filtered by Name: Algebra - QA count "188" not sorted in 1st place; Actual: "${elementText}"`); + } + console.log('Passed: Filtered by Name: Algebra - QA count 188 sorted in 1st place'); + } + }, + + //Created Content Set = 0 (2nd) + { + description: `Validate by filter name: ${createContentSetName} 0 count in 2nd place`, + action: async () => { + const elementText = await driver.findElement(By.xpath('//ul/ul/li/div/span')).getText(); + if (elementText !== '0') { + throw new Error(`Expected: Filtered by Name: ${createContentSetName} count "0" not sorted in 2nd place; Actual: "${elementText}"`); + } + console.log(`Passed: Filtered by Name: ${createContentSetName} count 0 sorted in 2nd place`); + } + }, + + //Biology - QA = 1046 (3rd) + { + description: 'Validate by filter name: Biology - QA 1046 count in 3rd place', + action: async () => { + const elementText = await driver.findElement(By.xpath('//ul/ul/ul/li/div/span')).getText(); + if (elementText !== '1046') { + throw new Error(`Expected: Filtered by Name: Biology - QA count "1046" not sorted in 3rd place; Actual: "${elementText}"`); + } + console.log('Passed: Filtered by Name: Biology - QA count 1046 sorted in 3rd place'); + } + }, + + //Demo - User Submitted Content = 17 (4th) + { + description: 'Validate by filter name: Demo - User Submitted Content 17 count in 4th place', + action: async () => { + const elementText = await driver.findElement(By.xpath('//ul/ul/ul/ul/li/div/span')).getText(); + if (elementText !== '17') { + throw new Error(`Expected: Filtered by Name: Demo - User Submitted ContentA count "17" not sorted in 4th place; Actual: "${elementText}"`); + } + console.log('Passed: Filtered by Name: Demo - User Submitted Content count 17 sorted in 4th place'); + } + }, + + //English II - QA = 409 (5th) + { + description: 'Validate by filter name: English II - QA 409 count in 5th place', + action: async () => { + const elementText = await driver.findElement(By.xpath('//ul/ul/ul/ul/ul/li/div/span')).getText(); + if (elementText !== '409') { + throw new Error(`Expected: Filtered by Name: English II - QA count "409" not sorted in 5th place; Actual: "${elementText}"`); + } + console.log('Passed: Filtered by Name: English II - QA 409 count 409 sorted in 5th place'); + } + }, + + //Exploring - Access = 0 (6th) + { + description: `Validate by filter name: Exploring - Access 0 count in 6th place`, + action: async () => { + const elementText = await driver.findElement(By.xpath('//ul/ul/ul/ul/ul/ul/li/div/span')).getText(); + if (elementText !== '0') { + throw new Error(`Expected: Filtered by Name: Exploring - Access count "0" not sorted in 6th place; Actual: "${elementText}"`); + } + console.log(`Passed: Filtered by Name: Exploring - Access count 0 sorted in 6th place`); + } + }, + + //NEXT ACTION -Filter content list by - QA by applying sort by Name and filtered 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) }, + + //Algebra - QA = 188 (1st) + { + description: 'Validate by filter QA and sorted by name: Algebra - QA 188 count in 1st place', + action: async () => { + const elementText = await driver.findElement(By.xpath('//li/div/span')).getText(); + if (elementText !== '188') { + throw new Error(`Expected: Filtered by QA and sorted by Name: Algebra - QA count "188" not sorted in 1st place; Actual: "${elementText}"`); + } + console.log('Passed: Filtered by QA and sorted by Name: Algebra - QA count 188 sorted in 1st place'); + } + }, + + //Created Content Set = 0 (2nd) + { + description: `Validate by filter QA and sorted by name: ${createContentSetName} 0 count in 2nd place`, + action: async () => { + const elementText = await driver.findElement(By.xpath('//ul/ul/li/div/span')).getText(); + if (elementText !== '0') { + throw new Error(`Expected: Filtered by QA and sorted by Name: ${createContentSetName} count "0" not sorted in 2nd place; Actual: "${elementText}"`); + } + console.log(`Passed: Filtered by QA and sorted by Name: ${createContentSetName} count 0 sorted in 2nd place`); + } + }, + + //Biology - QA = 1046 (3rd) + { + description: 'Validate by filter QA and sorted by name: Biology - QA 1046 count in 3rd place', + action: async () => { + const elementText = await driver.findElement(By.xpath('//ul/ul/ul/li/div/span')).getText(); + if (elementText !== '1046') { + throw new Error(`Expected: Filtered by QA and sorted by Name: Biology - QA count "1046" not sorted in 3rd place; Actual: "${elementText}"`); + } + console.log('Passed: Filtered by QA and sorted by Name: Biology - QA count 1046 sorted in 3rd place'); + } + }, + + //English II - QA = 409 (4th) + { + description: 'Validate by filter QA and sorted by name: English II - QA 409 count in 4th place', + action: async () => { + const elementText = await driver.findElement(By.xpath('//ul/ul/ul/ul/ul/li/div/span')).getText(); + if (elementText !== '409') { + throw new Error(`Expected: Filtered by QA and sorted by Name: English II - QA count "409" not sorted in 4th place; Actual: "${elementText}"`); + } + console.log('Passed: Filtered by QA and sorted by Name: English II - QA 409 count 409 sorted in 4th place'); + } + }, + + //Geometry - QA = 981 (5th) + { + description: 'Validate by filter QA and sorted by name: Geometry - QA 981 count in 5th place', + action: async () => { + const elementText = await driver.findElement(By.xpath('//ul/ul/ul/ul/ul/ul/ul/ul/ul/li/div/span')).getText(); + if (elementText !== '981') { + throw new Error(`Expected: Filtered by QA and sorted by Name: Geometry - QA count "981" not sorted in 5th place; Actual: "${elementText}"`); + } + console.log('Passed: Filtered by QA and sorted by Name: Geometry - QA count 981 sorted in 5th place'); + } + }, + + //US History - QA = 62 (6th) + { + description: 'Validate by filter QA and sorted by name: US History - QA 162 count in 6th place', + action: async () => { + const elementText = await driver.findElement(By.xpath('//ul/ul/ul/ul/ul/ul/ul/ul/ul/ul/ul/ul/ul/ul/ul/ul/ul/li/div/span')).getText(); + if (elementText !== '62') { + throw new Error(`Expected: Filtered by QA and sorted by Name: US History - QA count "62" not sorted in 6th place; Actual: "${elementText}"`); + } + console.log('Passed: Filtered by QA and sorted by Name: US History - QA count 62 sorted in 6th place'); + } + }, + + //NEXT ACTION -DELETE CREATED CONTENT SET + { description: `Click ${createContentSetName} edit icon`, action: async () => await driver.findElement(By.css('#mycontentlist > #content-org-list > #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 @@ -1820,8 +2094,8 @@ const steps = [ 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}"`); + if (elementValue !== createContentSetName) { + throw new Error(`Edit DIV textbox Expected: "${createContentSetName}"; Actual: "${elementValue}"`); } console.log('Passed: Edit DIV textbox matched as expected'); } @@ -1899,10 +2173,100 @@ const steps = [ } }, - //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 + //NEXT ACTION -Delete created content set + { + description: 'Delete created content and validate assert message', + action: async () => { + await driver.wait( + until.elementLocated(By.css('#myModal')), + 5000 + ); + await driver.sleep(2000); + + const deleteButton = await driver.wait( + until.elementLocated(By.css('#orgdelete')), + 5000 + ); + await deleteButton.click(); + await driver.sleep(2000); + + const alert = await driver.wait( + until.alertIsPresent(), + 5000 + ); + + const alertText = await alert.getText(); + + try { + if (alertText !== `Are you sure you want to delete ${createContentSetName}? This operation cannot be undone or recovered.`) { + throw new Error(`Expected: "Are you sure you want to delete ${createContentSetName}? This operation cannot be undone or recovered."; Actual: "${alertText}"`); + } + console.log('Passed: Delete Alert DIV text matched as expected'); + console.log('Passed: Delete Alert DIV, OK/Cancel button text matched as expected'); + } catch (error) { + console.error('FAILED: Delete Alert DIV, unable to validate text; Error Message: ', error.message); + await alert.dismiss(); + throw error; + } + + await alert.accept(); + await driver.sleep(2000); + } +}, + +//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 deleted') { + throw new Error(`Expected: Alert banner deleted confirmation message did not match; Actual: "${elementText}"`); + } + console.log('Passed: Alert banner deleted 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: Alert banner background color did not match; Actual: "${elementStyle}"`); + } + console.log('Passed: Alert banner 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); + } +}, + +//Verify content was deleted +{ + description: 'Verify content set deletion', + action: async () => { + const filterSearch = await driver.wait( + until.elementLocated(By.css('#content-org-filter')), + 5000 + ); + await filterSearch.clear(); + await filterSearch.sendKeys('QA'); + await driver.sleep(2000); + + const createdContentSet = await driver.findElements( + By.linkText(createContentSetName) + ); + + if (createdContentSet.length > 0) { + throw new Error('Content set was not deleted successfully'); + } + } +} ]; diff --git a/tests/ExACT_editItem.js b/tests/ExACT_editItem.js index 875c1a1..3fb5251 100644 --- a/tests/ExACT_editItem.js +++ b/tests/ExACT_editItem.js @@ -1551,7 +1551,7 @@ const steps = [ } }, - //Browse tab title + //Browse tab title (active) { description: 'Validate browse tab title', action: async () => { @@ -1563,7 +1563,19 @@ const steps = [ } }, - //Browse tab title -navy blue + //Browse tab text title -white (active) + { + description: 'Validate browse tab text color', + action: async () => { + const elementStyle = await driver.findElement(By.linkText('Browse')).getCssValue('color'); + if (elementStyle !== 'rgba(255, 255, 255, 1)') { + throw new Error(`Expected: "Browse" tab text title color did not match; Actual: "${elementStyle}"`); + } + console.log('Passed: Browse tab text title color matched as expected'); + } + }, + + //Browse tab title -navy blue (active) { description: 'Validate browse tab color', action: async () => { @@ -1575,7 +1587,7 @@ const steps = [ } }, - //By Standard tab title + //By Standard tab title (dimmed) { description: 'Validate by standard tab title', action: async () => { @@ -1587,7 +1599,19 @@ const steps = [ } }, - //By Standard tab title -gray (dimmed) + //By Standard tab text title -gray (dimmed) + { + description: 'Validate by standard tab text color', + action: async () => { + const elementStyle = await driver.findElement(By.linkText('By Standard')).getCssValue('color'); + if (elementStyle !== 'rgba(182, 186, 181, 1)') { + throw new Error(`Expected: "By Standard" tab text title color did not match; Actual: "${elementStyle}"`); + } + console.log('Passed: By Standard tab text title color matched as expected'); + } + }, + + //By Standard tab title -white (dimmed) { description: 'Validate by standard tab color', action: async () => { @@ -1599,7 +1623,7 @@ const steps = [ } }, - //AutoAlign tab title + //AutoAlign tab title (dimmed) { description: 'Validate AutoAlign tab title', action: async () => { @@ -1611,7 +1635,19 @@ const steps = [ } }, - //AutoAlign tab title -gray (dimmed) + //AutoAlign tab text title -gray (dimmed) + { + description: 'Validate AutoAlign tab text color', + action: async () => { + const elementStyle = await driver.findElement(By.linkText('AutoAlign')).getCssValue('color'); + if (elementStyle !== 'rgba(182, 186, 181, 1)') { + throw new Error(`Expected: "AutoAlign" tab text title color did not match; Actual: "${elementStyle}"`); + } + console.log('Passed: AutoAlign tab text title color matched as expected'); + } + }, + + //AutoAlign tab title -white (dimmed) { description: 'Validate AutoAlign tab color', action: async () => { @@ -1951,7 +1987,7 @@ const steps = [ { description: 'Click By Standard tab link', action: async () => await driver.findElement(By.linkText('By Standard')).click() }, { description: 'Wait for action to complete', action: async () => await driver.sleep(5000) }, - //Browse tab title + //Browse tab title (dimmed) { description: 'Validate browse tab title', action: async () => { @@ -1963,7 +1999,19 @@ const steps = [ } }, - //Browse tab title -gray (dimmed) + //Browse tab text title -gray (dimmed) + { + description: 'Validate browse tab text color', + action: async () => { + const elementStyle = await driver.findElement(By.linkText('Browse')).getCssValue('color'); + if (elementStyle !== 'rgba(182, 186, 181, 1)') { + throw new Error(`Expected: "Browse" tab text title color did not match; Actual: "${elementStyle}"`); + } + console.log('Passed: Browse tab text title color matched as expected'); + } + }, + + //Browse tab title -white (dimmed) { description: 'Validate browse tab color', action: async () => { @@ -1975,7 +2023,7 @@ const steps = [ } }, - //By Standard tab title + //By Standard tab title (active) { description: 'Validate by standard tab title', action: async () => { @@ -1987,7 +2035,19 @@ const steps = [ } }, - //By Standard tab title -navy blue + //By Standard tab text title -navy blue (active) + { + description: 'Validate by standard tab text color', + action: async () => { + const elementStyle = await driver.findElement(By.linkText('By Standard')).getCssValue('color'); + if (elementStyle !== 'rgba(255, 255, 255, 1)') { + throw new Error(`Expected: "By Standard" tab text title color did not match; Actual: "${elementStyle}"`); + } + console.log('Passed: By Standard tab text title color matched as expected'); + } + }, + + //By Standard tab title -navy blue (active) { description: 'Validate by standard tab color', action: async () => { @@ -1999,7 +2059,7 @@ const steps = [ } }, - //AutoAlign tab title + //AutoAlign tab title (dimmed) { description: 'Validate AutoAlign tab title', action: async () => { @@ -2011,7 +2071,19 @@ const steps = [ } }, - //AutoAlign tab title -gray (dimmed) + //AutoAlign tab text title -gray (dimmed) + { + description: 'Validate AutoAlign tab text color', + action: async () => { + const elementStyle = await driver.findElement(By.linkText('AutoAlign')).getCssValue('color'); + if (elementStyle !== 'rgba(182, 186, 181, 1)') { + throw new Error(`Expected: "AutoAlign" tab text title color did not match; Actual: "${elementStyle}"`); + } + console.log('Passed: AutoAlign tab text title color matched as expected'); + } + }, + + //AutoAlign tab title -white (dimmed) { description: 'Validate AutoAlign tab color', action: async () => { @@ -2051,7 +2123,7 @@ const steps = [ { description: 'Click AutoAlign tab link', action: async () => await driver.findElement(By.linkText('AutoAlign')).click() }, { description: 'Wait for action to complete', action: async () => await driver.sleep(5000) }, - //Browse tab title + //Browse tab title (dimmed) { description: 'Validate browse tab title', action: async () => { @@ -2063,7 +2135,19 @@ const steps = [ } }, - //Browse tab title -gray (dimmed) + //Browse tab text title -gray (dimmed) + { + description: 'Validate browse tab text color', + action: async () => { + const elementStyle = await driver.findElement(By.linkText('Browse')).getCssValue('color'); + if (elementStyle !== 'rgba(182, 186, 181, 1)') { + throw new Error(`Expected: "Browse" tab text title color did not match; Actual: "${elementStyle}"`); + } + console.log('Passed: Browse tab text title color matched as expected'); + } + }, + + //Browse tab title -white (dimmed) { description: 'Validate browse tab color', action: async () => { @@ -2075,7 +2159,7 @@ const steps = [ } }, - //By Standard tab title + //By Standard tab title (dimmed) { description: 'Validate by standard tab title', action: async () => { @@ -2087,7 +2171,19 @@ const steps = [ } }, - //By Standard tab title -gray (dimmed) + //By Standard tab text title -gray (dimmed) + { + description: 'Validate by standard tab text color', + action: async () => { + const elementStyle = await driver.findElement(By.linkText('By Standard')).getCssValue('color'); + if (elementStyle !== 'rgba(182, 186, 181, 1)') { + throw new Error(`Expected: "By Standard" tab text title color did not match; Actual: "${elementStyle}"`); + } + console.log('Passed: By Standard tab text title color matched as expected'); + } + }, + + //By Standard tab title -white (dimmed) { description: 'Validate by standard tab color', action: async () => { @@ -2099,7 +2195,7 @@ const steps = [ } }, - //AutoAlign tab title + //AutoAlign tab title (active) { description: 'Validate AutoAlign tab title', action: async () => { @@ -2111,7 +2207,19 @@ const steps = [ } }, - //AutoAlign tab title -navy blue + //AutoAlign tab text title -navy blue (active) + { + description: 'Validate AutoAlign tab text color', + action: async () => { + const elementStyle = await driver.findElement(By.linkText('AutoAlign')).getCssValue('color'); + if (elementStyle !== 'rgba(255, 255, 255, 1)') { + throw new Error(`Expected: "AutoAlign" tab text title color did not match; Actual: "${elementStyle}"`); + } + console.log('Passed: AutoAlign tab text title color matched as expected'); + } + }, + + //AutoAlign tab title -navy blue (active) { description: 'Validate AutoAlign tab color', action: async () => {