示例#1
0
        public async Task LogOut()
        {
            //Arrange
            IReadOnlyList <Repository> visibleRepositoryList;

            //Act
            RepositoryPage.TapSettingsButton();

            //Assert
            Assert.AreEqual(GitHubLoginButtonConstants.Disconnect, SettingsPage.GitHubButtonText);

            //Act
            SettingsPage.TapGitHubButton();
            SettingsPage.WaitForGitHubLogoutToComplete();

            //Assert
            Assert.AreEqual(GitHubLoginButtonConstants.ConnectWithGitHub, SettingsPage.GitHubButtonText);

            //Act
            SettingsPage.TapBackButton();

            RepositoryPage.DeclineGitHubUserNotFoundPopup();
            RepositoryPage.TriggerPullToRefresh();
            await RepositoryPage.WaitForNoPullToRefresh().ConfigureAwait(false);

            //Assert
            visibleRepositoryList = RepositoryPage.GetVisibleRepositoryList();
            Assert.IsFalse(visibleRepositoryList.Any());
        }
示例#2
0
        public override async Task BeforeEachTest()
        {
            await base.BeforeEachTest().ConfigureAwait(false);

            RepositoryPage.WaitForPageToLoad();

            try
            {
                RepositoryPage.WaitForGitHubUserNotFoundPopup();
                RepositoryPage.AcceptGitHubUserNotFoundPopup();
            }
            catch
            {
                RepositoryPage.TapSettingsButton();
            }

            SettingsPage.WaitForPageToLoad();
            SettingsPage.DismissSyncfusionLicensePopup();

            SettingsPage.TapDemoModeButton();
            SettingsPage.WaitForGitHubLoginToComplete();

            SettingsPage.TapBackButton();

            RepositoryPage.WaitForPageToLoad();
        }
示例#3
0
        public async Task AppStoreScreenShotsTest()
        {
            //Arrange
            var screenRect = App.Query().First().Rect;

            //Act
            App.Screenshot("Repository Page Light");

            RepositoryPage.TapRepository(RepositoryPage.VisibleCollection.First().Name);

            await TrendsPage.WaitForPageToLoad().ConfigureAwait(false);

            App.TouchAndHoldCoordinates(screenRect.CenterX, screenRect.CenterY);
            App.Screenshot("Trends Page Light");

            TrendsPage.TapReferringSitesButton();
            await ReferringSitesPage.WaitForPageToLoad().ConfigureAwait(false);

            App.Screenshot("Referring Sites Page Light");

            ReferringSitesPage.ClosePage();
            await TrendsPage.WaitForPageToLoad().ConfigureAwait(false);

            TrendsPage.TapBackButton();
            await RepositoryPage.WaitForPageToLoad().ConfigureAwait(false);

            RepositoryPage.TapSettingsButton();
            await SettingsPage.WaitForPageToLoad().ConfigureAwait(false);

            App.Screenshot("Settings Page Light");

            await SettingsPage.SelectTheme(Mobile.Shared.PreferredTheme.Dark).ConfigureAwait(false);

            App.Screenshot("Settings Page Dark");

            SettingsPage.TapBackButton();
            await RepositoryPage.WaitForPageToLoad().ConfigureAwait(false);

            App.Screenshot("Repository Page Dark");

            RepositoryPage.TapRepository(RepositoryPage.VisibleCollection.First().Name);

            await TrendsPage.WaitForPageToLoad().ConfigureAwait(false);

            App.TouchAndHoldCoordinates(screenRect.CenterX, screenRect.CenterY);
            App.Screenshot("Trends Page Dark");

            TrendsPage.TapReferringSitesButton();
            await ReferringSitesPage.WaitForPageToLoad().ConfigureAwait(false);

            App.Screenshot("Referring Sites Page Dark");

            //Assert
        }
示例#4
0
        public async Task VerifyChartSettingsOptions()
        {
            //Arrange

            //Assert
            Assert.AreEqual(TrendsChartOption.All, SettingsPage.CurrentTrendsChartOption);

            //Act
            await SettingsPage.SetTrendsChartOption(TrendsChartOption.JustUniques).ConfigureAwait(false);

            //Assert
            Assert.AreEqual(TrendsChartOption.JustUniques, SettingsPage.CurrentTrendsChartOption);

            //Act
            await SettingsPage.SetTrendsChartOption(TrendsChartOption.All).ConfigureAwait(false);

            //Assert
            Assert.AreEqual(TrendsChartOption.All, SettingsPage.CurrentTrendsChartOption);

            //Act
            await SettingsPage.SetTrendsChartOption(TrendsChartOption.NoUniques);

            //Assert
            Assert.AreEqual(TrendsChartOption.NoUniques, SettingsPage.CurrentTrendsChartOption);

            //Act
            SettingsPage.TapBackButton();

            await RepositoryPage.WaitForPageToLoad().ConfigureAwait(false);

            await RepositoryPage.WaitForNoPullToRefreshIndicator().ConfigureAwait(false);

            var visibleRepositories = RepositoryPage.VisibleCollection;

            RepositoryPage.TapRepository(visibleRepositories.First().Name);

            await TrendsPage.WaitForPageToLoad().ConfigureAwait(false);

            //Assert
            Assert.IsTrue(TrendsPage.IsSeriesVisible(TrendsChartTitleConstants.TotalViewsTitle));
            Assert.IsTrue(TrendsPage.IsSeriesVisible(TrendsChartTitleConstants.TotalClonesTitle));
            Assert.IsFalse(TrendsPage.IsSeriesVisible(TrendsChartTitleConstants.UniqueViewsTitle));
            Assert.IsFalse(TrendsPage.IsSeriesVisible(TrendsChartTitleConstants.UniqueClonesTitle));
        }
