Ejemplo n.º 1
0
        public void Dashboard_Setting_MaximumTurnedOnWidget()
        {
            TestBaseWebDriver test     = base.TestContainer[Gallio.Framework.TestContext.CurrentContext.Test.Name];
            GeneralMethods    utility  = test.GeneralMethods;
            int maximumTurnedOnWidgets = 6;

            try
            {
                test.Dashboard.LoginWebDriver();
                new DashboardHomePage(test.Driver, test.GeneralMethods).openSettingsPage();
                DashboardSettingsPage settings = new DashboardSettingsPage(test.Driver, test.GeneralMethods, test.SQL);

                int totalWidgets         = settings.getWidgetsTotalOnPage();
                int totalturnedOnWidgets = settings.getTurnedOnWidgetsTotalOnPage(totalWidgets);

                //verify number of turned on widgets is not exceed 6
                Assert.IsTrue(totalturnedOnWidgets <= maximumTurnedOnWidgets, string.Format("The number of total turned on widgets should not exceed {0}", maximumTurnedOnWidgets));

                settings.turnOnMultiWidgets(totalWidgets, maximumTurnedOnWidgets - (totalturnedOnWidgets - 1));

                //verify the pop-up will be shown if try to select seventh widget
                Assert.IsTrue(settings.isAlertDisplayed());
                settings.closeAlert();
            }
            finally
            {
                //clear test data
            }
        }
Ejemplo n.º 2
0
        public void Dashboard_Home_Giving_TurnOff()
        {
            TestBaseWebDriver test    = base.TestContainer[Gallio.Framework.TestContext.CurrentContext.Test.Name];
            GeneralMethods    utility = test.GeneralMethods;

            try
            {
                test.Dashboard.LoginWebDriver();
                test.GeneralMethods.WaitForPageIsLoaded();
                DashboardHomePage home = new DashboardHomePage(test.Driver, test.GeneralMethods);
                home.openSettingsPage();
                DashboardSettingsPage settings = new DashboardSettingsPage(test.Driver, test.GeneralMethods, test.SQL);

                settings.turnOffWidget(1);
                settings.closeSettingsPage();

                //verify the giving widget is removed
                Assert.IsFalse(home.getWidgetName(1).ToLower().Contains("giving"));

                home.openSettingsPage();
                settings.turnOnWidget(1);
                settings.closeSettingsPage();

                //verify the giving widget is back
                Assert.IsTrue(home.getWidgetName(1).ToLower().Contains("giving"));
            }
            finally
            {
                //clear test data
            }
        }
Ejemplo n.º 3
0
        public void Dashboard_Home_Giving_BigNumber_ByDefault()
        {
            TestBaseWebDriver test    = base.TestContainer[Gallio.Framework.TestContext.CurrentContext.Test.Name];
            GeneralMethods    utility = test.GeneralMethods;
            DateTime          now     = TimeZoneInfo.ConvertTimeFromUtc(DateTime.UtcNow, TimeZoneInfo.FindSystemTimeZoneById("Central Standard Time"));

            try
            {
                int churchId = test.SQL.FetchChurchID(test.Dashboard.ChurchCode);
                int userId   = test.SQL.User_FetchID(churchId, test.Dashboard.DashboardEmail, test.Dashboard.DashboardUsername);
                test.SQL.Dashboard_ClearData(churchId, test.Dashboard.DashboardUsername);

                test.Dashboard.LoginWebDriver();
                test.GeneralMethods.WaitForPageIsLoaded();
                DashboardHomePage     home     = new DashboardHomePage(test.Driver, test.GeneralMethods);
                DashboardSettingsPage settings = new DashboardSettingsPage(test.Driver, test.GeneralMethods, test.SQL);
                home.openSettingsPage();
                settings.turnOnWidget(1);
                settings.closeSettingsPage();

                string bigNumber      = home.getWidgetBigNumber(1);
                double subTotalOnPage = double.Parse(bigNumber.Replace("$", "").Replace(",", ""));

                DateTime[] dateRange    = test.Dashboard.getDateRange(now, "week", 1);
                double     subTotalInDb = test.SQL.Dashboard_Giving_GetPeriodSum(churchId, userId, dateRange[0], dateRange[1]);

                //verify the default big number on page is correct
                TestLog.WriteLine(string.Format("{0}|{1}", subTotalOnPage, subTotalInDb));
                Assert.AreEqual(subTotalOnPage, subTotalInDb);
            }
            finally
            {
                //clear test data
            }
        }
