Inheritance: MonoBehaviour
示例#1
0
        /// <summary>
        /// The user sign out steps.
        /// </summary>
        /// <param name="vpnClient">VPN session.</param>
        public static void UserSignOut(FirefoxPrivateVPNSession vpnClient)
        {
            vpnClient.Session.SwitchTo();
            MainScreen mainScreen = new MainScreen(vpnClient.Session);

            if (mainScreen.GetOnImage().Displayed)
            {
                mainScreen.ToggleVPNSwitch();
            }

            mainScreen.ClickSettingsButton();
            SettingScreen settingScreen = new SettingScreen(vpnClient.Session);

            Assert.AreEqual("Settings", settingScreen.GetTitle());
            settingScreen.ScrollDown();
            settingScreen.ClickSignOutButton();
        }
示例#2
0
        public MainViewModel()
        {
            SettingCommand = new RelayCommand <object>((p) =>
            {
                return(true);
            }, (p) =>
            {
                SettingScreen ss = new SettingScreen();
                ss.ShowDialog();
            });

            CreateJourneyCommand = new RelayCommand <object>((p) => { return(true); }, (p) =>
            {
                CreateJourneyScreen cjs = new CreateJourneyScreen();
                cjs.ShowDialog();
            });
        }
示例#3
0
    public void Start()
    {
        Hardware          hardware   = new Hardware(840, 755, 24, false);
        WelcomeScreen     welcome    = new WelcomeScreen(hardware);
        SettingScreen     setting    = new SettingScreen(hardware);
        ControllerScreen  controller = new ControllerScreen(hardware);
        CreditsScreen     credits    = new CreditsScreen(hardware);
        MapCreationScreen mapedition = new MapCreationScreen(hardware);
        SelectLenguage    select     = new SelectLenguage(hardware);

        do
        {
            hardware.ClearScreen();
            select.Show();
            if (!welcome.GetExit())
            {
                welcome.Show();
                switch (welcome.GetChosenOption())
                {
                case 1:
                    setting.Show();
                    break;

                case 2:
                    mapedition.Show();
                    break;

                case 3:
                    controller.Show();
                    break;

                case 4:
                    credits.Show();
                    break;

                case 5:
                    welcome.GetExit();
                    break;
                }
            }
        } while (!welcome.GetExit());
    }