示例#5
0
        public async Task VerifyNoRepositoriesAfterLogOut()
        {
            //Arrange

            //Act
            RepositoryPage.TapSettingsButton();
            await SettingsPage.WaitForPageToLoad().ConfigureAwait(false);

            //Assert
            Assert.AreEqual(GitHubLoginButtonConstants.Disconnect, SettingsPage.LoginTitleText);

            //Act
            SettingsPage.TapLoginButton();
            SettingsPage.WaitForGitHubLogoutToComplete();

            //Assert
            Assert.AreEqual(GitHubLoginButtonConstants.ConnectToGitHub, SettingsPage.LoginTitleText);

            //Act
            SettingsPage.TapBackButton();

            //Assert
            await WelcomePage.WaitForPageToLoad().ConfigureAwait(false);
        }
示例#6
0
        public override async Task BeforeEachTest()
        {
            await base.BeforeEachTest();

            RepositoryPage.TapSettingsButton();

            await SettingsPage.WaitForPageToLoad();

            SettingsPage.WaitForGitHubLoginToComplete();

            //Assert
            Assert.AreEqual(GitHubLoginButtonConstants.Disconnect, SettingsPage.LoginTitleText);

            //Act
            SettingsPage.TapLoginButton();
            SettingsPage.WaitForGitHubLogoutToComplete();

            //Assert
            Assert.AreEqual(GitHubLoginButtonConstants.ConnectToGitHub, SettingsPage.LoginTitleText);

            SettingsPage.TapBackButton();

            await WelcomePage.WaitForPageToLoad();
        }
示例#7
0
        public async Task AppStoreScreenShotsTest()
        {
            //Arrange
            var screenRect = App.Query().First().Rect;

            //Act
            await OnboardingPage.WaitForPageToLoad().ConfigureAwait(false);

            App.Screenshot("GitTrends Onboarding Page");

            await OnboardingPage.MoveToNextPage().ConfigureAwait(false);

            App.Screenshot("Charts Onboarding Page");

            await OnboardingPage.MoveToNextPage().ConfigureAwait(false);

            App.Screenshot("Notifications Onboarding Page");

            await OnboardingPage.MoveToNextPage().ConfigureAwait(false);

            App.Screenshot("Connect to GitHub Onboarding Page");

            await SetupLoggedInUser().ConfigureAwait(false);

            App.Screenshot("Repository Page Light");

            RepositoryPage.TapRepository(nameof(GitTrends));

            await TrendsPage.WaitForPageToLoad().ConfigureAwait(false);

            App.TouchAndHoldCoordinates(screenRect.CenterX, screenRect.CenterY);
            App.Screenshot("Trends Page Light");

            TrendsPage.TapReferringSitesButton();
            await ReferringSitesPage.WaitForPageToLoad().ConfigureAwait(false);

            App.Screenshot("Referring Sites Page Light");

            ReferringSitesPage.ClosePage();
            await TrendsPage.WaitForPageToLoad().ConfigureAwait(false);

            TrendsPage.TapBackButton();
            await RepositoryPage.WaitForPageToLoad().ConfigureAwait(false);

            RepositoryPage.TapSettingsButton();
            await SettingsPage.WaitForPageToLoad().ConfigureAwait(false);

            App.Screenshot("Settings Page Light");

            await SettingsPage.SelectTheme(PreferredTheme.Dark).ConfigureAwait(false);

            App.Screenshot("Settings Page Dark");

            SettingsPage.TapBackButton();
            await RepositoryPage.WaitForPageToLoad().ConfigureAwait(false);

            App.Screenshot("Repository Page Dark");

            RepositoryPage.TapRepository(nameof(GitTrends));

            await TrendsPage.WaitForPageToLoad().ConfigureAwait(false);

            App.TouchAndHoldCoordinates(screenRect.CenterX, screenRect.CenterY);
            App.Screenshot("Trends Page Dark");

            TrendsPage.TapReferringSitesButton();
            await ReferringSitesPage.WaitForPageToLoad().ConfigureAwait(false);

            App.Screenshot("Referring Sites Page Dark");

            //Assert
        }