Ejemplo n.º 4
0
        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);
            }
        }
Ejemplo n.º 5
0
        public void Dashboard_Giving_NewGiving_Of_ContributionFund()
        {
            TestBaseWebDriver test    = base.TestContainer[Gallio.Framework.TestContext.CurrentContext.Test.Name];
            GeneralMethods    utility = test.GeneralMethods;

            //Test data parameters
            DateTime now         = TimeZoneInfo.ConvertTimeFromUtc(DateTime.UtcNow, TimeZoneInfo.FindSystemTimeZoneById("Central Standard Time"));
            int      churchId    = test.SQL.FetchChurchID(test.Dashboard.ChurchCode);
            int      userId      = test.SQL.User_FetchID(churchId, test.Dashboard.DashboardEmail, test.Dashboard.DashboardUsername);
            string   fund_name_1 = utility.GetUniqueName("fund");
            string   card_number = "4111111111111111";
            string   card_type   = "Visa";

            try
            {
                test.SQL.Giving_Funds_Create(churchId, fund_name_1, true, null, 1, true, "Auto Testing");

                test.Dashboard.LoginWebDriver();
                test.GeneralMethods.WaitForPageIsLoaded();
                DashboardHomePage     home     = new DashboardHomePage(test.Driver, test.GeneralMethods);
                DashboardSettingsPage settings = new DashboardSettingsPage(test.Driver, test.GeneralMethods, test.SQL);
                home.openSettingsPage();
                settings.turnOnWidget(1);
                settings.closeSettingsPage();
                home.selectView("year");

                //string bigNumber = home.getWidgetBigNumber(1);
                //double subTotalOnPage = double.Parse(bigNumber.Replace("$", "").Replace(",", ""));

                //Do an online giving
                test.Infellowship.LoginWebDriver("*****@*****.**", "FT4life!");
                test.Infellowship.Giving_GiveNow_CreditCard_WithoutValidation_WebDriver(fund_name_1, "10000", card_type, card_number, 12, (DateTime.Now.Year + 5).ToString());
                test.Infellowship.LogoutWebDriver();

                test.Dashboard.OpenLoginWebDriver();
                home.openSettingsPage();
                settings.checkSubItemByName(1, fund_name_1);
                settings.closeSettingsPage();

                home.selectView("year");

                string bigNumberNew = home.getWidgetBigNumber(1);
                //double subTotalOnPageNew = double.Parse(bigNumberNew.Replace("$", "").Replace(",", ""));

                DateTime[] dateRange    = test.Dashboard.getDateRange(now, "year");
                double     subTotalInDb = test.SQL.Dashboard_Giving_GetPeriodSum(churchId, userId, dateRange[0], dateRange[1]);

                //verify the big number on page is correct
                //TestLog.WriteLine(string.Format("{0}|{1}|{2}", subTotalOnPage, subTotalInDb, subTotalOnPageNew));
                //Assert.IsTrue(subTotalInDb>=subTotalOnPage + 10000);
                //Assert.AreEqual(subTotalInDb, subTotalOnPageNew);
                Assert.AreEqual(bigNumberNew, test.Dashboard.getBigNumberStringGreaterThanMillion(subTotalInDb));
            }
            finally
            {
                //clear test data
                test.SQL.Giving_Funds_Delete(churchId, fund_name_1);
            }
        }
