Cleaned up constants section

This commit is contained in:
2024-12-05 15:34:46 -08:00
parent 00737c2bc5
commit 4b9072a970

View File

@@ -12,58 +12,7 @@ const ExACT_dashboardMyContent = (req, res) => {
let worksheet; let worksheet;
const startTime = new Date().toISOString(); const startTime = new Date().toISOString();
//Page title //Constants
const expectedDashboardTitle = 'Correlation Dashboard';
//My Content widget
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';
//Export Content
const expectedExportContentSetLinkText = 'Export Content Set';
//Filter
const expectedFilterPlaceholder = 'filter...';
//Sort
const expectedSortLabel = 'Sort:';
const expectedSortDropDown = 'count';
//Content
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 expectedEditDIVDeleteBtn = 'Delete';
const expectedEditDIVSaveBtn = 'Save';
const expectedEditDIVCloseBtn = 'Close';
const createContentSetName = 'Automated - QA Content Set - To be deleted'; const createContentSetName = 'Automated - QA Content Set - To be deleted';
const steps = [ const steps = [
@@ -76,6 +25,14 @@ const steps = [
{ description: 'Click Login button', action: async () => await driver.findElement(By.css('.login')).click() }, { 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) }, { 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 //Dashboard title
{ {
description: 'Validate dashboard title', description: 'Validate dashboard title',
@@ -257,15 +214,14 @@ const steps = [
} }
}, },
//Biology-QA Edit icon
{ {
description: 'Verify Biology-QA edit icon is present', description: 'Validate Biology-QA edit icon color',
action: async () => { action: async () => {
const expectedBiologyQAEditIcon = await driver.wait(until.elementLocated(By.css('#mycontentlist > #content-org-list > .content-org .fa')), 5000).catch(() => false); const elementStyle = await driver.findElement(By.css('#mycontentlist > #content-org-list > .content-org .fa')).getCssValue('color');
if (!expectedBiologyQAEditIcon) { if (elementStyle !== 'rgba(73, 80, 87, 1)') {
throw new Error('Biology-QA edit icon not found'); throw new Error(`Biology-QA edit icon color did not match; Actual: "${elementStyle}"`);
} }
console.log('Passed: Biology-QA edit icon present'); console.log('Passed: Bioloby-QA edit icon color matched as expected');
} }
}, },
@@ -284,7 +240,15 @@ const steps = [
//MY CONTENT ITEM COUNT //MY CONTENT ITEM COUNT
//Click My Content Items Count button //Click My Content Items Count button
{ description: 'Click My Content Items Count button', action: async () => await driver.findElement(By.css('#content_total')).click() }, { 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) }, { 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 //My Content Totals DIV title
{ {
@@ -569,6 +533,14 @@ const steps = [
{ description: 'Click Biology-QA edit icon', action: async () => await driver.findElement(By.css('#mycontentlist > #content-org-list > .content-org .fa')).click() }, { 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) }, { 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 //Edit Content Set DIV
{ {
description: 'Validate Edit DIV title', description: 'Validate Edit DIV title',
@@ -681,7 +653,7 @@ const steps = [
{ {
description: 'Validate Edit DIV close text button', description: 'Validate Edit DIV close text button',
action: async () => { action: async () => {
const elementText = await driver.findElement(By.css('.modal-lg #modalclose')).getText(); const elementText = await driver.findElement(By.css('#modalclose')).getText();
if (elementText !== 'Close') { if (elementText !== 'Close') {
throw new Error(`Expected: "Close"; Actual: "${elementText}"`); throw new Error(`Expected: "Close"; Actual: "${elementText}"`);
} }
@@ -693,7 +665,7 @@ const steps = [
{ {
description: 'Validate Edit DIV close button color', description: 'Validate Edit DIV close button color',
action: async () => { action: async () => {
const elementStyle = await driver.findElement(By.css('.modal-lg #modalclose')).getCssValue('background-color'); const elementStyle = await driver.findElement(By.css('#modalclose')).getCssValue('background-color');
if (elementStyle !== 'rgba(0, 0, 0, 0)') { if (elementStyle !== 'rgba(0, 0, 0, 0)') {
throw new Error(`Edit DIV close button color did not match; Actual: "${elementStyle}"`); throw new Error(`Edit DIV close button color did not match; Actual: "${elementStyle}"`);
} }
@@ -709,6 +681,14 @@ const steps = [
{ description: 'Click Biology-QA item Count link', action: async () => await driver.findElement(By.css('#mycontentlist > #content-org-list > .content-org .badge')).click() }, { 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) }, { 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 //Biology - QA Totals DIV title
{ {
description: 'Validate Biology - QA Totals DIV title', description: 'Validate Biology - QA Totals DIV title',
@@ -841,6 +821,54 @@ const steps = [
} }
}, },
//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 //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: '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) }, { description: 'Wait for My Content Totals DIV to close', action: async () => await driver.sleep(2000) },
@@ -923,6 +951,14 @@ const steps = [
{ description: 'Click Create Content Set link', action: async () => await driver.findElement(By.linkText('Create Content Set')).click() }, { 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) }, { 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 //Create Content Set DIV
{ {
description: 'Validate create content set DIV title', description: 'Validate create content set DIV title',
@@ -975,7 +1011,7 @@ const steps = [
{ {
description: 'Validate create DIV - Close button text', description: 'Validate create DIV - Close button text',
action: async () => { action: async () => {
const elementText = await driver.findElement(By.css('.modal-lg #modalclose')).getText(); const elementText = await driver.findElement(By.css('#modalclose')).getText();
if (elementText !== 'Close') { if (elementText !== 'Close') {
throw new Error(`Expected: "Close"; Actual: "${elementText}"`); throw new Error(`Expected: "Close"; Actual: "${elementText}"`);
} }
@@ -987,7 +1023,7 @@ const steps = [
{ {
description: 'Validate create DIV - Close button color', description: 'Validate create DIV - Close button color',
action: async () => { action: async () => {
const elementStyle = await driver.findElement(By.css('.modal-lg #modalclose')).getCssValue('background-color'); const elementStyle = await driver.findElement(By.css('#modalclose')).getCssValue('background-color');
if (elementStyle !== 'rgba(0, 0, 0, 0)') { if (elementStyle !== 'rgba(0, 0, 0, 0)') {
throw new Error(`Close button color did not match; Actual: "${elementStyle}"`); throw new Error(`Close button color did not match; Actual: "${elementStyle}"`);
} }
@@ -1083,36 +1119,142 @@ const steps = [
} }
}, },
//Driver sleep //Wait for dashboard to load
{ description: 'Driver sleep', action: async () => await driver.sleep(5000) },
//Validate created content set
{ {
description: 'Verify created automated content set', description: 'Wait for dashboard load to completely',
action: async () => { action: async () => {
const expectedCreatedContentSet = await driver.wait(until.elementLocated(By.linkText(createContentSetName)), 5000).catch(() => false); return await driver.wait(until.elementLocated(By.linkText('View Details')), 10000).catch(() => false);
if (!expectedCreatedContentSet) { }
throw new Error(`Expected: "${createContentSetName}" content set not found`); },
//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: Automated content set present'); console.log('Passed: Created content item count matched as expected');
} }
}, },
//ITEMS PAGE
//Click created content set //Click created content set
{ description: 'Click created content set edit icon', action: async () => await driver.findElement(By.linkText(createContentSetName)).click() }, { description: 'Click created content set title link', action: async () => await driver.findElement(By.linkText(createContentSetName)).click() },
{ description: 'Driver sleep', action: async () => await driver.sleep(5000) },
//Wait for DIV //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);
}
},
//DELETE CREATED CONTENT SET
//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', description: 'Wait for DIV to open',
action: async () => { action: async () => {
return await driver.wait(until.elementLocated(By.css('.modal-lg .modal-title')), 5000).catch(() => false); return await driver.wait(until.elementLocated(By.css('.modal-lg .modal-title')), 10000).catch(() => false);
} }
}, },
//Edit Content Set DIV //Edit Content Set DIV
{ {
description: 'Validate edit DIV title', description: 'Validate Edit DIV title',
action: async () => { action: async () => {
const elementText = await driver.findElement(By.css('.modal-lg .modal-title')).getText(); const elementText = await driver.findElement(By.css('.modal-lg .modal-title')).getText();
if (elementText !== 'Edit Content Set') { if (elementText !== 'Edit Content Set') {
@@ -1124,7 +1266,7 @@ const steps = [
//Edit Content Set DIV - label //Edit Content Set DIV - label
{ {
description: 'Validate edit DIV label', description: 'Validate Edit DIV label',
action: async () => { action: async () => {
const elementText = await driver.findElement(By.css('.modal-lg .form-label')).getText(); const elementText = await driver.findElement(By.css('.modal-lg .form-label')).getText();
if (elementText !== 'Content Set Name') { if (elementText !== 'Content Set Name') {
@@ -1136,21 +1278,96 @@ const steps = [
//Edit Content Set DIV - textbox //Edit Content Set DIV - textbox
{ {
description: 'Validate edit DIV textbox', description: 'Validate Edit DIV textbox',
action: async () => { action: async () => {
const elementValue = await driver.findElement(By.css('#orgname')).getAttribute('value'); const elementValue = await driver.findElement(By.css('#orgname')).getAttribute('value');
if (elementValue !== createContentSetName) { if (elementValue !== 'Automated - QA Content Set - To be deleted') {
throw new Error(`Expected: "${createContentSetName}"; Actual: "${elementValue}"`); 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'); console.log('Passed: Edit DIV textbox matched as expected');
} }
}, },
//DELETE CREATED CONTENT SET //Edit Content Set DIV - Delete button
/*Delete created content set {
{ description: 'Click delete button', action: async () => await driver.findElement(By.css('.modal-lg #orgdelete')).click() }, 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');
}
},
//Delete content item
{ description: 'Click Delete button', action: async () => await driver.findElement(By.css('#orgdelete')).click() },
{ description: 'Driver sleep', action: async () => await driver.sleep(5000) }, { description: 'Driver sleep', action: async () => await driver.sleep(5000) },
*/