示例#4
0
        public void TestSetting()
        {
            // Switch to VPN client session
            this.vpnClient.Session.SwitchTo();
            LandingScreen landingScreen = new LandingScreen(this.vpnClient.Session);

            landingScreen.ClickGetStartedButton();

            // User Sign In via web browser
            UserCommonOperation.UserSignIn(this.vpnClient, this.browser);

            // Main Screen
            this.vpnClient.Session.SwitchTo();
            MainScreen mainScreen = new MainScreen(this.vpnClient.Session);

            mainScreen.ClickSettingsButton();

            // Setting Screen
            SettingScreen settingScreen = new SettingScreen(this.vpnClient.Session);

            Assert.IsNotNull(settingScreen.GetProfileImage());
            Assert.AreEqual(Environment.GetEnvironmentVariable("EXISTED_USER_NAME"), settingScreen.GetUserName());
            Assert.AreEqual("Manage account", settingScreen.GetManageAccountButtonText());
            Assert.AreEqual("Launch VPN app on computer startup", settingScreen.GetLaunchVPNStartupText());
            Assert.AreEqual("Notifications", settingScreen.GetNotificationButtonText());
            Assert.AreEqual("Network settings", settingScreen.GetNetworkSettingButtonText());
            Assert.AreEqual("Language", settingScreen.GetLanguageButtonText());
            Assert.AreEqual("About", settingScreen.GetAboutButtonText());
            Assert.AreEqual("Get help", settingScreen.GetHelpButtonText());
            Assert.AreEqual("Give feedback", settingScreen.GetGiveFeedbackText());
            Assert.IsTrue(settingScreen.GetLaunchVPNStartupCheckBox().Enabled);

            // Click Manage Account button
            settingScreen.ClickManageAccountButton();
            this.browser.Session.SwitchTo();
            Assert.IsTrue(this.browser.GetCurrentUrl().Contains(Constants.ManageAccountUrl));

            // Test checkbox state remain after nav
            bool prevLaunchVPNStartupState = settingScreen.GetLaunchVPNStartupCheckBox().Selected;

            settingScreen.ClickLaunchVPNStartupCheckbox();
            bool expectedCurrentLaunchVPNStartupState = !prevLaunchVPNStartupState;

            // Nav back to main screen
            settingScreen.ClickBackButton();

            // nav back to setting screen again to check the state remaining the same
            mainScreen = new MainScreen(this.vpnClient.Session);
            mainScreen.ClickSettingsButton();

            // Verify the state
            settingScreen = new SettingScreen(this.vpnClient.Session);
            bool currentLaunchVPNStartupState = settingScreen.GetLaunchVPNStartupCheckBox().Selected;

            Assert.AreEqual(expectedCurrentLaunchVPNStartupState, currentLaunchVPNStartupState);

            // Click the notification button
            settingScreen.ScrollDown();
            settingScreen.ClickNotificationButton();
            NotificationsScreen notificationsScreen = new NotificationsScreen(this.vpnClient.Session);

            Assert.AreEqual("Notifications", notificationsScreen.GetTitle());
            Assert.AreEqual("Unsecured network alert", notificationsScreen.GetUnsecuredNetworkAlertText());
            Assert.AreEqual("Get notified if you connect to an unsecured Wi-Fi network", notificationsScreen.GetUnsecuredNetworkAlertDescription());
            Assert.AreEqual("Guest Wi-Fi portal alert", notificationsScreen.GetGuestWifiPortalAlertText());
            Assert.AreEqual("Get notified if a guest Wi-Fi portal is blocked due to VPN connection", notificationsScreen.GetGuestWifiPortalAlertDescription());

            // Check the state remain after nav
            bool prevUnsecuredNetworkAlertState = notificationsScreen.IsUnsecuredNetworkAlertChecked();
            bool prevGuestWifiPortalAlertState  = notificationsScreen.IsGuestWifiPortalAlertChecked();

            notificationsScreen.ClickUnsecuredNetworkAlertCheckBox();
            notificationsScreen.ClickGuestWifiPortalAlertCheckBox();
            bool expectedCurrentUnsecuredNetworkAlertState = !prevUnsecuredNetworkAlertState;
            bool expectedCurrentGuestWifiPortalAlertState  = !prevGuestWifiPortalAlertState;

            // Nav back to setting screen
            notificationsScreen.ClickBackButton();
            settingScreen = new SettingScreen(this.vpnClient.Session);
            settingScreen.ClickNotificationButton();

            // Verifiy alert state
            notificationsScreen = new NotificationsScreen(this.vpnClient.Session);
            Assert.AreEqual(expectedCurrentUnsecuredNetworkAlertState, notificationsScreen.IsUnsecuredNetworkAlertChecked());
            Assert.AreEqual(expectedCurrentGuestWifiPortalAlertState, notificationsScreen.IsGuestWifiPortalAlertChecked());
            notificationsScreen.ClickBackButton();

            // Nav to Network Settings screen
            settingScreen = new SettingScreen(this.vpnClient.Session);
            settingScreen.ClickNetworkSettingButton();

            // On network settings screen
            NetworkSettingsScreen networkSettingsScreen = new NetworkSettingsScreen(this.vpnClient.Session);
            bool preEnableIPv6  = networkSettingsScreen.IsEnableIPv6Checked();
            bool preAllowAccess = networkSettingsScreen.IsAllowAccessChecked();

            Assert.AreEqual("Network settings", networkSettingsScreen.GetTitle());
            Assert.AreEqual("Enable IPv6", networkSettingsScreen.GetEnableIPv6CheckBoxText());
            Assert.AreEqual("Push the internet forward with the latest version of the Internet Protocol", networkSettingsScreen.GetEnableIPv6Description());
            Assert.IsFalse(networkSettingsScreen.IsEnableIPv6DisabledMessageDisplayed());
            Assert.AreEqual("Local network access", networkSettingsScreen.GetAllowAccessText());
            Assert.AreEqual("Access printers, streaming sticks and all other devices on your local network", networkSettingsScreen.GetAllowAccessDescription());
            Assert.IsFalse(networkSettingsScreen.IsAllowAccessDisabledMessageDisplayed());

            // check the checkbox state after click
            networkSettingsScreen.ClickAllowAccessCheckBox();
            networkSettingsScreen.ClickEnableIPv6CheckBox();
            bool expectedEnableIPv6  = !preEnableIPv6;
            bool expectedAllowAccess = !preAllowAccess;

            networkSettingsScreen.ClickBackButton();

            // Back to main screen to turn on vpn
            settingScreen = new SettingScreen(this.vpnClient.Session);
            settingScreen.ClickBackButton();
            mainScreen = new MainScreen(this.vpnClient.Session);
            mainScreen.ToggleVPNSwitch();
            mainScreen.ClickSettingsButton();

            // Check Network setting screen again
            settingScreen = new SettingScreen(this.vpnClient.Session);
            settingScreen.ScrollDown();
            settingScreen.ClickNetworkSettingButton();
            networkSettingsScreen = new NetworkSettingsScreen(this.vpnClient.Session);
            bool currentAllowAccessState = networkSettingsScreen.IsAllowAccessChecked();
            bool currentEnableIPv6       = networkSettingsScreen.IsEnableIPv6Checked();

            Assert.AreEqual(expectedAllowAccess, currentAllowAccessState);
            Assert.AreEqual(expectedEnableIPv6, currentEnableIPv6);
            Assert.IsFalse(networkSettingsScreen.IsAllowAccessEnabled());
            Assert.IsTrue(networkSettingsScreen.IsAllowAccessDisabledMessageDisplayed());
            Assert.AreEqual($"VPN must be off before {(currentAllowAccessState ? "disabling" : "enabling")}", networkSettingsScreen.GetAllowAccessDisabledMessage());
            Assert.IsFalse(networkSettingsScreen.IsEnableIPv6Enabled());
            Assert.IsTrue(networkSettingsScreen.IsEnableIPv6DisabledMessageDisplayed());
            Assert.AreEqual($"VPN must be off before {(currentEnableIPv6 ? "disabling" : "enabling")}", networkSettingsScreen.GetEnableIPv6DisabledMessage());
            networkSettingsScreen.ClickBackButton();

            // Back to main screen to turn off vpn
            settingScreen = new SettingScreen(this.vpnClient.Session);
            settingScreen.ClickBackButton();
            mainScreen = new MainScreen(this.vpnClient.Session);
            mainScreen.ToggleVPNSwitch();
            mainScreen.ClickSettingsButton();

            // Nav to language screen
            settingScreen = new SettingScreen(this.vpnClient.Session);
            settingScreen.ScrollDown();
            settingScreen.ClickLanguageButton();

            // On language screen
            LanguageScreen languageScreen = new LanguageScreen(this.vpnClient.Session);

            languageScreen.RandomPickAdditionalLanguage();

            // Reset back to English
            languageScreen.ClickDefaultLanguageRadioButton();
            languageScreen.ClickBackButton();

            // Nav to About screen
            settingScreen = new SettingScreen(this.vpnClient.Session);
            settingScreen.ClickAboutButton();

            // About screen
            AboutScreen aboutScreen = new AboutScreen(this.vpnClient.Session);

            Assert.AreEqual("Firefox Private Network", aboutScreen.GetFPNTitle());
            Assert.AreEqual("A fast, secure and easy to use VPN \r\n(Virtual Private Network).", aboutScreen.GetFPNSubtitle());
            Assert.AreEqual("Release version", aboutScreen.GetReleaseTitle());
            Console.WriteLine($"Version: {aboutScreen.GetReleaseVersion()}");
            Assert.IsTrue(Regex.IsMatch(aboutScreen.GetReleaseVersion(), @"^\d+.\d+[abAB]?$"));

            // Click terms of service button
            this.vpnClient.Session.SwitchTo();
            aboutScreen.ClickTermsOfService();
            this.browser.Session.SwitchTo();
            string actualTermsOfServiceUrl = this.browser.GetCurrentUrl();

            Console.WriteLine($"Terms of service url: {actualTermsOfServiceUrl}");
            Assert.IsTrue(actualTermsOfServiceUrl.Contains(Constants.TermsOfServiceUrl));

            // Click privacy policy button
            this.vpnClient.Session.SwitchTo();
            aboutScreen.ClickPrivacyPolicy();
            this.browser.Session.SwitchTo();
            string actualPrivacyPolicyUrl = this.browser.GetCurrentUrl();

            Console.WriteLine($"Privacy Policy url: {actualPrivacyPolicyUrl}");
            Assert.IsTrue(actualPrivacyPolicyUrl.Contains(Constants.PrivacyPolicyUrl));

            // Click the Debug button
            this.vpnClient.Session.SwitchTo();
            aboutScreen.ClickDebug();

            // On Privacy Notice popup
            PrivacyNoticePopup privacyNoticePopup = new PrivacyNoticePopup(this.vpnClient.Session);

            Assert.AreEqual(Utils.CleanText(Constants.PrivacyNotice), Utils.CleanText(privacyNoticePopup.GetPrivacyNoticeDetails()));
            privacyNoticePopup.ClickYesButton();

            // Open Export Debug package window
            ExportWindow exportDebugPackageWindow = new ExportWindow(this.vpnClient.Session, "Export debug package");

            exportDebugPackageWindow.SaveFile(this.folderPath, this.debugFileName);
            Assert.IsTrue(Utils.WaitUntilFileExist(Path.Combine(this.folderPath, this.debugFileName)));

            // Click viewlog button
            aboutScreen.ClickViewLog();
            LogWindow logWindow = new LogWindow(this.desktop.Session);

            Assert.AreEqual("Timestamp", logWindow.GetTimeStampColumnHeader());
            Assert.AreEqual("Message", logWindow.GetMessageColumnHeader());
            Assert.IsTrue(logWindow.GetNumberOfLogs() > 0);

            // Click save button on view log window
            logWindow.ClickSaveButton();

            // Open SaveLog window
            ExportWindow saveLogWindow = new ExportWindow(this.desktop.Session, "Save log");

            saveLogWindow.SaveFile(this.folderPath, this.logFileName);
            Assert.IsTrue(Utils.WaitUntilFileExist(Path.Combine(this.folderPath, this.logFileName)));

            // Back to setting screen
            logWindow.CloseWindow();
            aboutScreen.ClickBackButton();

            // Click Get Help button
            settingScreen = new SettingScreen(this.vpnClient.Session);
            settingScreen.ClickGetHelpButton();

            // On Get Help Screen
            GetHelpScreen getHelpScreen = new GetHelpScreen(this.vpnClient.Session);

            Assert.AreEqual("Get help", getHelpScreen.GetTitle());
            Assert.AreEqual("Contact us", getHelpScreen.GetContactUs());
            Assert.AreEqual("Help & Support", getHelpScreen.GetHelpAndSupport());

            // Click contact us button
            this.vpnClient.Session.SwitchTo();
            getHelpScreen.ClickContactUs();
            this.browser.Session.SwitchTo();
            string actualContactUsUrl = this.browser.GetCurrentUrl();

            Console.WriteLine($"Contact us url: {actualContactUsUrl}");
            Assert.IsTrue(actualContactUsUrl.Contains(Constants.ContactUsUrl));

            // Click help and support button
            this.vpnClient.Session.SwitchTo();
            getHelpScreen.ClickHelpAndSupport();
            this.browser.Session.SwitchTo();
            string actualHelpSupportUrl = this.browser.GetCurrentUrl();

            Console.WriteLine($"Help and support url: {actualHelpSupportUrl}");
            Assert.IsTrue(actualHelpSupportUrl.Contains(Constants.SupportUrl));

            // Back to setting screen
            this.vpnClient.Session.SwitchTo();
            getHelpScreen.ClickBackButton();

            // Click Give feedback button
            settingScreen = new SettingScreen(this.vpnClient.Session);
            settingScreen.ClickGiveFeedbackLink();
            this.browser.Session.SwitchTo();
            Assert.IsTrue(this.browser.GetCurrentUrl().Contains(Constants.FeedbackUrl));

            // Sign out
            this.vpnClient.Session.SwitchTo();
            settingScreen.ClickSignOutButton();
        }