Ejemplo n.º 6
0
        public void Dashboard_Home_Giving_BigNumber_TurnOffAllFunds()
        {
            TestBaseWebDriver test    = base.TestContainer[Gallio.Framework.TestContext.CurrentContext.Test.Name];
            GeneralMethods    utility = test.GeneralMethods;
            DateTime          now     = TimeZoneInfo.ConvertTimeFromUtc(DateTime.UtcNow, TimeZoneInfo.FindSystemTimeZoneById("Central Standard Time"));

            string[] viewTypes = new string[] { "week", "month", "quarter", "year" };

            try
            {
                int churchId = test.SQL.FetchChurchID(test.Dashboard.ChurchCode);
                int userId   = test.SQL.User_FetchID(churchId, test.Dashboard.DashboardEmail, test.Dashboard.DashboardUsername);

                test.Dashboard.LoginWebDriver();
                test.GeneralMethods.WaitForPageIsLoaded();
                DashboardHomePage     home     = new DashboardHomePage(test.Driver, test.GeneralMethods);
                DashboardSettingsPage settings = new DashboardSettingsPage(test.Driver, test.GeneralMethods, test.SQL);

                home.openSettingsPage();

                int totalItems = settings.getWidgetSubItemsOnPage(1).Count;

                for (int i = 1; i <= totalItems; i++)
                {
                    settings.uncheckWidgetItem(1, i);
                }

                settings.closeSettingsPage();

                foreach (string viewType in viewTypes)
                {
                    home.selectView(viewType);

                    string bigNumber      = home.getWidgetBigNumber(1);
                    double subTotalOnPage = double.Parse(bigNumber.Replace("$", "").Replace(",", ""));

                    DateTime[] dateRange    = test.Dashboard.getDateRange(now, viewType, 1);
                    double     subTotalInDb = test.SQL.Dashboard_Giving_GetPeriodSum(churchId, userId, dateRange[0], dateRange[1]);

                    //verify the big number on page is correct
                    TestLog.WriteLine(string.Format("{0}|{1}", subTotalOnPage, subTotalInDb));
                    Assert.AreEqual(subTotalOnPage, subTotalInDb);
                    Assert.AreEqual(subTotalOnPage, 0);
                }

                home.openSettingsPage();

                for (int i = 1; i <= totalItems; i++)
                {
                    settings.checkWidgetItem(1, i);
                }
            }
            finally
            {
                //clear test data
                test.SQL.Dashboard_ClearData(test.SQL.FetchChurchID(test.Dashboard.ChurchCode), test.Dashboard.DashboardUsername);
            }
        }
Ejemplo n.º 7
0
        public void Dashboard_Setting_Giving_ReportRights_NotShow()
        {
            TestBaseWebDriver test    = base.TestContainer[Gallio.Framework.TestContext.CurrentContext.Test.Name];
            GeneralMethods    utility = test.GeneralMethods;

            int churchId = test.SQL.FetchChurchID(test.Dashboard.ChurchCode);
            int userId   = test.SQL.User_FetchID(churchId, test.Dashboard.DashboardEmail, test.Dashboard.DashboardUsername);

            try
            {
                test.Portal.LoginWebDriver(test.Dashboard.DashboardUsername, test.Dashboard.DashboardPassword, test.Dashboard.ChurchCode);

                test.Dashboard.uncheckAllRoles(userId);
                test.Dashboard.uncheckAccessRight(userId, "Contribution");
                test.Dashboard.uncheckAccessRight(userId, "Contributor Visibility");
                test.Dashboard.uncheckAccessRight(userId, "Contributor Summaries");

                test.Dashboard.LoginWebDriver();
                DashboardHomePage home = new DashboardHomePage(test.Driver, test.GeneralMethods);
                Assert.IsFalse(home.getWidgetName(1).ToLower().Contains("giving"));

                home.openSettingsPage();
                DashboardSettingsPage settings = new DashboardSettingsPage(test.Driver, test.GeneralMethods, test.SQL);

                //verify the giving widget is removed
                Assert.IsFalse(settings.getWidgetName(1).ToLower().Contains("giving"));

                test.Driver.Manage().Cookies.DeleteAllCookies();
                test.Portal.LoginWebDriver(test.Dashboard.DashboardUsername, test.Dashboard.DashboardPassword, test.Dashboard.ChurchCode);
                test.Dashboard.checkAccessRight(userId, "Contribution");
                test.Dashboard.checkAccessRight(userId, "Contributor Visibility");
                test.Dashboard.checkAccessRight(userId, "Contributor Summaries");
                //test.Dashboard.LoginWebDriver();
                test.Portal.LogoutWebDriver();
                test.Dashboard.OpenLoginWebDriver();

                //verify the giving widget is back
                home.openSettingsPage();
                Assert.IsTrue(settings.getWidgetName(1).ToLower().Contains("giving"));
                settings.turnOnWidget(1);

                //verify the giving widget is closed
                Assert.IsFalse(settings.isWidgetTurnedOn(1));
            }
            finally
            {
                //clear test data
                test.Driver.Manage().Cookies.DeleteAllCookies();
                test.Portal.LoginWebDriver(test.Dashboard.DashboardUsername, test.Dashboard.DashboardPassword, test.Dashboard.ChurchCode);
                test.Dashboard.checkAllRoles(userId);
            }
        }
