Пример #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
            }
        }
Пример #2
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);
            }
        }
Пример #3
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
            }
        }
Пример #4
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);
            }
        }