示例#5
0
        public void TestNewUserSignIn()
        {
            // Switch to VPN client session
            this.vpnClient.Session.SwitchTo();
            LandingScreen landingScreen = new LandingScreen(this.vpnClient.Session);

            landingScreen.ClickGetStartedButton();

            // Verify Account Screen
            this.vpnClient.Session.SwitchTo();
            VerifyAccountScreen verifyAccountScreen = new VerifyAccountScreen(this.vpnClient.Session);

            Assert.AreEqual("Waiting for sign in and subscription confirmation...", verifyAccountScreen.GetTitle());
            Assert.AreEqual("Cancel and try again", verifyAccountScreen.GetCancelTryAgainButtonText());

            // Switch to Browser session
            this.browser.Session.SwitchTo();

            // Email Input page
            EmailInputPage emailInputPage = new EmailInputPage(this.browser.Session);

            emailInputPage.InputEmail(Constants.NewUserEmail);
            emailInputPage.ClickContinueButton();

            // Registration password Input Page
            RegisterPage registerPage = new RegisterPage(this.browser.Session);

            registerPage.InputPassword(Environment.GetEnvironmentVariable("EXISTED_USER_PASSWORD"));
            registerPage.InputRepeatPassword(Environment.GetEnvironmentVariable("EXISTED_USER_PASSWORD"));
            registerPage.InputAge("50");
            registerPage.ClickCreateAccountButton();

            // Get verification code from API
            string verificationCode = Utils.GetVerificationCode(Constants.NewUserName);

            // Enter verification code page
            VerificationCodePage verificationCodePage = new VerificationCodePage(this.browser.Session);

            verificationCodePage.InputVerificationCode(verificationCode);
            verificationCodePage.ClickVerifyButton();

            // Enter subscription page
            string subscriptionPageUrl = string.Empty;

            Utils.WaitUntil(ref subscriptionPageUrl, (str) => this.browser.GetCurrentUrl(), null, (str) => str.Contains(Constants.KeyWordInPaymentUrl));
            SubscriptionPage subscriptionPage = new SubscriptionPage(this.browser.Session);

            subscriptionPage.InputFullName(Constants.NewUserName);
            subscriptionPage.InputCardNumber(Environment.GetEnvironmentVariable("NEW_USER_CARD_NUMBER"));
            subscriptionPage.InputExpDate(Environment.GetEnvironmentVariable("NEW_USER_CARD_EXP_DATE"));
            subscriptionPage.InputCVC(Environment.GetEnvironmentVariable("NEW_USER_CARD_CVC"));
            subscriptionPage.InputZipCode(Environment.GetEnvironmentVariable("NEW_USER_ZIP_CODE"));
            subscriptionPage.ClickAuthorizeCheckBox();
            subscriptionPage.ClickSubmitButton();

            // Subscription Success Page
            SubscriptionSuccessPage subscriptionSuccessPage = new SubscriptionSuccessPage(this.browser.Session);

            subscriptionSuccessPage.ClickTakeMeToProductLink();

            // Quick Access Screen
            this.vpnClient.Session.SwitchTo();
            QuickAccessScreen quickAccessScreen = new QuickAccessScreen(this.vpnClient.Session);

            Assert.AreEqual("Quick access", quickAccessScreen.GetTitle());
            Assert.AreEqual("You can quickly access Firefox Private Network from your taskbar tray", quickAccessScreen.GetSubTitle());
            Assert.AreEqual("Located next to the clock at the bottom right of your screen", quickAccessScreen.GetDescription());
            quickAccessScreen.ClickContinueButton();

            // On main screen
            MainScreen main = new MainScreen(this.vpnClient.Session);

            main.ClickSettingsButton();

            // On setting screen
            SettingScreen settingScreen = new SettingScreen(this.vpnClient.Session);

            settingScreen.ClickManageAccountButton();

            // Open an account page in browser
            this.browser.Session.SwitchTo();
            emailInputPage = new EmailInputPage(this.browser.Session);
            emailInputPage.InputEmail(Constants.NewUserEmail);
            emailInputPage.ClickContinueButton();

            // Go to password input page
            PasswordInputPage passwordInputPage = new PasswordInputPage(this.browser.Session);

            passwordInputPage.InputPassword(Environment.GetEnvironmentVariable("EXISTED_USER_PASSWORD"));
            passwordInputPage.ClickSignInButton();

            // Go to account management page
            ManageAccountPage manageAccountPage = new ManageAccountPage(this.browser.Session);

            manageAccountPage.ClickDeleteButton();
            manageAccountPage.ConfirmDeleteAccount(Environment.GetEnvironmentVariable("EXISTED_USER_PASSWORD"));

            // User sign out
            this.vpnClient.Session.SwitchTo();
            settingScreen.ScrollDown();
            settingScreen.ClickSignOutButton();
        }