Ejemplo n.º 8
0
        public void Dashboard_AttributeGroup_Settings_NewAttribute_WithoutStartDate()
        {
            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 activeAttributeWithoutStartDate = utility.GetUniqueName("aawsd");

            try
            {
                test.SQL.Admin_IndividualAttributeGroups_Create(churchId, activeAttributeGroup, true);
                test.SQL.Admin_IndividualAttributes_Create(churchId, activeAttributeGroup, activeAttributeWithoutStartDate, true, false, 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();
                bool hasCustomerizedActiveAttributeWithoutStartDate = false;

                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(activeAttributeWithoutStartDate))
                            {
                                TestLog.WriteLine(string.Format("The customerized active attribute '{0}' without 'start date' is found", item));
                                hasCustomerizedActiveAttributeWithoutStartDate = true;
                            }
                        }

                        Assert.IsFalse(hasCustomerizedActiveAttributeWithoutStartDate, "Active attribute without 'start date' should cannot be shown on page");
                        break;
                    }
                }
            }
            finally
            {
                //clear test data
                test.SQL.Admin_IndividualAttributes_Delete(churchId, activeAttributeGroup, activeAttributeWithoutStartDate);
                test.SQL.Admin_IndividualAttributeGroups_Delete(churchId, activeAttributeGroup);
            }
        }
Ejemplo n.º 9
0
        public void Dashboard_Setting_DefaultFunds()
        {
            TestBaseWebDriver test    = base.TestContainer[Gallio.Framework.TestContext.CurrentContext.Test.Name];
            GeneralMethods    utility = test.GeneralMethods;

            try
            {
                int churchId = test.SQL.FetchChurchID(test.Dashboard.ChurchCode);
                test.SQL.Dashboard_ClearData(churchId, test.Dashboard.DashboardUsername);

                test.Dashboard.LoginWebDriver();
                new DashboardHomePage(test.Driver, test.GeneralMethods).openSettingsPage();
                DashboardSettingsPage settings = new DashboardSettingsPage(test.Driver, test.GeneralMethods, test.SQL);

                ArrayList fundsInSql  = test.SQL.Dashboard_Giving_GetAllFundsName(churchId);
                ArrayList fundsOnPage = settings.getWidgetSubItemsOnPage(1);

                TestLog.WriteLine(fundsOnPage.Count);
                Assert.AreEqual(fundsInSql.Count, fundsOnPage.Count);

                foreach (var itemOnPage in fundsOnPage)
                {
                    bool flag = false;
                    TestLog.WriteLine(itemOnPage.ToString());
                    object[] funds = fundsInSql.ToArray();
                    for (int i = 0; i < funds.Length; i++)
                    {
                        if (funds[i].ToString().Replace(" ", "").Contains(itemOnPage.ToString().Replace(" ", "")))
                        {
                            flag = true;
                            TestLog.WriteLine(funds[i].ToString() + "|" + itemOnPage.ToString());
                            if (funds[i].ToString().Contains("inactive"))
                            {
                                Assert.IsTrue(settings.isWidgetItemInactive(1, i + 1));
                            }
                        }
                    }
                    Assert.IsTrue(flag);
                }
            }
            finally
            {
                //clear test data
            }
        }
