Adding Content Set DIV checks

This commit is contained in:
2024-10-11 17:19:43 -07:00
parent f444e52a51
commit 1272b1fdf9

View File

@@ -37,6 +37,19 @@ const expectedFilterPlaceholder = 'filter...';
//Sort
const expectedSortLabel = 'Sort:';
const expectedSortDropDown = 'count';
//Content
const expectedBiologyQA = 'Biology - QA';
const expectedBiologyQACount = '1046';
//Edit Content Set
const expectedEditDIVTitle = 'Edit Content Set';
const expectedEditDIVLabel = 'Content Set Name';
const expectedEditDIVTextbox = 'Biology - QA';
const expectedEditDIVDeleteBtn = 'Delete';
const expectedEditDIVDeleteBtnColor = 'rgba(220, 53, 69, 1)'; //red
const expectedEditDIVSaveBtn = 'Save';
const expectedEditDIVSaveBtnColor = 'rgba(48, 200, 172, 1)'; //gren
const expectedEditDIVCloseBtn = 'Close';
const expectedEditDIVCloseBtnColor = 'rgba(0, 0, 0, 0)'; //white
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
@@ -66,7 +79,7 @@ const steps = [
action: async () => {
const elementStyle = await driver.findElement(By.css('.e-heading')).getCssValue('color');
if (elementStyle !== expectedDashboardTitleColor) {
throw new Error(`Expected: "${expectedDashboardTitleColor}"; Actual: "${elementStyle}"`);
throw new Error(`Dashboard title text color Expected: "${expectedDashboardTitleColor}"; Actual: "${elementStyle}"`);
}
console.log('Passed: Dashboard title text color matched as expected');
}
@@ -102,7 +115,7 @@ const steps = [
action: async () => {
const elementStyle = await driver.findElement(By.css('.h-100 h2:nth-child(2)')).getCssValue('color');
if (elementStyle !== expectedWidgetTitleColor) {
throw new Error(`Expected: "${expectedWidgetTitleColor}"; Actual: "${elementStyle}"`);
throw new Error(`Widget title text color Expected: "${expectedWidgetTitleColor}"; Actual: "${elementStyle}"`);
}
console.log('Passed: Widget title text color matched as expected');
}
@@ -126,7 +139,7 @@ const steps = [
action: async () => {
const elementStyle = await driver.findElement(By.css('.fa-ellipsis-h')).getCssValue('color');
if (elementStyle !== expectedEllipsisIconColor) {
throw new Error(`Expected: "${expectedEllipsisIconColor}"; Actual: "${elementStyle}"`);
throw new Error(`Ellipsis icon color Expected: "${expectedEllipsisIconColor}"; Actual: "${elementStyle}"`);
}
console.log('Passed: Ellipsis icon color matched as expected');
}
@@ -138,7 +151,7 @@ const steps = [
action: async () => {
const elementStyle = await driver.findElement(By.css('.col-12 > .fa')).getCssValue('color');
if (elementStyle !== expectedSearchIconColor) {
throw new Error(`Expected: "${expectedSearchIconColor}"; Actual: "${elementStyle}"`);
throw new Error(`Search icon color Expected: "${expectedSearchIconColor}"; Actual: "${elementStyle}"`);
}
console.log('Passed: Search icon color matched as expected');
}
@@ -180,7 +193,160 @@ const steps = [
}
},
//Biology-QA
{
description: 'Validate Biology-QA title',
action: async () => {
const elementText = await driver.findElement(By.linkText('Biology - QA')).getText();
if (elementText !== expectedBiologyQA) {
throw new Error(`Expected: "${expectedBiologyQA}"; Actual: "${elementText}"`);
}
console.log('Passed: Biology-QA title matched as expected');
}
},
//Biology-QA Edit icon
{
description: 'Verify Biology-QA edit icon is present',
action: async () => {
const expectedBiologyQAEditIcon = await driver.wait(until.elementLocated(By.css('#mycontentlist > #content-org-list > .content-org .fa')), 5000).catch(() => false);
if (!expectedBiologyQAEditIcon) {
throw new Error('Biology-QA edit icon not found');
}
console.log('Passed: Biology-QA edit icon present');
}
},
//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 !== expectedBiologyQACount) {
throw new Error(`Expected: "${expectedBiologyQACount}"; Actual: "${elementText}"`);
}
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() },
{ description: 'Driver sleep', action: async () => await driver.sleep(2000) },
//Edit Content Set DIV
{
description: 'Validate edit DIV title',
action: async () => {
const elementText = await driver.findElement(By.css('.modal-title')).getText();
if (elementText !== expectedEditDIVTitle) {
throw new Error(`Expected: "${expectedEditDIVTitle}"; Actual: "${elementText}"`);
}
console.log('Passed: Edit DIV title matched as expected');
}
},
//Edit Content Set DIV - label
{
description: 'Validate edit DIV label',
action: async () => {
const elementText = await driver.findElement(By.css('.form-label')).getText();
if (elementText !== expectedEditDIVLabel) {
throw new Error(`Expected: "${expectedEditDIVLabel}"; Actual: "${elementText}"`);
}
console.log('Passed: Edit DIV label matched as expected');
}
},
//Edit Content Set DIV - textbox
{
description: 'Validate edit DIV textbox',
action: async () => {
const elementValue = await driver.findElement(By.css('#orgname')).getAttribute('value');
if (elementValue !== expectedEditDIVTextbox) {
throw new Error(`Edit DIV textbox Expected: "${expectedEditDIVTextbox}"; Actual: "${elementValue}"`);
}
console.log('Passed: Edit DIV textbox matched as expected');
}
},
//Edit Content Set DIV - Delete button
{
description: 'Validate edit DIV delete text button',
action: async () => {
const elementText = await driver.findElement(By.css('#orgdelete')).getText();
if (elementText !== expectedEditDIVDeleteBtn) {
throw new Error(`Expected: "${expectedEditDIVDeleteBtn}"; Actual: "${elementText}"`);
}
console.log('Passed: Edit DIV delete text button matched as expected');
}
},
//Edit Content Set DIV - Delete button color
{
description: 'Validate edit DIV delete button color',
action: async () => {
const elementStyle = await driver.findElement(By.css('#orgdelete')).getCssValue('background-color');
if (elementStyle !== expectedEditDIVDeleteBtnColor) {
throw new Error(`Edit DIV delete button color Expected: "${expectedEditDIVDeleteBtnColor}"; 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 !== expectedEditDIVSaveBtn) {
throw new Error(`Expected: "${expectedEditDIVSaveBtn}"; Actual: "${elementText}"`);
}
console.log('Passed: Edit DIV save text button matched as expected');
}
},
//Edit Content Set 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 !== expectedEditDIVSaveBtnColor) {
throw new Error(`Edit DIV save button color Expected: "${expectedEditDIVSaveBtnColor}"; 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 !== expectedEditDIVCloseBtn) {
throw new Error(`Expected: "${expectedEditDIVCloseBtn}"; Actual: "${elementText}"`);
}
console.log('Passed: Edit DIV close text button matched as expected');
}
},
//Edit Content Set DIV - Close button color
{
description: 'Validate edit DIV close button color',
action: async () => {
const elementStyle = await driver.findElement(By.css('#modalclose')).getCssValue('background-color');
if (elementStyle !== expectedEditDIVCloseBtnColor) {
throw new Error(`Edit DIV close button color Expected: "${expectedEditDIVCloseBtnColor}"; Actual: "${elementStyle}"`);
}
console.log('Passed: Edit DIV close button color matched as expected');
}
},
//Close edit DIV
{ description: 'Click X icon', action: async () => await driver.findElement(By.css('.modal-content > .modal-header span')).click() },
//Ellipsis
{ 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
{
@@ -188,7 +354,7 @@ const steps = [
action: async () => {
const elementStyle = await driver.findElement(By.css('.fa-plus')).getCssValue('color');
if (elementStyle !== expectedCreateContentSetIconColor) {
throw new Error(`Expected: "${expectedCreateContentSetIconColor}"; Actual: "${elementStyle}"`);
throw new Error(`Create Content Set icon color Expected: "${expectedCreateContentSetIconColor}"; Actual: "${elementStyle}"`);
}
console.log('Passed: Create Content Set icon color matched as expected');
}
@@ -212,7 +378,7 @@ const steps = [
action: async () => {
const elementStyle = await driver.findElement(By.linkText('Create Content Set')).getCssValue('color');
if (elementStyle !== expectedCreateContentSetLinkTextColor) {
throw new Error(`Expected: "${expectedCreateContentSetLinkTextColor}"; Actual: "${elementStyle}"`);
throw new Error(`Create Content Set link text color Expected: "${expectedCreateContentSetLinkTextColor}"; Actual: "${elementStyle}"`);
}
console.log('Passed: Create Content Set link text color matched as expected');
}
@@ -224,7 +390,7 @@ const steps = [
action: async () => {
const elementStyle = await driver.findElement(By.css('.fa-download')).getCssValue('color');
if (elementStyle !== expectedExportContentSetIconColor) {
throw new Error(`Expected: "${expectedExportContentSetIconColor}"; Actual: "${elementStyle}"`);
throw new Error(`Export Content icon color Expected: "${expectedExportContentSetIconColor}"; Actual: "${elementStyle}"`);
}
console.log('Passed: Export Content icon color matched as expected');
}
@@ -248,7 +414,7 @@ const steps = [
action: async () => {
const elementStyle = await driver.findElement(By.linkText('Export Content Set')).getCssValue('color');
if (elementStyle !== expectedExportContentSetLinkTextColor) {
throw new Error(`Expected: "${expectedExportContentSetLinkTextColor}"; Actual: "${elementStyle}"`);
throw new Error(`Export Content Set icon color Expected: "${expectedExportContentSetLinkTextColor}"; Actual: "${elementStyle}"`);
}
console.log('Passed: Export Content Set icon color matched as expected');
}