public void Dashboard_Setting_AllAttributeGroups() { TestBaseWebDriver test = base.TestContainer[Gallio.Framework.TestContext.CurrentContext.Test.Name]; GeneralMethods utility = test.GeneralMethods; try { int churchId = test.SQL.FetchChurchID(test.Dashboard.ChurchCode); test.Dashboard.LoginWebDriver(); new DashboardHomePage(test.Driver, test.GeneralMethods).openSettingsPage(); DashboardSettingsPage settings = new DashboardSettingsPage(test.Driver, test.GeneralMethods, test.SQL); ArrayList allAttributeGroupsInSql = test.SQL.Dashboard_AttributeGroup_GetAllAttributeGroups(churchId); ArrayList allWidgetsOnPage = settings.getAllWidgetsNamesOnPage(settings.getWidgetsTotalOnPage()); TestLog.WriteLine(allAttributeGroupsInSql.Count); Assert.IsTrue(allWidgetsOnPage.Count >= allAttributeGroupsInSql.Count + 1); foreach (string widget in allWidgetsOnPage) { bool flag = false; TestLog.WriteLine(widget.ToString()); foreach (string wedgetInDb in allAttributeGroupsInSql) { if (widget.Contains("Giving") || widget.Contains("Attendance") || widget.Replace(" ", "").Contains(wedgetInDb.Replace(" ", ""))) { flag = true; TestLog.WriteLine(widget.ToString() + "|" + wedgetInDb.ToString()); } } Assert.IsTrue(flag); } } finally { //clear test data } }
public void Dashboard_AttributeGroup_Settings_NewAttributeGroup_And_NewAttribute() { 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"); string inactiveAttributeGroup = utility.GetUniqueName("iag"); string activeAttribute = utility.GetUniqueName("aa"); string inactiveAttribute = utility.GetUniqueName("ia"); try { test.SQL.Admin_IndividualAttributeGroups_Create(churchId, activeAttributeGroup, true); test.SQL.Admin_IndividualAttributeGroups_Create(churchId, inactiveAttributeGroup, true); test.SQL.Admin_IndividualAttributes_Create(churchId, activeAttributeGroup, activeAttribute, true, true, false, false, true); test.SQL.Admin_IndividualAttributes_Create(churchId, activeAttributeGroup, inactiveAttribute, true, true, false, false, false); test.Dashboard.LoginWebDriver(); new DashboardHomePage(test.Driver, test.GeneralMethods).openSettingsPage(); DashboardSettingsPage settings = new DashboardSettingsPage(test.Driver, test.GeneralMethods, test.SQL); int widgetsTotal = settings.getWidgetsTotalOnPage(); bool hasCustomerizedActiveAttributeGroup = false; bool hasCustomerizedInactiveAttributeGroup = false; bool hasCustomerizedActiveAttribute = false; bool hasCustomerizedInactiveAttribute = false; ArrayList allWidgetsOnPage = settings.getAllWidgetsNamesOnPage(settings.getWidgetsTotalOnPage()); foreach (string widget in allWidgetsOnPage) { if (widget.Contains(activeAttributeGroup)) { TestLog.WriteLine(string.Format("The customerized active attribute group '{0}' found", widget)); hasCustomerizedActiveAttributeGroup = true; } if (widget.Contains(inactiveAttributeGroup)) { TestLog.WriteLine(string.Format("The customerized inactive attribute group '{0}' found", widget)); hasCustomerizedInactiveAttributeGroup = true; } } Assert.IsTrue(hasCustomerizedActiveAttributeGroup, "Active attribute group should can be shown on page"); Assert.IsFalse(hasCustomerizedInactiveAttributeGroup, "Inactive attribute group should cannot be shown on page"); for (int i = 1; i <= widgetsTotal; i++) { if (settings.getWidgetName(i).Contains(activeAttributeGroup)) { ArrayList items = settings.getWidgetSubItemsOnPage(i); foreach (string item in items) { if (item.Contains(activeAttribute)) { TestLog.WriteLine(string.Format("The customerized active attribute '{0}' found", item)); hasCustomerizedActiveAttribute = true; } if (item.Contains(inactiveAttribute)) { TestLog.WriteLine(string.Format("The customerized inactive attribute '{0}' found", item)); hasCustomerizedInactiveAttribute = true; } } Assert.IsTrue(hasCustomerizedActiveAttribute, "Active attribute should can be shown on page"); Assert.IsFalse(hasCustomerizedInactiveAttribute, "Inactive attribute should cannot be shown on page"); break; } } } finally { //clear test data test.SQL.Admin_IndividualAttributes_Delete(churchId, activeAttributeGroup, activeAttribute); test.SQL.Admin_IndividualAttributes_Delete(churchId, activeAttributeGroup, inactiveAttribute); test.SQL.Admin_IndividualAttributeGroups_Delete(churchId, activeAttributeGroup); test.SQL.Admin_IndividualAttributeGroups_Delete(churchId, inactiveAttributeGroup); } }