public void Dashboard_AttributeGroup_Home_BigNumber_NewAttributeGroup() { TestBaseWebDriver test = base.TestContainer[Gallio.Framework.TestContext.CurrentContext.Test.Name]; GeneralMethods utility = test.GeneralMethods; int churchId = test.SQL.FetchChurchID(test.Dashboard.ChurchCode); string activeAttributeGroup = utility.GetUniqueName("aag"); try { test.SQL.Admin_IndividualAttributeGroups_Create(churchId, activeAttributeGroup, true); test.SQL.Admin_IndividualAttributes_Create(churchId, activeAttributeGroup, "salvation", true, true, false, false, true); test.Dashboard.LoginWebDriver(); DashboardHomePage home = new DashboardHomePage(test.Driver, test.GeneralMethods); DashboardSettingsPage settings = new DashboardSettingsPage(test.Driver, test.GeneralMethods, test.SQL); home.openSettingsPage(); int widgetsTotal = settings.getWidgetsTotalOnPage(); int turnedOnWidgetTotal = settings.getTurnedOnWidgetsTotalOnPage(widgetsTotal); for (int i = 1; i <= widgetsTotal; i++) { if (settings.getWidgetName(i).Contains(activeAttributeGroup)) { Assert.IsFalse(settings.isWidgetItemChecked(i, 1), "Active attribute 'salvation' should not be checked"); if (turnedOnWidgetTotal == 6) { settings.turnOffMultiWidgets(widgetsTotal, 1); } settings.turnOnWidget(i); settings.checkWidgetItem(i, 1); break; } } settings.closeSettingsPage(); home.selectView("year"); for (int i = 1; i <= turnedOnWidgetTotal; i++) { if (home.getWidgetName(i).Contains(activeAttributeGroup)) { string bigNumber = home.getWidgetBigNumber(i); int subTotalOnPage = int.Parse(bigNumber.Replace(",", "")); Assert.AreEqual(subTotalOnPage, 0, "The big number of attribute group should be 0"); break; } } } finally { //clear test data test.SQL.Admin_IndividualAttributes_Delete(churchId, activeAttributeGroup, "salvation"); test.SQL.Admin_IndividualAttributeGroups_Delete(churchId, activeAttributeGroup); } }
public void Dashboard_Setting_Saved_After_closed() { TestBaseWebDriver test = base.TestContainer[Gallio.Framework.TestContext.CurrentContext.Test.Name]; GeneralMethods utility = test.GeneralMethods; Random rand = new Random(); bool checkOruncheckGivingItem = false; try { test.Dashboard.LoginWebDriver(); new DashboardHomePage(test.Driver, test.GeneralMethods).openSettingsPage(); DashboardSettingsPage settings = new DashboardSettingsPage(test.Driver, test.GeneralMethods, test.SQL); int numberOfSubItem = settings.getWidgetSubItemsOnPage(1).Count; int randomSubItemIndex = rand.Next(numberOfSubItem); int numberOfTurnedOnWidget = settings.getTurnedOnWidgetsTotalOnPage(settings.getWidgetsTotalOnPage()); bool isGivingWidgetTurnedOn = settings.isWidgetTurnedOn(1); bool isAttendanceWidgetTurnedOn = settings.isWidgetTurnedOn(2); #region make modification on settings page if (isGivingWidgetTurnedOn) { if (numberOfSubItem > 0) { if (settings.isWidgetItemChecked(1, randomSubItemIndex)) { settings.uncheckWidgetItem(1, randomSubItemIndex); checkOruncheckGivingItem = false; } else { settings.checkWidgetItem(1, randomSubItemIndex); checkOruncheckGivingItem = true; } } settings.turnOffWidget(1); } else { if (numberOfTurnedOnWidget < 6) { settings.turnOnWidget(1); } else { isGivingWidgetTurnedOn = !isGivingWidgetTurnedOn; numberOfTurnedOnWidget++; } if (numberOfSubItem > 0) { if (settings.isWidgetItemChecked(1, randomSubItemIndex)) { settings.uncheckWidgetItem(1, randomSubItemIndex); checkOruncheckGivingItem = false; } else { settings.checkWidgetItem(1, randomSubItemIndex); checkOruncheckGivingItem = true; } } } if (isAttendanceWidgetTurnedOn) { settings.turnOffWidget(2); } else { if (numberOfTurnedOnWidget < 6) { settings.turnOnWidget(2); } else { isAttendanceWidgetTurnedOn = !isAttendanceWidgetTurnedOn; } } #endregion settings.closeSettingsPage(); new DashboardHomePage(test.Driver, test.GeneralMethods).openSettingsPage(); //verify all update on giving widget is saved Assert.AreEqual(settings.isWidgetTurnedOn(1), !isGivingWidgetTurnedOn); Assert.AreEqual(settings.isWidgetItemChecked(1, randomSubItemIndex), checkOruncheckGivingItem); //verify all update on attendance widget is saved Assert.AreEqual(settings.isWidgetTurnedOn(2), !isAttendanceWidgetTurnedOn); } finally { //clear test data } }
public void Dashboard_AttributeGroup_Settings_SpecialAttributes() { TestBaseWebDriver test = base.TestContainer[Gallio.Framework.TestContext.CurrentContext.Test.Name]; GeneralMethods utility = test.GeneralMethods; int churchId = test.SQL.FetchChurchID(test.Dashboard.ChurchCode); string activeAttributeGroup = utility.GetUniqueName("aag"); bool is_attribute_salvation_checked = false; bool is_attribute_baptism_checked = false; bool is_attribute_dedication_checked = false; bool is_attribute_re_dedication_checked = false; bool is_attribute_rededication_checked = false; bool is_attribute_baby_dedication_checked = false; try { test.SQL.Dashboard_ClearData(churchId, test.Dashboard.DashboardUsername); test.SQL.Admin_IndividualAttributeGroups_Create(churchId, activeAttributeGroup, true); test.SQL.Admin_IndividualAttributes_Create(churchId, activeAttributeGroup, "salvation", true, true, false, false, true); test.SQL.Admin_IndividualAttributes_Create(churchId, activeAttributeGroup, "baptism", true, true, false, false, true); test.SQL.Admin_IndividualAttributes_Create(churchId, activeAttributeGroup, "dedication", true, true, false, false, true); test.SQL.Admin_IndividualAttributes_Create(churchId, activeAttributeGroup, "re-dedication", true, true, false, false, true); test.SQL.Admin_IndividualAttributes_Create(churchId, activeAttributeGroup, "rededication", true, true, false, false, true); test.SQL.Admin_IndividualAttributes_Create(churchId, activeAttributeGroup, "baby dedication", true, true, false, false, true); test.Dashboard.LoginWebDriver(); new DashboardHomePage(test.Driver, test.GeneralMethods).openSettingsPage(); DashboardSettingsPage settings = new DashboardSettingsPage(test.Driver, test.GeneralMethods, test.SQL); int widgetsTotal = settings.getWidgetsTotalOnPage(); for (int i = 1; i <= widgetsTotal; i++) { if (settings.getWidgetName(i).Contains(activeAttributeGroup)) { object[] items = settings.getWidgetSubItemsOnPage(i).ToArray(); for (int j = 0; j < items.Length; j++) { if (items[j].ToString().ToLower().Contains("salvation")) { TestLog.WriteLine(string.Format("The active attribute '{0}' is found", items[j])); is_attribute_salvation_checked = settings.isWidgetItemChecked(i, j + 1); Assert.IsTrue(is_attribute_salvation_checked, string.Format("Active attribute '{0}' should be checked by default", items[j])); continue; } if (items[j].ToString().ToLower().Contains("baptism")) { TestLog.WriteLine(string.Format("The active attribute '{0}' is found", items[j])); is_attribute_baptism_checked = settings.isWidgetItemChecked(i, j + 1); Assert.IsTrue(is_attribute_baptism_checked, string.Format("Active attribute '{0}' should be checked by default", items[j])); continue; } if (items[j].ToString().ToLower().Contains("dedication")) { TestLog.WriteLine(string.Format("The active attribute '{0}' is found", items[j])); is_attribute_dedication_checked = settings.isWidgetItemChecked(i, j + 1); Assert.IsTrue(is_attribute_dedication_checked, string.Format("Active attribute '{0}' should be checked by default", items[j])); continue; } if (items[j].ToString().ToLower().Contains("re-dedication")) { TestLog.WriteLine(string.Format("The active attribute '{0}' is found", items[j])); is_attribute_re_dedication_checked = settings.isWidgetItemChecked(i, j + 1); Assert.IsTrue(is_attribute_re_dedication_checked, string.Format("Active attribute '{0}' should be checked by default", items[j])); continue; } if (items[j].ToString().ToLower().Contains("rededication")) { TestLog.WriteLine(string.Format("The active attribute '{0}' is found", items[j])); is_attribute_rededication_checked = settings.isWidgetItemChecked(i, j + 1); Assert.IsTrue(is_attribute_rededication_checked, string.Format("Active attribute '{0}' should be checked by default", items[j])); continue; } if (items[j].ToString().ToLower().Contains("baby dedication")) { TestLog.WriteLine(string.Format("The active attribute '{0}' is found", items[j])); is_attribute_baby_dedication_checked = settings.isWidgetItemChecked(i, j + 1); Assert.IsTrue(is_attribute_baby_dedication_checked, string.Format("Active attribute '{0}' should be checked by default", items[j])); } } } } } finally { //clear test data test.SQL.Admin_IndividualAttributes_Delete(churchId, activeAttributeGroup, "salvation"); test.SQL.Admin_IndividualAttributes_Delete(churchId, activeAttributeGroup, "baptism"); test.SQL.Admin_IndividualAttributes_Delete(churchId, activeAttributeGroup, "dedication"); test.SQL.Admin_IndividualAttributes_Delete(churchId, activeAttributeGroup, "re-dedication"); test.SQL.Admin_IndividualAttributes_Delete(churchId, activeAttributeGroup, "rededication"); test.SQL.Admin_IndividualAttributes_Delete(churchId, activeAttributeGroup, "baby dedication"); test.SQL.Admin_IndividualAttributeGroups_Delete(churchId, activeAttributeGroup); } }