Ejemplo n.º 10
0
        public void Dashboard_Setting_DefaultTurnedOnFunds()
        {
            TestBaseWebDriver test    = base.TestContainer[Gallio.Framework.TestContext.CurrentContext.Test.Name];
            GeneralMethods    utility = test.GeneralMethods;

            try
            {
                int churchId = test.SQL.FetchChurchID(test.Dashboard.ChurchCode);
                test.SQL.Dashboard_ClearData(churchId, test.Dashboard.DashboardUsername);

                test.Dashboard.LoginWebDriver();
                new DashboardHomePage(test.Driver, test.GeneralMethods).openSettingsPage();
                DashboardSettingsPage settings = new DashboardSettingsPage(test.Driver, test.GeneralMethods, test.SQL);

                ArrayList turnOnFundsSql    = test.SQL.Dashboard_Giving_GetDefaultTurnedOnFundsName(churchId, -5);
                ArrayList turnOnFundsOnPage = settings.getWidgetTurnedOnSubItemsOnPage(1);

                TestLog.WriteLine(turnOnFundsOnPage.Count);
                Assert.AreEqual(turnOnFundsSql.Count, turnOnFundsOnPage.Count);

                foreach (var itemOnPage in turnOnFundsOnPage)
                {
                    bool flag = false;
                    TestLog.WriteLine(itemOnPage.ToString());
                    foreach (var itemInSql in turnOnFundsSql)
                    {
                        if (itemInSql.ToString().Replace(" ", "").Contains(itemOnPage.ToString().Replace(" ", "")))
                        {
                            flag = true;
                            TestLog.WriteLine(itemInSql.ToString() + "|" + itemOnPage.ToString());
                        }
                    }
                    Assert.IsTrue(flag);
                }
            }
            finally
            {
                //clear test data
            }
        }
