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); }
public void TestOnboarding() { // Switch to VPN client session this.vpnClient.Session.SwitchTo(); LandingScreen landingScreen = new LandingScreen(this.vpnClient.Session); landingScreen.ClickLearnMoreHyperlink(); // Go to onboarding screen 1 OnboardingScreen onboardingScreen1 = new OnboardingScreen(this.vpnClient.Session, "OnboardingView1"); Assert.AreEqual("Skip", onboardingScreen1.GetSkipText()); Assert.AreEqual("Next", onboardingScreen1.GetNextButtonText()); Assert.AreEqual("No activity logs", onboardingScreen1.GetTitle()); Assert.AreEqual("We're Mozilla. We don't log your activity and we're always on your side.", onboardingScreen1.GetSubTitle()); onboardingScreen1.ClickNextButton(); // Go to onboarding screen 2 OnboardingScreen onboardingScreen2 = new OnboardingScreen(this.vpnClient.Session, "OnboardingView2"); Assert.AreEqual("Skip", onboardingScreen2.GetSkipText()); Assert.AreEqual("Next", onboardingScreen2.GetNextButtonText()); Assert.AreEqual("Device level encryption", onboardingScreen2.GetTitle()); Assert.AreEqual("No one will see your location or activity, even on unsecure Wi-Fi networks.", onboardingScreen2.GetSubTitle()); onboardingScreen2.ClickNextButton(); // Go to onboarding screen 3 OnboardingScreen onboardingScreen3 = new OnboardingScreen(this.vpnClient.Session, "OnboardingView3"); Assert.AreEqual("Skip", onboardingScreen3.GetSkipText()); Assert.AreEqual("Next", onboardingScreen3.GetNextButtonText()); Assert.AreEqual("Servers in 39 countries", onboardingScreen3.GetTitle()); Assert.AreEqual("Stand up to tech bullies and protect your access to the web.", onboardingScreen3.GetSubTitle()); onboardingScreen3.ClickNextButton(); // Go to onboarding screen 4 LastOnboardingScreen onboardingScreen4 = new LastOnboardingScreen(this.vpnClient.Session); Assert.AreEqual("Get started", onboardingScreen4.GetGetStartedButtonText()); Assert.AreEqual("Connect up to 5 devices", onboardingScreen4.GetTitle()); Assert.AreEqual("Stream, download and game. We won't restrict your bandwidth.", onboardingScreen4.GetSubTitle()); onboardingScreen4.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); Assert.AreEqual("VPN is off", mainScreen.GetTitle()); // Setting Screen UserCommonOperation.UserSignOut(this.vpnClient); }
/// <summary> /// Dispose the VPN session and close the app. /// </summary> public void Dispose() { // Close the application and delete the session if (this.Session != null) { this.Session.SwitchTo(); try { WindowsElement landingView = this.Session.FindElementByClassName("LandingView"); } catch (InvalidOperationException) { UserCommonOperation.UserSignOut(this); } this.Session.Quit(); this.Session = null; } }
public void TestExistingUserSignIn() { // 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); Assert.AreEqual("VPN is off", mainScreen.GetTitle()); // Setting Screen UserCommonOperation.UserSignOut(this.vpnClient); }
public void TestDevice() { // 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.ClickDeviceListButton(); // Device Screen DeviceScreen deviceScreen = new DeviceScreen(this.vpnClient.Session); Assert.AreEqual("My devices", deviceScreen.GetTitle()); Regex rgx = new Regex(@"^[1-5] of 5$"); Assert.IsTrue(rgx.IsMatch(deviceScreen.GetDeviceSummary())); rgx = new Regex(@"^Devices with Mozilla VPN installed using your account. Connect up to [0-9] devices.$"); Assert.IsTrue(rgx.IsMatch(deviceScreen.GetDevicePanelTitle())); Assert.IsTrue(deviceScreen.GetCurrentDeviceName().Contains(Environment.MachineName)); Assert.AreEqual("Current device", deviceScreen.GetCurrentDeviceStatus()); Assert.IsFalse(deviceScreen.GetCurrentDeviceRemoveButton().Displayed); // Try to remove one device if there are some other devices. deviceScreen.RandomDeleteOneDevice(this.desktop.Session); // Back to main screen this.vpnClient.Session.SwitchTo(); deviceScreen.ClickBackButton(); // Sign out UserCommonOperation.UserSignOut(this.vpnClient); }