示例#8
0
        public async Task VerifyLanguagePicker()
        {
            //Arrange
            string?preferredLanguage_Initial, preferredLanguage_Final;
            string gitHubNameText, gitHubAliasText, tryDemoButtonText, loginTitleLabelText_Disconnect, loginTitleLabelText_Connect,
                   themeTitleLabelText, languageTitleLabelText, settingsPageTitle, copyrightLabelTitleLabelText, registerForNotificationsTitleLabelText,
                   preferredChartsTitleTitleLabelText, preferredChartsAllTitleLabelText, preferredChartsNoUniquesTitleLabelText, preferredChartsOnlyUniquesTitleLabelText;


            foreach (var preferredLanguageKeyValuePair in CultureConstants.CulturePickerOptions.Reverse())
            {
                //Act
                preferredLanguage_Initial = SettingsPage.PreferredLanguage;

                await SettingsPage.SelectLanguage(preferredLanguageKeyValuePair.Value).ConfigureAwait(false);

                preferredLanguage_Final = SettingsPage.PreferredLanguage;

                settingsPageTitle                      = SettingsPage.PageTitle;
                gitHubNameText                         = SettingsPage.GitHubNameLabelText;
                gitHubAliasText                        = SettingsPage.GitHubAliasLabelText;
                themeTitleLabelText                    = SettingsPage.ThemeTitleLabelText;
                languageTitleLabelText                 = SettingsPage.LangageTitleLabelText;
                loginTitleLabelText_Disconnect         = SettingsPage.LoginTitleText;
                copyrightLabelTitleLabelText           = SettingsPage.CopyrightLabelText;
                preferredChartsTitleTitleLabelText     = SettingsPage.PreferredChartLabelText;
                registerForNotificationsTitleLabelText = SettingsPage.RegisterForNotificationsTitleLabelText;

                preferredChartsAllTitleLabelText         = TrendsChartConstants.TrendsChartTitles[TrendsChartOption.All];
                preferredChartsNoUniquesTitleLabelText   = TrendsChartConstants.TrendsChartTitles[TrendsChartOption.NoUniques];
                preferredChartsOnlyUniquesTitleLabelText = TrendsChartConstants.TrendsChartTitles[TrendsChartOption.JustUniques];

                SettingsPage.TapLoginButton();
                tryDemoButtonText           = SettingsPage.TryDemoButtonText;
                loginTitleLabelText_Connect = SettingsPage.LoginTitleText;

                await login().ConfigureAwait(false);

                SettingsPage.TapBackButton();

                //Assert
                Assert.AreEqual(PageTitles.RepositoryPage, RepositoryPage.PageTitle);

                Assert.AreNotEqual(preferredLanguage_Final, preferredLanguage_Initial);
                Assert.AreEqual(preferredLanguage_Final, string.IsNullOrWhiteSpace(preferredLanguageKeyValuePair.Key) ? null : preferredLanguageKeyValuePair.Key);

                Assert.AreEqual(PageTitles.SettingsPage, settingsPageTitle);
                Assert.AreEqual(SettingsPageConstants.Theme, themeTitleLabelText);
                Assert.AreEqual(GitHubLoginButtonConstants.TryDemo, tryDemoButtonText);
                Assert.AreEqual(SettingsPageConstants.Language, languageTitleLabelText);
                Assert.AreEqual(GitHubLoginButtonConstants.Disconnect, loginTitleLabelText_Disconnect);
                Assert.AreEqual(GitHubLoginButtonConstants.ConnectToGitHub, loginTitleLabelText_Connect);
                Assert.AreEqual(SettingsPageConstants.RegisterForNotifications, registerForNotificationsTitleLabelText);
                Assert.AreEqual(SettingsPageConstants.PreferredChartSettingsLabelText, preferredChartsTitleTitleLabelText);

                Assert.IsTrue(copyrightLabelTitleLabelText.Contains(SettingsPageConstants.CreatedBy));

                Assert.AreEqual(TrendsChartTitleConstants.All, preferredChartsAllTitleLabelText);
                Assert.AreEqual(TrendsChartTitleConstants.NoUniques, preferredChartsNoUniquesTitleLabelText);
                Assert.AreEqual(TrendsChartTitleConstants.JustUniques, preferredChartsOnlyUniquesTitleLabelText);

                if (UserType is UserType.Demo)
                {
                    Assert.AreEqual(DemoUserConstants.Name, gitHubNameText);
                    Assert.AreEqual("@" + DemoUserConstants.Alias, gitHubAliasText);
                }

                Assert.AreEqual(LoggedInUserName, gitHubNameText);
                Assert.AreEqual("@" + LoggedInUserAlias, gitHubAliasText);

                //Act
                RepositoryPage.TapSettingsButton();
                await SettingsPage.WaitForPageToLoad().ConfigureAwait(false);
            }
            ;

            async Task login()
            {
                if (UserType is UserType.Demo)
                {
                    SettingsPage.TapTryDemoButton();
                }
                else if (UserType is UserType.LoggedIn)
                {
                    await LoginToGitHub().ConfigureAwait(false);
                }
            }
        }