Ejemplo n.º 1
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.º 2
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
            }
        }