Ejemplo n.º 11
0
        public void Dashboard_Setting_DefaultTurnedOnAttributeGroups()
        {
            TestBaseWebDriver test    = base.TestContainer[Gallio.Framework.TestContext.CurrentContext.Test.Name];
            GeneralMethods    utility = test.GeneralMethods;

            try
            {
                int churchId = test.SQL.FetchChurchID(test.Dashboard.ChurchCode);
                test.SQL.Dashboard_ClearData(churchId, test.Dashboard.DashboardUsername);

                test.Dashboard.LoginWebDriver();
                new DashboardHomePage(test.Driver, test.GeneralMethods).openSettingsPage();
                DashboardSettingsPage settings = new DashboardSettingsPage(test.Driver, test.GeneralMethods, test.SQL);

                ArrayList canBeTurnedOnAttributeGroupsInSql = test.SQL.Dashboard_AttributeGroup_GetGroupsCanBeTurnedOnByDefault(churchId);
                ArrayList turnOnWidgetsOnPage = settings.getTurnedOnWidgetsNamesOnPage(settings.getWidgetsTotalOnPage());

                TestLog.WriteLine(canBeTurnedOnAttributeGroupsInSql.Count);
                Assert.IsTrue(canBeTurnedOnAttributeGroupsInSql.Count >= turnOnWidgetsOnPage.Count - 2);

                foreach (string widget in turnOnWidgetsOnPage)
                {
                    bool flag = false;
                    TestLog.WriteLine(widget.ToString());
                    foreach (string wedgetInDb in canBeTurnedOnAttributeGroupsInSql)
                    {
                        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
            }
        }
Ejemplo n.º 12
0
        public void Dashboard_Setting_NewFund_Refresh()
        {
            TestBaseWebDriver test    = base.TestContainer[Gallio.Framework.TestContext.CurrentContext.Test.Name];
            GeneralMethods    utility = test.GeneralMethods;

            string fund_name_1 = utility.GetUniqueName("fund1");
            string fund_name_2 = utility.GetUniqueName("fund2");
            int    church_id   = test.SQL.FetchChurchID(test.Dashboard.ChurchCode);

            try
            {
                test.Dashboard.LoginWebDriver();
                new DashboardHomePage(test.Driver, test.GeneralMethods).openSettingsPage();
                DashboardSettingsPage settings = new DashboardSettingsPage(test.Driver, test.GeneralMethods, test.SQL);

                ArrayList fundsOnPage = settings.getWidgetSubItemsOnPage(1);

                TestLog.WriteLine(fundsOnPage.Count);

                test.SQL.Giving_Funds_Create(church_id, fund_name_1, true, null, 1, true, "Auto Testing");
                test.SQL.Giving_Funds_Create(church_id, fund_name_2, true, null, 2, true, "Auto Testing");

                test.Driver.Navigate().Refresh();
                utility.WaitForPageIsLoaded();

                ArrayList fundsOnPageNew = settings.getWidgetSubItemsOnPage(1);

                //verify newly added fund has been shown on the page
                Assert.AreEqual(fundsOnPageNew.Count, fundsOnPage.Count + 1);
                Assert.IsTrue(fundsOnPageNew.Contains((object)fund_name_1));
            }
            finally
            {
                //clear test data
                test.SQL.Giving_Funds_Delete(church_id, fund_name_1);
                test.SQL.Giving_Funds_Delete(church_id, fund_name_2);
            }
        }
Ejemplo n.º 13
0
        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
            }
        }
