Untitled
unknown
plain_text
2 years ago
72 kB
18
Indexable
using API_Base.API_Classes;
using API_Base.ModelClasses.MemberSavings;
using master_regression.Utility;
using NUnit.Framework;
using NUnit.Framework.Interfaces;
using SeleniumBase.PageObjects.MedCompass;
using SeleniumBase.PageObjects.MedCompass.Pages;
using SeleniumBase.PageObjects.MedCompass.Pages.PageResources;
using SeleniumBase.PageObjects.MedCompass.ReusableSteps;
using System;
using System.Collections.Generic;
using TestDataLibrary;
namespace master_regression.Member.UtilizationManagement.Savings
{
[TestFixture]
[Category(CategoryAttributes.ClientLevel.Product)]
[Category(CategoryAttributes.ComponentLevel.Member)]
[Category(CategoryAttributes.SuiteLevel.Full)]
public class Savings : BaseTest
{
string SavingsSummaryURL = "";
string SavingType = "";
MemberSavingsAPIs apiClass = null;
SavingsModel Savings_Model = new SavingsModel
{
SavingsDescription = "NP",
StartDate = DateTime.Now.AddDays(1),
EndDate = DateTime.Now.AddDays(1),
SavingsType = "E",
TotalSavings = 100,
};
[OneTimeSetUp]
public void setup()
{
try
{
AddMemberToUseForTestClass("Savings", "Automation", "SavingsAutomation");
driver.NavigateToMemberPage(this.EnvironmentData.BaseUrl, this.EnvironmentData.Member.MemberUrlGuid);
apiClass = new MemberSavingsAPIs(this.ProjectPropertiesData);
this.SavingsSummaryURL = $"{EnvironmentData.BaseUrl}member/{EnvironmentData.Member.MemberUrlGuid}/um/savings";
driver.GoToURL(this.SavingsSummaryURL);
}
catch (Exception e)
{
TestFixtureError = e;
}
}
[SetUp]
public void SetUp()
{
if (PreviousTestStatus != TestStatus.Passed)
{
driver.GoToURL(this.SavingsSummaryURL);
driver.WaitUntil_UrlContains(this.SavingsSummaryURL);
}
}
[Category(CategoryAttributes.ClientLevel.Aetna)]
[Category(CategoryAttributes.ClientLevel.Gateway)]
[Test, Name("Add Savings with Expense Management and Negotiation of Price"),
Description("Add Saving with Expense Management and Negotiation of Price"), Order(1), TestCaseId("380180,380210,380224,393225")]
[Category("Daily Product Regression")]
public void TS01_ValidateAdd_WithExpenseManagementandNegotiationofPrice()
{
var testData = new
{
selectExpenseManagement = "E",
SelectSavingDescription = "NP",
ProviderNotInTable = "Provider",
OriginalDailyRate = "10.11",
OriginalFrequency = "2",
OriginalUnit = "8",
AvoidedItem = "10",
NewUnit = "1.51",
NewRate = "7.11",
NewFrequency = "4.12",
BilledAmount = "100.12",
AllowedAmount = "150.12",
DeniedAmount = "5.51",
TypeofSavings = "Management",
Savings = "100",
providerId = EnvironmentData.Provider.ProviderId,
providerName = EnvironmentData.Provider.ProviderName,
};
List<string> expectedLabels = new List<string>
{
"Total Savings", "Start Date of Savings", "End Date of Savings"
};
SavingSummary
.Initialize(this.driver)
.btn_TableView_Click()
.tbl_SavingSummayTable.GetRowCount(out int BeforerecordCount)
.btn_AddNewSavings.Click();
SavingDetail
.Initialize(this.driver)
.Select_SavingTypeKey.SelectByValue(testData.selectExpenseManagement)
.WaitForLoadingSpinner()
.Select_SavingDescriptionTypeKey.IsEnabled(out bool EnableSavingDescriptionTypeKey)
.Select_SavingDescriptionTypeKey.IsRequired(out bool outrequiredSavingDescriptionTypeKey)
.Select_SavingDescriptionTypeKey.SelectByValue(testData.SelectSavingDescription)
.WaitForLoadingSpinner()
.Select_SavingTypeKey.IsRequired(out bool outrequiredSavingTypeKey)
.dt_StartDate.IsRequired(out bool outrequiredStartDate)
.dt_EndDate.IsRequired(out bool outrequiredEndDate)
.txt_AvoidedItem.IsRequired(out bool outrequiredAvoidedItem)
.txt_Provider_NotInTable.IsRequired(out bool outrequiredProviderNotInTable)
.txt_OriginalProviderId.IsRequired(out bool outrequiredProviderfromProvidertable)
.txt_OriginalDailyRate.IsRequired(out bool outrequiredOriginalDailyRate)
.txt_OriginalFrequency.IsRequired(out bool outrequiredOriginalFrequency)
.txt_OriginalUnit.IsRequired(out bool outrequiredOriginalUnit)
.txt_NewRate.IsRequired(out bool outrequiredNewRate)
.txt_NewUnit.IsRequired(out bool outrequiredNewUnit)
.txt_NewFrequency.IsRequired(out bool outrequiredNewFrequency)
.txt_RequestedQuantity.IsEnabled(out bool requiredRequestedQuantityIsEnabled)
.txt_EstimatedDays.IsEnabled(out bool estimatedDaysIsEnabled)
.txt_NewCost.IsEnabled(out bool newCostIsEnabled)
.txt_NewServiceCost.IsEnabled(out bool newServiceCostIsEnabled)
.txt_NewPerUnitRate.IsEnabled(out bool newPerUnitRateIsEnabled);
Assert.Multiple(() =>
{
Assert.IsTrue(requiredRequestedQuantityIsEnabled, "required Requested Quantity Is disabled");
Assert.IsTrue(estimatedDaysIsEnabled, "estimated Days Is disabled");
Assert.IsTrue(newCostIsEnabled, "newCost Is disabled");
Assert.IsTrue(newServiceCostIsEnabled, "new Service Cost Is disabled");
Assert.IsTrue(newPerUnitRateIsEnabled, "new Per Unit Rate Is disabled");
Assert.AreEqual(EnableSavingDescriptionTypeKey, true, "Drop Dwon SavingDescriptionType has not Display");
Assert.AreEqual(outrequiredSavingDescriptionTypeKey, true, "SavingDescriptionType has not Required Field");
Assert.AreEqual(outrequiredSavingTypeKey, true, "SavingTypeKey has not Required Field");
Assert.AreEqual(outrequiredStartDate, true, "StartDate has not Required Field");
Assert.AreEqual(outrequiredEndDate, true, "EndDate has not Required Field");
Assert.AreEqual(outrequiredAvoidedItem, true, "AvoidedItem has not Required Field");
Assert.AreEqual(outrequiredProviderNotInTable, true, "Provider Not in table has not Required Field");
Assert.AreEqual(outrequiredProviderfromProvidertable, true, "Provider from Providertable has not Required Field");
Assert.AreEqual(outrequiredOriginalDailyRate, true, "Original Daily Rate has not Required Field");
Assert.AreEqual(outrequiredNewRate, true, "New Rate has not Required Field");
//Assert.AreEqual(outrequiredNewUnit, true, "New Unit has not Required Field");
Assert.AreEqual(outrequiredNewFrequency, true, "New Frequency has not Required Field");
});
SavingDetail
.Initialize(this.driver)
.dt_StartDate.SetDate(DateTime.Now)
.dt_EndDate.SetDate(DateTime.Now)
.txt_ServiceOrAvoidedItem.SetText(testData.AvoidedItem)
.txt_OriginalDailyRate.SetText(testData.OriginalDailyRate)
.txt_OriginalFrequency.SetText(testData.OriginalFrequency)
.txt_OriginalUnit.SetText(testData.OriginalUnit)
.txt_NewRate.SetText(testData.NewRate)
.txt_NewUnit.SetText(testData.NewUnit)
.txt_NewFrequency.SetText(testData.NewFrequency)
.txt_AllowedAmount.SetText(testData.AllowedAmount)
.txt_BilledAmountt.SetText(testData.BilledAmount)
.txt_DeniedAmount.SetText(testData.DeniedAmount)
.txt_Savings.SetText(testData.Savings)
.txt_SavingAmount.GetText(out string outSavingAmount)
.txt_Type_OF_Saving.SetText(testData.TypeofSavings)
.getOriginalCost(out string outOriginalCost)
.getNewCost(out string outNewCost)
.btn_ProviderSearch.Click();
ProviderSearchDialog
.Initialize(this.driver)
.txt_ProviderId.SetText(testData.providerId)
.btn_Search.Click()
.WaitForLoadingSpinner(5)
.Link.ClickLinkbyText(testData.providerName);
Assert.Multiple(() =>
{
Assert.NotNull(outSavingAmount, "Total Saving is not Auto populated");
Assert.NotNull(outNewCost, "NewCost is not Auto populated");
Assert.NotNull(outOriginalCost, "OriginalCost is not Auto populated");
});
SavingDetail
.Initialize(this.driver)
.validateIfSavedSuccesfully()
.validateIfSavedSuccesfully()
.Refresh()
.WaitForLoadingSpinner()
.Select_SavingTypeKey.GetText(out string outSavingTypeAfterRefresh)
.Select_SavingDescriptionTypeKey.GetText(out string outSavingDescriptionAfterRefresh)
.dt_StartDate.GetDate(out DateTime outStartDateAfterRefresh)
.dt_EndDate.GetDate(out DateTime outEndDateAfterRefresh)
.txt_OriginalDailyRate.GetText(out string outOriginalDailyRateAfterRefresh)
.txt_NewRate.GetText(out string outNewRateAfterRefresh)
.txt_NewUnit.GetText(out string outNewUnitAfterRefresh)
.txt_NewFrequency.GetText(out string outNewFrequencyAfterRefresh)
.txt_AllowedAmount.GetText(out string outAllowedAmountAfterRefresh)
.txt_BilledAmountt.GetText(out string outBilledAmounttAfterRefresh)
.txt_DeniedAmount.GetText(out string outDeniedAmountAfterRefresh)
.txt_Provider_NotInTable.IsRequired(out bool IsnotProviderNotInTable)
.btn_Back_Click();
SavingType = outSavingTypeAfterRefresh;
Assert.Multiple(() =>
{
Assert.AreEqual(outOriginalDailyRateAfterRefresh, "$" + testData.OriginalDailyRate, "OriginalDailyRate is Truncated");
Assert.AreEqual(outNewRateAfterRefresh, "$" + testData.NewRate, "NewRate is Truncated");
Assert.AreEqual(outNewUnitAfterRefresh, "$" + testData.NewUnit, "NewUnit is Truncated");
Assert.AreEqual(outNewFrequencyAfterRefresh, testData.NewFrequency, "NewFrequency is Truncated");
Assert.AreEqual(outAllowedAmountAfterRefresh, "$" + testData.AllowedAmount, "AllowedAmount is Truncated");
Assert.AreEqual(outBilledAmounttAfterRefresh, "$" + testData.BilledAmount, "BilledAmount is Truncated");
Assert.AreEqual(outDeniedAmountAfterRefresh, "$" + testData.DeniedAmount, "DeniedAmount is Truncated");
Assert.IsFalse(IsnotProviderNotInTable, "Required ProviderNot InTable fields is still Required");
});
SavingSummary
.Initialize(this.driver)
.btn_TableView_Click()
.tbl_SavingSummayTable.GetRowCount(out int AfterrecordCount)
.tbl_SavingSummayTable.GetRowByValueInFirstColumn(outSavingTypeAfterRefresh, out Dictionary<string, string> rowData);
Assert.Multiple(() =>
{
Assert.AreEqual(BeforerecordCount, AfterrecordCount - 1, "Record is not added");
Assert.That(rowData["Savings Type"], Is.EqualTo(outSavingTypeAfterRefresh), "Savings Type should be added");
Assert.That(rowData["Savings Description"], Is.EqualTo(outSavingDescriptionAfterRefresh), "Savings Description should be added");
Assert.That(rowData["Total Savings"], Is.EqualTo(outSavingAmount),"Total Savings should be autopopulated");
Assert.That(Convert.ToDateTime(rowData["Start Date of Savings"]).ToString("MMM dd, yyyy"), Is.EqualTo(outStartDateAfterRefresh.Date.ToString("MMM dd, yyyy")));
Assert.That(Convert.ToDateTime(rowData["End Date of Savings"]).ToString("MMM dd, yyyy"), Is.EqualTo(outStartDateAfterRefresh.Date.ToString("MMM dd, yyyy")));
});
SavingSummary
.Initialize(this.driver)
.btn_TableView_Click()
.tbl_SavingSummayTable.OpenFirstRecord();
SavingDetail
.Initialize(this.driver)
.txt_OriginalDailyRate.GetText(out string outOriginalDailyRateAfterReopen)
.txt_NewRate.GetText(out string outNewRateAfterReopen)
.txt_NewUnit.GetText(out string outNewUnitAfterReopen)
.btn_Back_Click();
SavingSummary
.Initialize(this.driver)
.btn_CardView_Click()
.Card.GetLabels(outSavingTypeAfterRefresh, out List<string> actualLabels)
.Card.GetLabelsAndValues(outSavingTypeAfterRefresh, out Dictionary<string, string> labels);
Assert.Multiple(() =>
{
Assert.That(outOriginalDailyRateAfterReopen, Is.EqualTo("$" + testData.OriginalDailyRate), "380180 - Data (OriginalDailyRate) should be Retained after Refreshing the Record");
Assert.That(outNewRateAfterReopen, Is.EqualTo("$" + testData.NewRate), "380180 - Data(NewRate) should be Retained after Refreshing the Record");
Assert.That(outNewUnitAfterReopen, Is.EqualTo("$" + testData.NewUnit), "380180 - Data (NewUnit) should be Retained after Reopening the Record");
Assert.That(actualLabels, Is.EquivalentTo(expectedLabels), "Expected Card View labels do not match actual!!!");
Assert.AreEqual(labels["Total Savings"], outSavingAmount, "Saving Amount values are not same");
Assert.That(labels["Start Date of Savings"], Is.EqualTo(DateTime.Now.Date.ToString("M'/'d'/'yy")), "Start Date values are not same");
Assert.That(labels["End Date of Savings"], Is.EqualTo(DateTime.Now.Date.ToString("M'/'d'/'yy")), "End Date values are not same");
});
}
[Category(CategoryAttributes.ClientLevel.Gateway)]
[Test, Name("Edit Savings with Expense Management and Negotiation of Price"),
Description("Edit Saving with Expense Management and Negotiation of Price"), Order(2), TestCaseId("380181,380182,380150")]
public void TS02_ValidateEdit_WithExpenseManagementandNegotiationofPrice()
{
var testData = new
{
selectExpenseManagement = "E",
SelectSavingDescription = "NP",
ProviderNotInTable = "Provider",
OriginalDailyRate = "11",
OriginalFrequency = "3",
OriginalUnit = "9",
AvoidedItem = "11",
NewUnit = "2",
NewRate = "8",
NewFrequency = "5",
Savings = "100"
};
SavingSummary
.Initialize(this.driver)
.btn_TableView_Click()
.tbl_SavingSummayTable.GetRowCount(out int BeforerecordCount)
.tbl_SavingSummayTable.GetRowByValueInFirstColumn(SavingType, out Dictionary<string, string> BeforerowData)
.Link.ClickLinkbyText(SavingType);
SavingDetail
.Initialize(this.driver)
.Select_SavingTypeKey.SelectByValue(testData.selectExpenseManagement)
.Select_SavingDescriptionTypeKey.SelectByValue(testData.SelectSavingDescription)
.dt_StartDate.SetDate(DateTime.Now)
.dt_EndDate.SetDate(DateTime.Now)
.dt_EndDate.SetDate(DateTime.Now.AddDays(-1))
.dt_EndDate.GetValidationErrorMessage(out string outErrorValidate)
.dt_EndDate.SetDate(DateTime.Now)
.Select_ProgramTypeKey.SelectByIndex(4)
.Select_ProgramSubProgramTypeKey.IsEnabled(out bool outSubProgramType)
.Select_ProgramSubProgramTypeKey.SelectByIndex(1)
.txt_ServiceOrAvoidedItem.SetText(testData.AvoidedItem)
.txt_OriginalDailyRate.SetText(testData.OriginalDailyRate)
.txt_OriginalFrequency.SetText(testData.OriginalFrequency)
.txt_OriginalUnit.SetText(testData.OriginalUnit)
.txt_NewRate.SetText(testData.NewRate)
.txt_NewUnit.SetText(testData.NewUnit)
.txt_NewFrequency.SetText(testData.NewFrequency)
.txt_Savings.SetText(testData.Savings)
.validateIfSavedSuccesfully();
SavingDetail
.Initialize(this.driver)
.Select_SavingTypeKey.GetText(out string outSavingType)
.Select_SavingDescriptionTypeKey.GetText(out string outSavingDescription)
.txt_SavingAmount.GetText(out string outSavingAmount)
.dt_StartDate.GetDate(out DateTime outStartDate)
.dt_EndDate.GetDate(out DateTime outEndDate)
.txt_Provider_NotInTable.IsRequired(out bool NotRequiredProviderNotInTable)
.btn_Back_Click();
SavingSummary
.Initialize(this.driver)
.btn_TableView_Click()
.tbl_SavingSummayTable.GetRowCount(out int AfterrecordCount)
.tbl_SavingSummayTable.GetRowByValueInFirstColumn(outSavingType, out Dictionary<string, string> AfterrowData);
Assert.Multiple(() =>
{
Assert.AreEqual(BeforerecordCount, AfterrecordCount, "Edit record is not Working");
Assert.AreNotEqual(BeforerowData, AfterrowData, "Edit record is not Working");
Assert.IsFalse(outErrorValidate.Contains("Need to be after"), "End Date Validate Fails");
Assert.IsTrue(outSubProgramType, "SubProgram should be enabled");
Assert.That(AfterrowData["Savings Type"], Is.EqualTo(outSavingType), "Savings Type should be Edited");
Assert.That(AfterrowData["Savings Description"], Is.EqualTo(outSavingDescription), "Savings Description should be Edited");
Assert.That(AfterrowData["Total Savings"], Is.EqualTo(outSavingAmount), "Total Savings should be auto populated");
Assert.That(Convert.ToDateTime(AfterrowData["Start Date of Savings"]).ToString("MMM dd, yyyy"), Is.EqualTo(outStartDate.Date.ToString("MMM dd, yyyy")));
Assert.That(Convert.ToDateTime(AfterrowData["End Date of Savings"]).ToString("MMM dd, yyyy"), Is.EqualTo(outStartDate.Date.ToString("MMM dd, yyyy")));
});
}
[Test, Name("Edit Savings with Expense Management and Negotiation of Price"), Description("Edit Saving with Expense Management and Negotiation of Price"), Order(3), TestCaseId("372442")]
public void TS03_ValidateEdit_CancelSaving()
{
var testData = new
{
selectExpenseManagement = "E",
SelectSavingDescription = "NP",
NewRate = "3",
};
SavingSummary
.Initialize(this.driver)
.btn_TableView_Click()
.tbl_SavingSummayTable.GetRowCount(out int BeforerecordCount)
.tbl_SavingSummayTable.GetRowByValueInFirstColumn(SavingType, out Dictionary<string, string> BeforerowData)
.Link.ClickLinkbyText(SavingType);
SavingDetail
.Initialize(this.driver)
.Select_SavingTypeKey.SelectByValue(testData.selectExpenseManagement)
.Select_SavingDescriptionTypeKey.SelectByValue(testData.SelectSavingDescription)
.txt_NewRate.SetText(testData.NewRate)
.btn_Back_Click()
.continueWithoutSavingIfDisplayed();
SavingSummary
.Initialize(this.driver)
.btn_TableView_Click()
.tbl_SavingSummayTable.GetRowCount(out int AfterrecordCount)
.tbl_SavingSummayTable.GetRowByValueInFirstColumn(SavingType, out Dictionary<string, string> AfterrowData);
Assert.Multiple(() =>
{
Assert.AreEqual(BeforerecordCount, AfterrecordCount, "Edit record is not Working");
Assert.AreEqual(BeforerowData, AfterrowData, "Edit record is not Working");
});
}
[Test, Name("Copy Savings with Expense Management and Negotiation of Price"), Description("Copy Saving with Expense Management and Negotiation of Price"), Order(4), TestCaseId("380183")]
public void TS04_ValidateCopy_WithExpenseManagementandNegotiationofPrice()
{
SavingSummary
.Initialize(this.driver)
.btn_TableView_Click()
.tbl_SavingSummayTable.GetRowCount(out int BeforerecordCount);
if (BeforerecordCount == 0)
{
apiClass.Post_AddNewSavings(this.EnvironmentData.Member.MemberUrlGuid, ref Savings_Model);
driver.GoToURL(this.SavingsSummaryURL);
}
SavingSummary
.Initialize(this.driver)
.btn_TableView_Click()
.tbl_SavingSummayTable.GetRowCount(out int RecordCountBeforeCopy)
.tbl_SavingSummayTable.OpenFirstRecord();
SavingDetail
.Initialize(this.driver)
.btn_MoreOptions_Click()
.btn_CopyFromMoreOption_Click()
.validateIfSavedSuccesfully()
.btn_Back_Click();
SavingSummary
.Initialize(this.driver)
.btn_TableView_Click()
.tbl_SavingSummayTable.GetRowCount(out int RecordCountAfterCopy);
Assert.Multiple(() =>
{
Assert.AreEqual(RecordCountAfterCopy, RecordCountBeforeCopy + 1, "Record added after Copy");
});
}
[Test, Name("Send Task"), Description("Send Task"), Order(5), TestCaseId("380195")]
public void TS05_SendTaskFromPage()
{
string TaskMessage = "TaskFromSavingList" + StaticUtilites.generateRandomString(5);
SavingSummary
.Initialize(this.driver)
.btn_TableView_Click()
.tbl_SavingSummayTable.GetRowCount(out int BeforerecordCount);
if (BeforerecordCount == 0)
{
apiClass.Post_AddNewSavings(this.EnvironmentData.Member.MemberUrlGuid, ref Savings_Model);
driver.GoToURL(this.SavingsSummaryURL);
}
SavingSummary
.Initialize(this.driver)
.tbl_SavingSummayTable.OpenFirstRecord();
SavingDetail
.Initialize(this.driver)
.WaitForPageLoad(3);
SendNewTaskPage
.Init(this.driver)
.SendTask(this.ProjectPropertiesData, TaskMessage);
}
[Test, Name("Send Notification"), Description("Send Notification"), Order(6), TestCaseId("380196")]
public void TS06_SendNotificationFromPage()
{
string NotificationMessage = "NotificationFromSaving";
driver.GoToURL(this.SavingsSummaryURL);
SavingSummary
.Initialize(this.driver)
.btn_TableView_Click()
.tbl_SavingSummayTable.GetRowCount(out int BeforerecordCount);
if (BeforerecordCount == 0)
{
apiClass.Post_AddNewSavings(this.EnvironmentData.Member.MemberUrlGuid, ref Savings_Model);
driver.GoToURL(this.SavingsSummaryURL);
}
SavingSummary
.Initialize(this.driver)
.tbl_SavingSummayTable.OpenFirstRecord();
SendNotificationPage
.Init(this.driver)
.SendNotification(this.EnvironmentData, NotificationMessage);
}
[Test, Name("Validate page resources history"), Description("validate if page resources history are displayed"), Order(7),
TestCaseId("375668,375666")]
public void TS07_ValidatePRHistory()
{
driver.GoToURL(this.SavingsSummaryURL);
SavingSummary
.Initialize(this.driver)
.btn_TableView_Click()
.tbl_SavingSummayTable.GetRowCount(out int BeforerecordCount);
if (BeforerecordCount == 0)
{
apiClass.Post_AddNewSavings(this.EnvironmentData.Member.MemberUrlGuid, ref Savings_Model);
driver.GoToURL(this.SavingsSummaryURL);
}
SavingSummary
.Initialize(this.driver)
.tbl_SavingSummayTable.OpenFirstRecord();
PageResources
.Init(this.driver)
.OpenPageResources();
PageResources
.Init(driver)
.lbl_DetailHistory_Exists(out bool detailHistory)
.lbl_CreatedByValue_GetText(out string createdBy)
.lbl_CreatedOnValue_GetText(out string createdOn)
.lbl_UpdatedByValue_GetText(out string updatedBy)
.lbl_UpdatedOnValue_GetText(out string updatedOn);
Assert.That(detailHistory, Is.EqualTo(true));
Assert.That(createdBy == this.EnvironmentData.UserFullName);
Assert.That(!string.IsNullOrEmpty(createdOn));
Assert.That(updatedBy == this.EnvironmentData.UserFullName);
Assert.That(!string.IsNullOrEmpty(updatedOn));
PageResources
.Init(this.driver)
.WaitForLoadingSpinner()
.validateIftxtWebReferancesLabelDisplayed();
PageResources
.Init(this.driver)
.lnk_AllHistory_CLick();
PageHistoryDialog
.Init(this.driver)
.tbl_GetHistoryRowCount(out int RowCount1)
.closeFormIfOpened();
SavingDetail
.Initialize(this.driver)
.Select_SavingServiceTypeKey.SelectByIndex(1)
.validateIfSavedSuccesfully();
PageResources
.Init(this.driver)
.WaitForSeconds(1)
.lnk_AllHistory_CLick();
PageHistoryDialog
.Init(this.driver)
.WaitForSeconds(1)
.tbl_GetHistoryRowCount(out int RowCount2);
Assert.That(RowCount2, Is.EqualTo(RowCount1 + 1), "Record should have 2 row of History!!!");
}
[Test, Name("Add Savings with Treatment Management and Change in Level of Care"), Description("Add Saving with Type=Treatment Management and Description =Change in Level of Care"), Order(8),
TestCaseId("380152,372441")]
public void TS08_ValidateAdd_WithTreatmentManagementandChangeinLevelOfCare()
{
var testData = new
{
selectTreatmentType = "T",
SelectSavingDescription = "CLC",
selectChangeinLevelOfCare = "CLC",
selectOriginalLevelOfCare = "ICU",
selectNewLevelOfCare = "DT",
inputOriginalDailyRate = "10",
inputNewDailyRate = "6"
};
driver.GoToURL(this.SavingsSummaryURL);
SavingSummary
.Initialize(this.driver)
.btn_TableView_Click()
.tbl_SavingSummayTable.GetRowCount(out int BeforerecordCount)
.btn_AddNewSavings.Click();
SavingDetail
.Initialize(this.driver)
.Select_SavingTypeKey.SelectByValue(testData.selectTreatmentType)
.Select_SavingDescriptionTypeKey.SelectByValue(testData.SelectSavingDescription)
.WaitForLoadingSpinner()
.Select_OriginalSavingCareLevelTypeKey.IsRequired(out bool outrequiredOriginalSavingCareLevelTypeKey)
.Select_NewCareLevelTypeKey.IsRequired(out bool outrequiredNewCareLevelTypeKey)
.txt_OriginalDailyRate.IsRequired(out bool outrequiredOriginalDailyRate)
.txt_NewDailyRate.IsRequired(out bool outrequiredNewDailyRate);
Assert.Multiple(() =>
{
Assert.AreEqual(outrequiredOriginalSavingCareLevelTypeKey, true, "OriginalSavingCareLevelTypeKey has not Required Field");
Assert.AreEqual(outrequiredNewCareLevelTypeKey, true, "NewCareLevelTypeKey has not Required Field");
Assert.AreEqual(outrequiredOriginalDailyRate, true, "OriginalDailyRate has not Required Field");
Assert.AreEqual(outrequiredNewDailyRate, true, "NewDailyRate has not Required Field");
});
SavingDetail
.Initialize(this.driver)
.dt_StartDate.SetDate(DateTime.Now)
.dt_EndDate.SetDate(DateTime.Now)
.Select_OriginalSavingCareLevelTypeKey.SelectByValue(testData.selectOriginalLevelOfCare)
.Select_NewCareLevelTypeKey.SelectByValue(testData.selectNewLevelOfCare)
.txt_OriginalDailyRate.SetText(testData.inputOriginalDailyRate)
.txt_NewDailyRate.SetText(testData.inputNewDailyRate)
.btn_Back_Click()
.btn_GoBackForm_Click()
.Select_SavingTypeKey.IsEnabled(out bool outGobackForm)
.validateIfSavedSuccesfully();
SavingDetail
.Initialize(this.driver)
.Select_SavingTypeKey.GetText(out string outSavingType)
.Select_SavingDescriptionTypeKey.GetText(out string outSavingDescription)
.Select_OriginalSavingCareLevelTypeKey.GetText(out string outSavingCareLevel)
.Select_NewCareLevelTypeKey.GetText(out string outSavingNewCareLevel)
.txt_OriginalDailyRate.GetText(out string outOriginalRate)
.txt_NewDailyRate.GetText(out string outNewRate)
.txt_SavingAmount.GetText(out string outSavingAmount)
.dt_StartDate.GetDate(out DateTime outStartDate)
.dt_EndDate.GetDate(out DateTime outEndDate)
.btn_Back_Click();
SavingSummary
.Initialize(this.driver)
.btn_TableView_Click()
.tbl_SavingSummayTable.GetRowCount(out int AfterrecordCount)
.tbl_SavingSummayTable.GetRowByUniqueColumnValue("Savings Description",outSavingDescription, out Dictionary<string, string> rowData);
Assert.Multiple(() =>
{
Assert.AreEqual(BeforerecordCount, AfterrecordCount - 1, "Record is not added");
Assert.IsTrue(outGobackForm, "Go Back Form is not Working");
Assert.That(rowData["Savings Type"], Is.EqualTo(outSavingType));
Assert.That(rowData["Savings Description"], Is.EqualTo(outSavingDescription));
Assert.That(rowData["Total Savings"], Is.EqualTo(outSavingAmount));
Assert.That(Convert.ToDateTime(rowData["Start Date of Savings"]).ToString("MMM dd, yyyy"), Is.EqualTo(outStartDate.Date.ToString("MMM dd, yyyy")));
Assert.That(Convert.ToDateTime(rowData["End Date of Savings"]).ToString("MMM dd, yyyy"), Is.EqualTo(outStartDate.Date.ToString("MMM dd, yyyy")));
});
}
[Test, Name("Add Savings with Treatment Management and ChangeinFrequencyofService"), Description("Add Saving with Type=Treatment Management and Description =ChangeinFrequencyofService"), Order(9),
TestCaseId("380158")]
public void TS09_ValidateAdd_WithTreatmentManagementandChangeinFrequencyofService()
{
var testData = new
{
selectTreatmentType = "T",
SelectSavingDescription = "CFS",
inputNewFrequency = "10",
inputNewDailyRate = "16",
inputNewUnit = "2",
savings="100"
};
List<string> expectedLabels = new List<string>
{
"Total Savings", "Start Date of Savings", "End Date of Savings"
};
driver.GoToURL(this.SavingsSummaryURL);
SavingSummary
.Initialize(this.driver)
.btn_TableView_Click()
.tbl_SavingSummayTable.GetRowCount(out int BeforerecordCount)
.btn_AddNewSavings.Click();
SavingDetail
.Initialize(this.driver)
.Select_SavingTypeKey.SelectByValue(testData.selectTreatmentType)
.WaitForLoadingSpinner()
.Select_SavingDescriptionTypeKey.IsEnabled(out bool EnableSavingDescriptionTypeKey)
.Select_SavingDescriptionTypeKey.SelectByValue(testData.SelectSavingDescription)
.WaitForLoadingSpinner()
.Select_SavingDescriptionTypeKey.IsRequired(out bool outrequiredSavingDescriptionTypeKey)
.Select_SavingTypeKey.IsRequired(out bool outrequiredSavingTypeKey)
.dt_StartDate.IsRequired(out bool outrequiredStartDate)
.dt_EndDate.IsRequired(out bool outrequiredEndDate)
.Select_SavingServiceTypeKey.IsRequired(out bool outrequiredSelect_SavingServiceTypeKey)
.txt_NewRate.IsRequired(out bool outrequiredNewRate)
.txt_NewFrequency.IsRequired(out bool outNewFrequency)
.txt_NewUnit.IsRequired(out bool outNewUnit);
Assert.Multiple(() =>
{
Assert.AreEqual(EnableSavingDescriptionTypeKey, true, "Drop Down SavingDescriptionType has not Display");
Assert.AreEqual(outrequiredSavingDescriptionTypeKey, true, "SavingDescriptionType has not Required Field");
Assert.AreEqual(outrequiredSavingTypeKey, true, "SavingTypeKey has not Required Field");
Assert.AreEqual(outrequiredStartDate, true, "StartDate has not Required Field");
Assert.AreEqual(outrequiredEndDate, true, "EndDate has not Required Field");
Assert.AreEqual(outrequiredSelect_SavingServiceTypeKey, true, "OriginalSavingCareLevelTypeKey has not Required Field");
Assert.AreEqual(outrequiredNewRate, true, "New Rate has not Required Field");
Assert.AreEqual(outNewFrequency, true, "NewFrequency has not Required Field");
//Assert.AreEqual(outNewUnit, true, "NewUnit has not Required Field");
});
SavingDetail
.Initialize(this.driver)
.dt_StartDate.SetDate(DateTime.Now)
.dt_EndDate.SetDate(DateTime.Now)
.Select_SavingServiceTypeKey.SelectByIndex(1)
.txt_NewFrequency.SetText(testData.inputNewFrequency)
.txt_NewRate.SetText(testData.inputNewDailyRate)
.txt_NewUnit.SetText(testData.inputNewUnit)
.txt_Savings.SetText(testData.savings)
.validateIfSavedSuccesfully();
SavingDetail
.Initialize(this.driver)
.Select_SavingTypeKey.GetText(out string outSavingType)
.Select_SavingDescriptionTypeKey.GetText(out string outSavingDescription)
.txt_SavingAmount.GetText(out string outSavingAmount)
.dt_StartDate.GetDate(out DateTime outStartDate)
.dt_EndDate.GetDate(out DateTime outEndDate)
.btn_Back_Click();
SavingSummary
.Initialize(this.driver)
.btn_TableView_Click()
.tbl_SavingSummayTable.GetRowCount(out int AfterrecordCount)
.tbl_SavingSummayTable.GetRowByUniqueColumnValue("Savings Description", outSavingDescription, out Dictionary<string, string> rowData);
Assert.Multiple(() =>
{
Assert.AreEqual(BeforerecordCount, AfterrecordCount - 1, "Record is not added");
Assert.That(rowData["Savings Type"], Is.EqualTo(outSavingType),"Savings Type should be added");
Assert.That(rowData["Savings Description"], Is.EqualTo(outSavingDescription), "Savings Description should be added");
Assert.That(rowData["Total Savings"], Is.EqualTo(outSavingAmount), "Total Savings should be added");
Assert.That(Convert.ToDateTime(rowData["Start Date of Savings"]).ToString("MMM dd, yyyy"), Is.EqualTo(outStartDate.Date.ToString("MMM dd, yyyy")));
Assert.That(Convert.ToDateTime(rowData["End Date of Savings"]).ToString("MMM dd, yyyy"), Is.EqualTo(outStartDate.Date.ToString("MMM dd, yyyy")));
});
SavingSummary
.Initialize(this.driver)
.btn_CardView_Click()
.Card.GetLabels(outSavingType, out List<string> actualLabels)
.Card.GetLabelsAndValues(outSavingType, out Dictionary<string, string> labels);
Assert.Multiple(() =>
{
Assert.That(actualLabels, Is.EquivalentTo(expectedLabels), "Expected Card View labels do not match actual!!!");
Assert.AreEqual(labels["Total Savings"], outSavingAmount, "Saving Amount values are not same");
Assert.That(labels["Start Date of Savings"], Is.EqualTo(DateTime.Now.Date.ToString("M'/'d'/'yy")), "Start Date values are not same");
Assert.That(labels["End Date of Savings"], Is.EqualTo(DateTime.Now.Date.ToString("M'/'d'/'yy")), "End Date values are not same");
});
}
[Test, Name("Add Savings with Expense Management and Avoidance Of Unnecessary Item"), Order(10), TestCaseId("380156")]
public void TS10_ValidateAdd_WithExpenseManagementandAvoidanceOfUnnecessaryItem()
{
var testData = new
{
selectExpenseManagement = "E",
selectSavingDescription = "AUI",
inputAvoidedItem = "10",
inputSaving = "6"
};
driver.GoToURL(this.SavingsSummaryURL);
SavingSummary
.Initialize(this.driver)
.btn_TableView_Click()
.tbl_SavingSummayTable.GetRowCount(out int BeforerecordCount)
.btn_AddNewSavings.Click();
SavingDetail
.Initialize(this.driver)
.Select_SavingTypeKey.SelectByValue(testData.selectExpenseManagement)
.Select_SavingDescriptionTypeKey.SelectByValue(testData.selectSavingDescription)
.WaitForLoadingSpinner()
.txt_AvoidedItem.IsRequired(out bool outrequiredAvoidedItem)
.txt_Savings.IsRequired(out bool outrequiredSavings);
Assert.Multiple(() =>
{
Assert.AreEqual(outrequiredAvoidedItem, true, "AvoidedItem has not Required Field");
Assert.AreEqual(outrequiredSavings, true, "Savings has not Required Field");
});
SavingDetail
.Initialize(this.driver)
.dt_StartDate.SetDate(DateTime.Now)
.dt_EndDate.SetDate(DateTime.Now)
.txt_AvoidedItem.SetText(testData.inputAvoidedItem)
.txt_Savings.SetText(testData.inputSaving)
.validateIfSavedSuccesfully();
SavingDetail
.Initialize(this.driver)
.Select_SavingTypeKey.GetText(out string outSavingType)
.Select_SavingDescriptionTypeKey.GetText(out string outSavingDescription)
.txt_SavingAmount.GetText(out string outSavingAmount)
.dt_StartDate.GetDate(out DateTime outStartDate)
.dt_EndDate.GetDate(out DateTime outEndDate)
.btn_Back_Click();
SavingSummary
.Initialize(this.driver)
.btn_TableView_Click()
.tbl_SavingSummayTable.GetRowCount(out int AfterrecordCount)
.tbl_SavingSummayTable.GetRowByUniqueColumnValue("Savings Description", outSavingDescription, out Dictionary<string, string> rowData);
SavingType = outSavingType;
Assert.Multiple(() =>
{
Assert.AreEqual(BeforerecordCount, AfterrecordCount - 1, "Record is not added");
Assert.That(rowData["Savings Type"], Is.EqualTo(outSavingType),"Savings Type should be added");
Assert.That(rowData["Savings Description"], Is.EqualTo(outSavingDescription),"Savings Description should be added");
Assert.That(rowData["Total Savings"], Is.EqualTo(outSavingAmount), "Total Savings should be autopopulated");
Assert.That(Convert.ToDateTime(rowData["Start Date of Savings"]).ToString("MMM dd, yyyy"), Is.EqualTo(outStartDate.Date.ToString("MMM dd, yyyy")));
Assert.That(Convert.ToDateTime(rowData["End Date of Savings"]).ToString("MMM dd, yyyy"), Is.EqualTo(outStartDate.Date.ToString("MMM dd, yyyy")));
});
}
[Test, Name("Add Savings with Expense Management and Identified Unwarranted Charges "),Order(11), TestCaseId("380179,380214")]
public void TS11_ValidateAdd_WithExpenseManagementandIdentifiedUnwarrantedCharges()
{
var testData = new
{
selectExpenseManagement = "E",
selectSavingDescription = "IUC",
inputSaving = "6.11",
UnwarrantedCharge = "10.56"
};
driver.GoToURL(this.SavingsSummaryURL);
SavingSummary
.Initialize(this.driver)
.btn_TableView_Click()
.tbl_SavingSummayTable.GetRowCount(out int BeforerecordCount)
.btn_AddNewSavings.Click();
SavingDetail
.Initialize(this.driver)
.Select_SavingTypeKey.SelectByValue(testData.selectExpenseManagement)
.Select_SavingDescriptionTypeKey.SelectByValue(testData.selectSavingDescription)
.WaitForLoadingSpinner()
.Select_SavingUnwarrantedChargeTypeKey.IsRequired(out bool outSavingUnwarrantedChargeTypeKey)
.txt_AmountOfUnwarrentedCharges.IsRequired(out bool outAmountOfUnwarrantedChargeIsRequired)
.txt_Savings.IsRequired(out bool outrequiredTypeofCharges)
.Select_SavingUnwarrantedChargeTypeKey.IsEnabled(out bool UnwarrantedChargeTypeIsEnabled)
.txt_AmountOfUnwarrentedCharges.IsEnabled(out bool AmountofUnwarrantedChargeIsEnabled);
Assert.Multiple(() =>
{
Assert.AreEqual(outSavingUnwarrantedChargeTypeKey, true, "SavingUnwarrantedCharge has not Required Field");
Assert.AreEqual(outrequiredTypeofCharges, true, "TypeofCharges has not Required Field");
Assert.AreEqual(outAmountOfUnwarrantedChargeIsRequired, true, "Amount of Unwarranted Charges text field has not Required Field");
Assert.AreEqual(UnwarrantedChargeTypeIsEnabled, true, "SavingUnwarrantedCharge type Should be Enabled");
Assert.AreEqual(AmountofUnwarrantedChargeIsEnabled, true, "Amount of Unwarranted Charges text field should be Enabled");
});
SavingDetail
.Initialize(this.driver)
.dt_StartDate.SetDate(DateTime.Now)
.dt_EndDate.SetDate(DateTime.Now)
.txt_Savings.SetText(testData.inputSaving)
.Select_ProgramTypeKey.SelectByIndex(2)
.Select_SavingUnwarrantedChargeTypeKey.SelectByIndex(1)
.txt_AmountOfUnwarrentedCharges.SetText(testData.UnwarrantedCharge)
.validateIfSavedSuccesfully();
SavingDetail
.Initialize(this.driver)
.Select_SavingTypeKey.GetText(out string outSavingType)
.Select_SavingDescriptionTypeKey.GetText(out string outSavingDescription)
.txt_Savings.GetText(out string outSaving)
.txt_SavingAmount.GetText(out string outSavingAmount)
.txt_AmountOfUnwarrentedCharges.GetText(out String OutUnwarrantedCharges)
.btn_Back_Click();
SavingSummary
.Initialize(this.driver)
.btn_TableView_Click()
.tbl_SavingSummayTable.GetRowCount(out int AfterrecordCount)
.tbl_SavingSummayTable.GetRowByUniqueColumnValue("Savings Description", outSavingDescription, out Dictionary<string, string> rowData);
SavingType = outSavingType;
Assert.Multiple(() =>
{
Assert.AreEqual(BeforerecordCount, AfterrecordCount - 1, "Record is not added");
Assert.That(rowData["Savings Type"], Is.EqualTo(outSavingType), "Savings Type should be added");
Assert.That(rowData["Savings Description"], Is.EqualTo(outSavingDescription), "Savings Description should be added");
Assert.That(rowData["Total Savings"], Is.EqualTo(outSavingAmount),"Total Savings should be autopopulated");
Assert.That(OutUnwarrantedCharges, Is.EqualTo("$" + testData.UnwarrantedCharge), "Amount of Unwarranted Charges shouldn't be truncated");
});
}
[Category(CategoryAttributes.ClientLevel.Gateway)]
[Test, Name("Add Savings with Other and Other"), Description("Add Saving with Other and Other"), Category("master-smoke-suite"), Order(12),
TestCaseId("380154")]
public void TS12_ValidateAdd_WithOtherandOther()
{
var testData = new
{
selectExpenseManagement = "O",
SelectSavingDescription = "OTH",
OtherDetails = "OtherTestDetails",
OtherDescription = "OthertestDescription",
OtherSavingType = "OtherSavingType",
OtherItem = "OtherItem",
AmountSaving = "10",
};
driver.GoToURL(this.SavingsSummaryURL);
SavingSummary
.Initialize(this.driver)
.btn_TableView_Click()
.tbl_SavingSummayTable.GetRowCount(out int BeforerecordCount)
.btn_AddNewSavings.Click();
SavingDetail
.Initialize(this.driver)
.Select_SavingTypeKey.SelectByValue(testData.selectExpenseManagement)
.WaitForLoadingSpinner()
.Select_SavingDescriptionTypeKey.IsEnabled(out bool EnableSavingDescriptionTypeKey)
.Select_SavingDescriptionTypeKey.IsRequired(out bool outrequiredSavingDescriptionTypeKey)
.Select_SavingDescriptionTypeKey.SelectByValue(testData.SelectSavingDescription)
.WaitForLoadingSpinner()
.txt_OtherSavingDescription.IsEnabled(out bool EnableSavingOtherDescriptionTypeKey)
.Select_SavingTypeKey.IsRequired(out bool outrequiredSavingTypeKey)
.dt_StartDate.IsRequired(out bool outrequiredStartDate)
.dt_EndDate.IsRequired(out bool outrequiredEndDate)
.txt_OtherSavingDescription.IsRequired(out bool outrequiredSavingDescription)
.txt_OtherSavingType.IsRequired(out bool outrequiredSavingType)
.txt_OtherItem.IsRequired(out bool outrequiredOtherItem)
.txt_Savings.IsRequired(out bool outrequiredAmountSaved);
Assert.Multiple(() =>
{
Assert.AreEqual(EnableSavingDescriptionTypeKey, true, "Drop Dwon SavingDescriptionType has not Display");
Assert.AreEqual(EnableSavingOtherDescriptionTypeKey, true, "Other Description should be Enabled");
Assert.AreEqual(outrequiredSavingDescriptionTypeKey, true, "SavingDescriptionType has not Required Field");
Assert.AreEqual(outrequiredSavingTypeKey, true, "SavingTypeKey has not Required Field");
Assert.AreEqual(outrequiredStartDate, true, "StartDate has not Required Field");
Assert.AreEqual(outrequiredEndDate, true, "EndDate has not Required Field");
});
SavingDetail
.Initialize(this.driver)
.dt_StartDate.SetDate(DateTime.Now)
.dt_EndDate.SetDate(DateTime.Now)
.txt_OtherSavingDescription.SetText(testData.OtherDescription)
.txt_OtherSavingType.SetText(testData.OtherSavingType)
.txt_OtherItem.SetText(testData.OtherItem)
.txt_Savings.SetText(testData.AmountSaving)
.validateIfSavedSuccesfully();
SavingDetail
.Initialize(this.driver)
.Select_SavingTypeKey.GetText(out string outSavingType)
.Select_SavingDescriptionTypeKey.GetText(out string outSavingDescription)
.txt_Savings.GetText(out string outSaving)
.txt_SavingAmount.GetText(out string outSavingAmount)
.dt_StartDate.GetDate(out DateTime outStartDate)
.dt_EndDate.GetDate(out DateTime outEndDate)
.btn_Back_Click();
SavingSummary
.Initialize(this.driver)
.btn_TableView_Click()
.tbl_SavingSummayTable.GetRowCount(out int AfterrecordCount)
.tbl_SavingSummayTable.GetRowByUniqueColumnValue("Savings Description", outSavingDescription, out Dictionary<string, string> rowData);
Assert.Multiple(() =>
{
Assert.AreEqual(BeforerecordCount, AfterrecordCount - 1, "Record is not added");
Assert.That(rowData["Savings Type"], Is.EqualTo(outSavingType), "Savings Type should be added");
Assert.That(rowData["Savings Description"], Is.EqualTo(outSavingDescription), "Savings Description should be added");
Assert.That(rowData["Total Savings"], Is.EqualTo(outSavingAmount), "Total Savings should be Autopopulated");
Assert.That(Convert.ToDateTime(rowData["Start Date of Savings"]).ToString("MMM dd, yyyy"), Is.EqualTo(outStartDate.Date.ToString("MMM dd, yyyy")));
Assert.That(Convert.ToDateTime(rowData["End Date of Savings"]).ToString("MMM dd, yyyy"), Is.EqualTo(outStartDate.Date.ToString("MMM dd, yyyy")));
});
}
[Test, Name("Add Savings with Expense Management and Other"), Description("Add Saving with Type=Expense Management and Description =Other"), Order(13),
TestCaseId("380176")]
public void TS13_ValidateAdd_WithExpenseManagementandOthers()
{
var testData = new
{
selectTreatmentType = "E",
SelectSavingDescription = "OTH",
};
driver.GoToURL(this.SavingsSummaryURL);
SavingSummary
.Initialize(this.driver)
.btn_TableView_Click()
.tbl_SavingSummayTable.GetRowCount(out int BeforerecordCount)
.btn_AddNewSavings.Click();
SavingDetail
.Initialize(this.driver)
.Select_SavingTypeKey.SelectByValue(testData.selectTreatmentType)
.WaitForLoadingSpinner()
.Select_SavingDescriptionTypeKey.IsRequired(out bool outSavingDescrType)
.Select_SavingDescriptionTypeKey.SelectByValue(testData.SelectSavingDescription)
.WaitForLoadingSpinner()
.txt_OtherItem.IsRequired(out bool outrequiredSavingTypeKey)
.txt_Savings.IsRequired(out bool outSavings)
.txt_Type_OF_Saving.IsRequired(out bool outTypeSavings)
.txt_AmountSaved.IsRequired(out bool outAmountSaved);
Assert.Multiple(() =>
{
Assert.AreEqual(outSavings, true, "outSavings has not Required Field");
Assert.AreEqual(outSavingDescrType, true, "SavingDescription has not Required Field");
Assert.AreEqual(outTypeSavings, true, "Type of Saving has not Required Field");
Assert.AreEqual(outAmountSaved, true, "Amount Saved has not Required Field");
});
SavingDetail
.Initialize(this.driver)
.dt_StartDate.SetDate(DateTime.Now)
.dt_EndDate.SetDate(DateTime.Now)
.txt_OtherItem.SetText("10")
.txt_Savings.SetText("6")
.txt_Type_OF_Saving.SetText("10")
.txt_AmountSaved.SetText("20")
.txt_OtherSavingDescription.SetText("Other Description")
.validateIfSavedSuccesfully();
SavingDetail
.Initialize(this.driver)
.Select_SavingTypeKey.GetText(out string outSavingType)
.Select_SavingDescriptionTypeKey.GetText(out string outSavingDescription)
.txt_SavingAmount.GetText(out string outSavingAmount)
.btn_Back_Click();
SavingSummary
.Initialize(this.driver)
.btn_TableView_Click()
.tbl_SavingSummayTable.GetRowCount(out int AfterrecordCount)
.tbl_SavingSummayTable.GetRowByUniqueColumnValue("Savings Description", outSavingDescription, out Dictionary<string, string> rowData);
Assert.Multiple(() =>
{
Assert.AreEqual(BeforerecordCount, AfterrecordCount - 1, "Record is not added");
Assert.That(rowData["Savings Type"], Is.EqualTo(outSavingType), "Savings Type should be added");
Assert.That(rowData["Savings Description"], Is.EqualTo(outSavingDescription), "Savings Description should be added");
Assert.That(rowData["Total Savings"], Is.EqualTo(outSavingAmount), "Total Savings should be Autopopulated");
});
}
[Test, Name("Table Sort"), Order(14), TestCaseId("380184,380188,380189")]
public void TS14_ValidateTableSort()
{
driver.GoToURL(this.SavingsSummaryURL);
SavingSummary
.Initialize(this.driver)
.btn_TableView_Click();
SavingSummary
.Initialize(this.driver)
.ValidateSavingsTypeSort()
.ValidateSavingsDescriptionSort()
.ValidateTotalSavingsSort()
.ValidateProgramSort()
.ValidateStartDateofSavingsSort()
.ValidateEndDateofSavingsSort();
}
[Test, Name("Verify Savings - field ' Type of Savings' is varchar "), Order(15), TestCaseId("532016,334524")]
public void TS15_Validate_TypeOF_Saving_Varchar()
{
var testData = new
{
selectExpenseManagement = "O",
SelectSavingDescription = "OTH",
OtherDetails = "OtherTestDetails",
OtherDescription = "OthertestDescription",
OtherSavingType = "OtherSavingType",
type_OfSaving = "12Assurecare",
OtherItem = "OtherItem",
AmountSaving = "10",
Program = "Care Management - High",
SubProgram = "Complex",
AvoidedItem = "20",
};
apiClass.RemoveAll(this.EnvironmentData.Member.MemberUrlGuid);
driver.GoToURL(this.SavingsSummaryURL);
SavingSummary
.Initialize(this.driver)
.btn_TableView_Click()
.tbl_SavingSummayTable.GetRowCount(out int BeforerecordCount)
.btn_AddNewSavings.Click();
SavingDetail
.Initialize(this.driver)
.Select_SavingTypeKey.SelectByValue(testData.selectExpenseManagement)
.WaitForLoadingSpinner()
.Select_SavingDescriptionTypeKey.SelectByValue(testData.SelectSavingDescription)
.Select_SavingTypeKey.IsRequired(out bool outrequiredSavingTypeKey)
.Select_ProgramSubProgramTypeKey.IsEnabled(out bool SubProgramEnabledByDefault)
.Select_ProgramTypeKey.SelectByText(testData.Program)
.WaitForSeconds(1)
.Select_ProgramSubProgramTypeKey.IsEnabled(out bool SubProgramEnabledProgramSelected)
.dt_StartDate.SetDate(DateTime.Now)
.dt_EndDate.SetDate(DateTime.Now)
.txt_AvoidedItem.SetText(testData.AvoidedItem)
.txt_OtherSavingDescription.SetText(testData.OtherDescription)
.txt_OtherSavingType.SetText(testData.OtherSavingType)
.txt_Type_OF_Saving.SetText(testData.type_OfSaving)
.validateIfSavedSuccesfully();
SavingDetail
.Initialize(this.driver)
.Select_SavingTypeKey.GetText(out string outSavingType)
.Select_SavingDescriptionTypeKey.GetText(out string outSavingDescription)
.btn_Back_Click();
SavingSummary
.Initialize(this.driver)
.btn_TableView_Click()
.tbl_SavingSummayTable.GetRowCount(out int AfterrecordCount)
.tbl_SavingSummayTable.GetRowByUniqueColumnValue("Savings Description", outSavingDescription, out Dictionary<string, string> rowData)
.tbl_SavingSummayTable.OpenRecord(outSavingType);
SavingDetail
.Initialize(this.driver)
.WaitForLoadingSpinner()
.txt_Type_OF_Saving.GetText(out var outTypeOFSaving)
.btn_Back_Click();
Assert.Multiple(() =>
{
Assert.AreEqual(BeforerecordCount, AfterrecordCount - 1, "Record is not added");
Assert.That(rowData["Savings Type"], Is.EqualTo(outSavingType), "Savings Description should be added");
Assert.That(rowData["Savings Description"], Is.EqualTo(outSavingDescription), "Savings Type should be added");
Assert.That(outTypeOFSaving, Is.EqualTo(testData.type_OfSaving), "334524 - TypeOFSaving is not Varchar Field");
Assert.That(SubProgramEnabledByDefault, Is.False, "532016 - Sub Program should not be enabled if no Program is selected");
Assert.That(SubProgramEnabledProgramSelected, Is.True, "532016 - Sub Program should should be enabled if Program is selected");
});
}
[Test, Name("Provider (if not in Provider table) field is not a required field"), Order(16),TestCaseId("380231")]
public void TS16_ValidateProviderTableFieldIsNotRequiredField()
{
var TestData = new
{
SavingsType = "Expense Management",
SavingsDescription = "Negotiation of Price",
AutomationProviderID = EnvironmentData.Provider.ProviderId,
AutomationProviderName = EnvironmentData.Provider.ProviderName,
TestProviderName = "TestProvider"
};
driver.GoToURL(this.SavingsSummaryURL);
SavingSummary
.Initialize(this.driver)
.btn_AddNewSavings.Click();
SavingDetail
.Initialize(this.driver)
.Select_SavingTypeKey.SelectByText(TestData.SavingsType)
.Select_SavingDescriptionTypeKey.SelectByText(TestData.SavingsDescription)
.WaitForLoadingSpinner()
.txt_Provider_NotInTable.IsRequired(out bool ProviderNotInProviderTableRequiredByDefault)
.txt_Provider_FromProviderTable.IsRequired(out bool ProviderFromProviderTableRequiredByDefault)
.txt_Provider_FromProviderTable.OpenSearch();
ProviderSearch
.Initialize(this.driver)
.txt_ProviderId_SendKeys(TestData.AutomationProviderID)
.btn_Search.Click()
.Link.ClickLinkbyPartialText(TestData.AutomationProviderName);
SavingDetail
.Initialize(this.driver)
.WaitForSeconds(1)
.txt_Provider_NotInTable.IsRequired(out bool ProviderNotInProviderTableRequiredWhenProviderFromTableSelected)
.Refresh();
SavingDetail
.Initialize(this.driver)
.Select_SavingTypeKey.SelectByText(TestData.SavingsType)
.Select_SavingDescriptionTypeKey.SelectByText(TestData.SavingsDescription)
.txt_Provider_NotInTable.SetText(TestData.TestProviderName)
.WaitForSeconds(1)
.txt_Provider_FromProviderTable.IsRequired(out bool ProviderFromProviderTableRequiredWhenProviderNotInTableSelected);
Assert.Multiple(() =>
{
Assert.That(ProviderNotInProviderTableRequiredByDefault, Is.True, "(Provider Not In Provider Table) should be required by Default");
Assert.That(ProviderFromProviderTableRequiredByDefault, Is.True, "(Provider Not In Provider Table) should be required by Default");
Assert.That(ProviderNotInProviderTableRequiredWhenProviderFromTableSelected, Is.False, "(Provider Not In Provider Table) should not be a required field if Provider From Table is Present");
Assert.That(ProviderFromProviderTableRequiredWhenProviderNotInTableSelected, Is.False, "(Provider From Provider Table) should not be a required field if Provider Not In Provider Table is Present");
});
}
[Test, Name("Void Savings with Expense Management and Negotiation of Price"), Order(17), TestCaseId("380191")]
public void TS17_ValidateVoid_Savings()
{
driver.GoToURL(this.SavingsSummaryURL);
SavingSummary
.Initialize(this.driver)
.btn_TableView_Click()
.tbl_SavingSummayTable.GetRowCount(out int BeforerecordCount);
if (BeforerecordCount == 0)
{
apiClass.Post_AddNewSavings(this.EnvironmentData.Member.MemberUrlGuid, ref Savings_Model);
driver.GoToURL(this.SavingsSummaryURL);
}
SavingSummary
.Initialize(this.driver)
.btn_TableView_Click()
.tbl_SavingSummayTable.GetRowCount(out int RecordCountBeforeVoid)
.tbl_SavingSummayTable.OpenFirstRecord();
SavingDetail
.Initialize(this.driver)
.validateVoidSuccesful();
SavingSummary
.Initialize(this.driver)
.btn_TableView_Click()
.tbl_SavingSummayTable.GetRowCount(out int RecordCountAfterVoid);
Assert.Multiple(() =>
{
Assert.AreEqual(RecordCountAfterVoid, RecordCountBeforeVoid - 1, "Void is not working");
});
}
//[Test, Ignore("The Scenario is not exists any environment"), Name("Add Savings with Expense Management and Change Frequency Service"), Description("Add Saving with Expense Management and Change Frequency Service"), Order(12), TestCaseId("")]
//public void ValidateAdd_WithExpenseManagementandChangeInFrequencyService()
//{
// var testData = new
// {
// selectExpenseManagement = "E",
// SelectSavingDescription = "CFS",
// ProviderNotInTable = "Provider",
// OriginalDailyRate = "10",
// OriginalFrequency = "2",
// OriginalUnit = "1",
// AvoidedItem = "10",
// NewUnit = "4",
// NewRate = "3",
// NewFrequency = "6"
// };
// SavingSummary
// .Initialize(this.driver)
// .btn_TableView_Click()
// .tbl_SavingSummayTable.GetRowCount(out int BeforerecordCount)
// .btn_AddNewSavings.Click();
// SavingDetail
// .Initialize(this.driver)
// .Select_SavingTypeKey.SelectByValue(testData.selectExpenseManagement)
// .Select_SavingDescriptionTypeKey.IsEnabled(out bool EnableSavingDescriptionTypeKey)
// .Select_SavingDescriptionTypeKey.IsRequired(out bool outrequiredSavingDescriptionTypeKey)
// .Select_SavingDescriptionTypeKey.SelectByValue(testData.SelectSavingDescription)
// .Select_SavingTypeKey.IsRequired(out bool outrequiredSavingTypeKey)
// .dt_StartDate.IsRequired(out bool outrequiredStartDate)
// .dt_EndDate.IsRequired(out bool outrequiredEndDate)
// .txt_NewFrequency.IsRequired(out bool outrequiredNewFrequency)
// .txt_NewUnit.IsRequired(out bool outrequiredNewUnit)
// .txt_NewRate.IsRequired(out bool outrequiredNewRate)
// .Select_SavingServiceTypeKey.IsRequired(out bool outrequiredServiceType);
// Assert.Multiple(() =>
// {
// Assert.AreEqual(EnableSavingDescriptionTypeKey, true, "Drop Dwon SavingDescriptionType has not Display");
// Assert.AreEqual(outrequiredSavingDescriptionTypeKey, true, "SavingDescriptionType has not Required Field");
// Assert.AreEqual(outrequiredSavingTypeKey, true, "SavingTypeKey has not Required Field");
// Assert.AreEqual(outrequiredStartDate, true, "StartDate has not Required Field");
// Assert.AreEqual(outrequiredEndDate, true, "EndDate has not Required Field");
// Assert.AreEqual(outrequiredNewUnit, true, "New Unit has not Required Field");
// Assert.AreEqual(outrequiredNewFrequency, true, "New Frequency has not Required Field");
// Assert.AreEqual(outrequiredServiceType, true, "ServiceType has not Required Field");
// });
// SavingDetail
// .Initialize(this.driver)
// .dt_StartDate.SetDate(DateTime.Now)
// .dt_EndDate.SetDate(DateTime.Now)
// .Select_SavingServiceTypeKey.SelectByIndex(1)
// .Select_ProgramTypeKey.SelectByIndex(2)
// .txt_NewFrequency.SetText(testData.NewFrequency)
// .txt_NewUnit.SetText(testData.NewUnit)
// .txt_NewRate.SetText(testData.NewRate)
// .validateIfSavedSuccesfully();
// SavingDetail
// .Initialize(this.driver)
// .Select_SavingTypeKey.GetText(out string outSavingType)
// .Select_SavingDescriptionTypeKey.GetText(out string outSavingDescription)
// .txt_Savings.GetText(out string outSaving)
// .txt_SavingAmount.GetText(out string outSavingAmount)
// .dt_StartDate.GetDate(out DateTime outStartDate)
// .dt_EndDate.GetDate(out DateTime outEndDate)
// .btn_Back_Click();
// SavingSummary
// .Initialize(this.driver)
// .btn_TableView_Click()
// .tbl_SavingSummayTable.GetRowCount(out int AfterrecordCount)
// .tbl_SavingSummayTable.GetRowByValueInFirstColumn(outSavingType, out Dictionary<string, string> rowData);
// Assert.Multiple(() =>
// {
// Assert.AreEqual(BeforerecordCount, AfterrecordCount - 1, "Record is not added");
// });
//}
/* [Test, Name(" Member UM -> Saving-Validate Provider (if not in Provider table) field is not a required field when enter Provider (from Provider table)"), Order(17), TestCaseId("334524")]
public void TS17_Validate_ProviderTable_IsRequiredField()
{
var testData = new
{
selectExpenseManagement = "E",
SelectSavingDescription = "NP",
OtherDetails = "OtherTestDetails",
OtherDescription = "OthertestDescription",
OtherSavingType = "OtherSavingType",
type_OfSaving = "12Assurecare",
OtherItem = "OtherItem",
AmountSaving = "10",
providerId = EnvironmentData.Provider.ProviderId,
providerName = EnvironmentData.Provider.ProviderName,
};
SavingSummary
.Initialize(this.driver)
.btn_TableView_Click()
.tbl_SavingSummayTable.GetRowCount(out int BeforerecordCount)
.btn_AddNewSavings.Click();
SavingDetail
.Initialize(this.driver)
.Select_SavingTypeKey.SelectByValue(testData.selectExpenseManagement)
.WaitForSeconds(1)
.Select_SavingDescriptionTypeKey.SelectByValue(testData.SelectSavingDescription)
.WaitForLoadingSpinner()
.btn_ProviderSearch.Click();
ProviderSearchDialog
.Initialize(this.driver)
.txt_ProviderId.SetText(testData.providerId)
.btn_Search.Click()
.WaitForLoadingSpinner()
.Link.ClickLinkbyText(testData.providerName);
SavingDetail
.Initialize(this.driver)
.txt_ProviderNotInTable.IsRequired(out bool outrequiredProviderNotInTable);
Assert.AreEqual(outrequiredProviderNotInTable, false, "Provider Not in table has not Required Field");
SavingDetail
.Initialize(this.driver)
.txt_ProviderNotInTable.SetText("MedCompass")
.WaitForSeconds(1);
Assert.Multiple(() =>
{
});
}*/
}
}
Editor is loading...
Leave a Comment