/// <summary> /// Read in configuration settings from App.config /// </summary> public void LoadTestSettings() { //Read app config values for test infrastructure configuration. If missing use the default values provided here string email = ReadConfigurationSetting(EMAIL_APP_CONFIG_ID); if (email != null) { UserName = email; } string password = ReadConfigurationSetting(PASSWORD_APP_CONFIG_ID); if (password != null) { Password = password; } string seleniumDriversLocation = ReadConfigurationSetting(SELENIUM_DRIVERS_LOCATION_APP_CONFIG_ID); if (seleniumDriversLocation != null) { SELENIUM_DRIVERS_LOCATION = seleniumDriversLocation; } string defaultBrowser = ReadConfigurationSetting(DEFAULT_BROWSER_APP_CONFIG_ID); if (seleniumDriversLocation != null) { DefaultBrowser = (Utility.Browser)Enum.Parse(typeof(Utility.Browser), defaultBrowser, true); } }
public void TestBrowser(Utility.Browser browser) { Utility.StartBrowserDriver(browser); TestBase.driver.Navigate().GoToUrl(TestBase.LOGIN_URL); var title = TestBase.driver.Title; NUnit.Framework.Assert.AreEqual("Gmail", title); }
public void LoginTest(Utility.Browser browser) { //Sign in IWebDriver driver = Utility.Login(browser); //Sign out driver.FindElement(By.XPath(ACCOUNT_OPTIONS_DROPDOWN_ID)).Click(); driver.FindElement(By.Id(TestBase.SIGNOUT_BUTTON_ID)).Click(); }
public void TestComposePage(Utility.Browser browser) { InboxPage inbox = new InboxPage(UserName, Password); ComposePage compose = new ComposePage(inbox); compose.CloseNewEmailWindow(); compose = new ComposePage(inbox); compose.CloseAndDiscardDraft(); inbox.SignOut(); }
public void TestLoginPage(Utility.Browser browser) { LoginPage page = new LoginPage(browser); page.Open(); page.EnterUserName(UserName); page.ClickNext(); page.EnterPassword(Password); page.ClickLogin(); //Verify login was successful NUnit.Framework.Assert.IsTrue(true, TestBase.UserName); }
public void TestInboxPage(Utility.Browser browser) { InboxPage inbox = new InboxPage(UserName, Password); List <GoogleEmail> emails = new List <GoogleEmail>(); //Write test to load emails emails = inbox.GetEmails(4, Utility.EmailState.Unread); //TODO // Assert/Validate emails content inbox.Compose(); }
/// <summary> /// Login helper method /// </summary> /// <param name="UserName"></param> /// <param name="Password"></param> /// <returns></returns> public static IWebDriver Login(string userName, string password, Utility.Browser browser) { LoginPage page = new LoginPage(browser); page.Open(); page.EnterUserName(userName); page.ClickNext(); page.EnterPassword(password); page.ClickLogin(); //Verify login was successful other tests should not continue if this fails NUnit.Framework.Assert.IsTrue(true, TestBase.UserName); return(driver); }
/// <summary> /// Initialize the browser driver /// </summary> /// <param name="browser"></param> /// <returns></returns> public static IWebDriver StartBrowserDriver(Utility.Browser browser) { switch (browser) { case Utility.Browser.Chrome: TestBase.driver = new ChromeDriver(GetFullPath(TestBase.SELENIUM_DRIVERS_LOCATION)); break; case Utility.Browser.Firefox: TestBase.driver = new FirefoxDriver(GetFullPath(TestBase.SELENIUM_DRIVERS_LOCATION)); break; case Utility.Browser.InternetExplorer: var options = new InternetExplorerOptions(); options.IntroduceInstabilityByIgnoringProtectedModeSettings = true; TestBase.driver = new InternetExplorerDriver(GetFullPath(TestBase.SELENIUM_DRIVERS_LOCATION), options); break; } return(TestBase.driver); }
/// <summary> /// Login helper method overload with default credentials /// </summary> /// <returns></returns> public static IWebDriver Login(Utility.Browser browser) { return(Login(UserName, Password, browser)); }