Ejemplo n.º 14
0
        public void Dashboard_AttributeGroup_Home_BigNumber_NewIndividual()
        {
            TestBaseWebDriver test    = base.TestContainer[Gallio.Framework.TestContext.CurrentContext.Test.Name];
            GeneralMethods    utility = test.GeneralMethods;

            DateTime now                             = TimeZoneInfo.ConvertTimeFromUtc(DateTime.UtcNow, TimeZoneInfo.FindSystemTimeZoneById("Central Standard Time"));
            int      churchId                        = test.SQL.FetchChurchID(test.Dashboard.ChurchCode);
            int      userId                          = test.SQL.User_FetchID(churchId, test.Dashboard.DashboardEmail, test.Dashboard.DashboardUsername);
            string   activeAttributeGroup            = utility.GetUniqueName("aag");
            string   activeAttributeWithStartDate    = utility.GetUniqueName("aa1");
            string   activeAttributeWithoutStartDate = utility.GetUniqueName("aa2");
            string   individual_1                    = utility.GetUniqueName("ind1");
            string   individual_2                    = utility.GetUniqueName("ind2");
            string   individual_3                    = utility.GetUniqueName("ind3");
            string   individual_4                    = utility.GetUniqueName("ind4");

            test.SQL.Admin_IndividualAttributeGroups_Create(churchId, activeAttributeGroup, true);
            test.SQL.Admin_IndividualAttributes_Create(churchId, activeAttributeGroup, activeAttributeWithStartDate, false, true, false, false, true);
            test.SQL.Admin_IndividualAttributes_Create(churchId, activeAttributeGroup, activeAttributeWithoutStartDate, false, false, false, false, true);
            test.SQL.People_Individual_Create(churchId, "AutoTest", individual_1);
            test.SQL.People_Individual_Create(churchId, "AutoTest", individual_2);
            test.SQL.People_Individual_Create(churchId, "AutoTest", individual_3);
            test.SQL.People_Individual_Create(churchId, "AutoTest", individual_4);
            int individual_1_id = test.SQL.People_Individuals_FetchID(churchId, "AutoTest " + individual_1);
            int individual_2_id = test.SQL.People_Individuals_FetchID(churchId, "AutoTest " + individual_2);
            int individual_3_id = test.SQL.People_Individuals_FetchID(churchId, "AutoTest " + individual_3);
            int individual_4_id = test.SQL.People_Individuals_FetchID(churchId, "AutoTest " + individual_4);

            int attributeGroupId             = test.SQL.Admin_Fetch_AttributeGroupID(churchId, activeAttributeGroup);
            int attributeId_withStartDate    = test.SQL.Admin_Fetch_AttributeID(churchId, attributeGroupId, activeAttributeWithStartDate);
            int attributeId_withoutStartDate = test.SQL.Admin_Fetch_AttributeID(churchId, attributeGroupId, activeAttributeWithoutStartDate);

            test.SQL.Dashboard_Insert_IndividualAttribute(churchId, individual_1_id, attributeId_withStartDate, now, now.AddYears(100));
            test.SQL.Dashboard_Insert_IndividualAttribute(churchId, individual_2_id, attributeId_withStartDate, now.AddDays(-370), now.AddYears(-1));
            test.SQL.Dashboard_Insert_IndividualAttribute(churchId, individual_3_id, attributeId_withoutStartDate, now.AddYears(100), now.AddYears(100));
            test.SQL.Dashboard_Insert_IndividualAttribute(churchId, individual_4_id, attributeId_withStartDate, now.AddDays(-2), now);

            try
            {
                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))
                    {
                        if (turnedOnWidgetTotal == 6)
                        {
                            settings.turnOffMultiWidgets(widgetsTotal, 1);
                        }
                        settings.turnOnWidget(i);

                        settings.checkWidgetItem(i, 1);
                        break;
                    }
                }

                settings.closeSettingsPage();
                home.selectView("year");

                DateTime[] dateRange    = test.Dashboard.getDateRange(now, "year");
                int        subTotalInDb = test.SQL.Dashboard_AttributeGroup_GetPeriodSum(churchId, userId, attributeGroupId, dateRange[0], dateRange[1]);

                for (int i = 1; i <= turnedOnWidgetTotal; i++)
                {
                    if (home.getWidgetName(i).Contains(activeAttributeGroup))
                    {
                        string bigNumber      = home.getWidgetBigNumber(i);
                        int    subTotalOnPage = int.Parse(bigNumber.Replace(",", ""));


                        //Verify only individual_1 will be counted
                        TestLog.WriteLine(string.Format("Page: {0}|Db: {1}", subTotalOnPage, subTotalInDb));
                        Assert.AreEqual(subTotalOnPage, subTotalInDb, string.Format("The big number of attribute group should equal to {0}", subTotalInDb));
                        break;
                    }
                }
            }
            finally
            {
                //clear test data
                test.SQL.Dashboard_Delete_IndividualAttribute(churchId, individual_1_id, attributeId_withStartDate);
                test.SQL.Dashboard_Delete_IndividualAttribute(churchId, individual_2_id, attributeId_withStartDate);
                test.SQL.Dashboard_Delete_IndividualAttribute(churchId, individual_3_id, attributeId_withoutStartDate);
                test.SQL.Dashboard_Delete_IndividualAttribute(churchId, individual_4_id, attributeId_withStartDate);
                test.SQL.Admin_IndividualAttributes_Delete(churchId, activeAttributeGroup, activeAttributeWithoutStartDate);
                test.SQL.Admin_IndividualAttributes_Delete(churchId, activeAttributeGroup, activeAttributeWithStartDate);
                test.SQL.Admin_IndividualAttributeGroups_Delete(churchId, activeAttributeGroup);
                test.SQL.People_Individual_Delete(churchId, "AutoTest", individual_1);
                test.SQL.People_Individual_Delete(churchId, "AutoTest", individual_2);
                test.SQL.People_Individual_Delete(churchId, "AutoTest", individual_3);
                test.SQL.People_Individual_Delete(churchId, "AutoTest", individual_4);
            }
        }
Ejemplo n.º 15
0
        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);
            }
        }