Ejemplo n.º 1
0
        public void TestVPNConnection()
        {
            // 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.ClickServerListButton();

            // Server Screen
            ServerListScreen serverListScreen = new ServerListScreen(this.vpnClient.Session);

            serverListScreen.RandomSelectDifferentCityServer("Miami");
            string prevCity = serverListScreen.GetSelectedCity();

            Console.WriteLine("Before switching: the selected city is {0}", prevCity);

            // User turns on VPN
            UserCommonOperation.ConnectVPN(this.vpnClient, this.desktop);

            // Click the server button
            mainScreen = new MainScreen(this.vpnClient.Session);
            mainScreen.ClickServerListButton();

            // Select a random US server
            serverListScreen = new ServerListScreen(this.vpnClient.Session);
            serverListScreen.RandomSelectDifferentCityServer("Atlanta");
            string currentCity = serverListScreen.GetSelectedCity();

            Console.WriteLine("After switching: the selected city is {0}", currentCity);

            // Check the subtitle
            Assert.AreEqual(string.Format("From {0} to {1}", prevCity, currentCity), mainScreen.GetSubtitle());

            // Check the windows notification again
            this.desktop.Session.SwitchTo();
            WindowsNotificationScreen windowsNotificationScreen = new WindowsNotificationScreen(this.desktop.Session);

            Assert.AreEqual(string.Format("From {0} to {1}", prevCity, currentCity), windowsNotificationScreen.GetTitleText());
            Assert.AreEqual("You switched servers.", windowsNotificationScreen.GetMessageText());
            windowsNotificationScreen.ClickDismissButton();

            // User turns off VPN
            UserCommonOperation.DisconnectVPN(this.vpnClient, this.desktop);

            // Sign out
            UserCommonOperation.UserSignOut(this.vpnClient);
        }