public void given_session_type_when_loading_with_driver_explicitly_should_load_with_driver() { Threaded <Session> .With(new LocalPhantomEnvironment()) .Verify(s => s.Driver is PhantomJSDriver) .End(); }
public static void OneTimeSetup(TestContext context) { var session = Threaded <Session> .With(new Tools.Chrome(TimeSpan.FromSeconds(10))); session.Driver.Navigate().GoToUrl(Settings.ResetAddress); _session = session; }
public void Given_session_type_When_loading_with_driver_explicitly_Then_should_load_with_driver() { Threaded <Session> .With(new HeadlessChrome()) .Verify(s => s.Driver is HeadlessChromeDriver) .End(); }
public void Given_different_thread_and_same_driver_environments_When_comparing_Then_should_not_be_equal() { var sessions = new ConcurrentDictionary <Guid, Session>(); Action action = () => { var session = Threaded <Session> .With <PhantomJS>(); sessions.TryAdd(Guid.NewGuid(), session); }; var tasks = Enumerable .Repeat(0, 2) .Select(x => Task.Run(action)); Task.WaitAll(tasks.ToArray()); var session1 = sessions.ToArray()[0].Value; var session2 = sessions.ToArray()[1].Value; session1.Should().NotBe(session2); session1.Driver.Should().NotBeNull(); session2.Driver.Should().NotBeNull(); session1.End(); session2.End(); }
public void given_driver_environment_when_loading_with_driver_should_return_session_with_correct_driver() { Threaded <Session> .With <LocalPhantomEnvironment>() .Verify(x => x.Driver is PhantomJSDriver) .End(); }
public void given_valid_logged_in_user_when_adding_task_should_add_task() { Threaded <Session> .With <Chrome>() .NavigateTo <LoggedOutPage>(Url) .Username.EnterText(ValidUsername) .Password.EnterText(Password) .Login.Click <UpgradePromptPage>() .NotNow.Click(); var taskInfo = new { Name = string.Format("Task {0}", Guid.NewGuid()), Note = "This is a note." }; Threaded <Session> .CurrentBlock <LoggedInPage>() .ToolBar .NewTask.Click() .Name.EnterText(taskInfo.Name) .Note.EnterText(taskInfo.Note) .Save.Click() .TaskLists.First(list => list.Name == "Actions") .TaskRows.First(row => row.Name == taskInfo.Name) .VerifyThat(row => row.Should().NotBeNull()) .Delete(); Threaded <Session> .End(); }
public void SupportPage_CanClickTheDownloadLink() { Threaded <Session> .With <Chrome>().NavigateTo <SupportPage>(SupportPage.Url) .DownloadButton().Click() .Verify("we're on the download page", page => page.GetElement(By.CssSelector("#mainContent h2")).Text == "Downloads"); }
public void Given_session_type_When_loading_with_driver_explicitly_Then_should_load_with_driver() { Threaded <Session> .With(new PhantomJS()) .Verify(s => s.Driver is PhantomJSDriver) .End(); }
public void given_session_has_been_loaded_with_driver_when_ending_should_end_session() { Threaded <Session> .With <LocalPhantomEnvironment>(); Threaded <Session> .End(); }
public void Given_session_has_been_loaded_with_driver_When_ending_Then_should_end_session() { Threaded <Session> .With <HeadlessChrome>(); Threaded <Session> .End(); }
public void HomePage_CanGetToDownloadPageFromSearchResults() { Threaded <Session> .With <Chrome>().NavigateTo <HomePage>(HomePage.Url) .SearchFor("Downloads") .SearchResults().First().Click() .Verify("we're on the download page", page => page.GetElement(By.CssSelector("#mainContent h2")).Text == "Downloads"); }
public void When_loading_with_generic_driver_Then_should_return_session_with_correct_driver_with_default_settings() { Threaded <Session> .With <PhantomJS>() .Verify(x => x.Driver is PhantomJSDriver) .VerifyThat(x => x.Settings.ShouldBeEquivalentTo(new Settings())) .End(); }
public void when_navigating_to_google_should_load_page() { Threaded <Session> .With <TDriverEnvironment>() .NavigateTo <GoogleSearch>("http://www.google.com") .Verify("that page contains text 'Google Search'", x => x.Session.Driver.PageSource.Contains("Google Search")) .Session.End(); }
public void Given_session_has_been_loaded_with_driver_When_ending_THen_should_end_session() { Threaded <Session> .With <PhantomJS>(); Threaded <Session> .End(); }
public void given_page_when_verifying_the_absence_of_element_should_not_find() { Threaded <Session> .With <LocalFirefoxEnvironment>() .NavigateTo <GoogleSearch>("http://www.google.com") .VerifyAbsence(By.Id("q")) .Session.End(); }
public void When_loading_with_driver_Then_should_return_session_with_correct_driver_with_default_settings() { Threaded <Session> .With(new HeadlessChrome()) .Verify(x => x.Driver is HeadlessChromeDriver) .VerifyThat(x => x.Settings.ShouldBeEquivalentTo(new Settings())) .End(); }
public void GivenIAmLoggedIn() { Threaded <Session> .With <LocalFirefoxEnvironment>() .NavigateTo <LoggedOutPage>(_settings.BaseUrl) .Username.EnterText(_settings.ValidUserName) .Password.EnterText(_settings.ValidPassword) .Login.Click <LoggedInPage>(); }
public void given_session_type_with_wrong_constructor_args_when_loading_with_driver_should_throw() { Action action = () => Threaded <DerivedSessionWithWrongArgs> .With <LocalPhantomEnvironment>(); action .ShouldThrow <ArgumentException>() .WithMessage("The result type specified (Bumblebee.IntegrationTests.Sessions.DerivedSessionWithWrongArgs) is not a valid session. It must have a constructor that takes only an IDriverEnvironment."); }
public void given_marriage_as_search_term_when_searching_from_home_page_should_return_results() { Threaded <Session> .With <LocalFirefoxEnvironment>() .NavigateTo <HomePage>("http://www.amazon.com") .NavBar .SearchField.EnterText("marriage" + Keys.Enter) .VerifyThat(p => p.Results.Should().NotBeEmpty()) .DebugPrint(x => x.Results.Select(r => r.Title.Text)); }
public void Init() { Threaded <Session> .With <InternetExplorer>() .NavigateTo <KendoDropDownListDemoPage>(Url) .Sizes .Options .First(x => x.Text == TextForSizeOption) .Click <KendoDropDownListDemoPage>(); }
public void GenericPage_CanClickAllTheMenuLinks() { Threaded <Session> .With <Chrome>().NavigateTo <HomePage>(HomePage.Url) .ProjectsNavigationLink().Click() .DownloadNavigationLink().Click() .DocumentationNavigationLink().Click() .SupportNavigationLink().Click() .AboutNavigationLink().Click() .Verify("the about page title exists", page => page.GetElement(By.CssSelector("#mainContent h2")).Text == "About Selenium"); }
public void given_session_already_loaded_with_navigation_when_getting_matching_current_block_should_return_block() { Threaded <Session> .With <LocalPhantomEnvironment>() .NavigateTo <LoggedOutPage>("https://www.nirvanahq.com/account/login"); Threaded <Session> .CurrentBlock <LoggedOutPage>() .Verify(x => x.Session.Driver.PageSource.Contains("Username or Email Address")) .Session.End(); }
public void Given_session_already_loaded_with_navigation_When_getting_matching_current_block_Then_should_return_block() { Threaded <Session> .With <PhantomJS>() .NavigateTo <CheckboxPage>(GetUrl("Checkbox.html")); Threaded <Session> .CurrentBlock <CheckboxPage>() .Verify(x => x.Session.Driver.PageSource.Contains("Unchecked")) .Session.End(); }
public void Given_session_type_with_wrong_constructor_args_When_loading_with_driver_Then_should_throw() { Action action = () => Threaded <DerivedSessionWithWrongArgs> .With <PhantomJS>(); var expectedMessage = String.Format(Threaded <DerivedSessionWithWrongArgs> .InvalidSessionTypeFormat, typeof(DerivedSessionWithWrongArgs)); action .ShouldThrow <ArgumentException>() .WithMessage(expectedMessage); }
public void When_loading_with_driver_and_custom_settings_Then_should_return_session_with_custom_settings() { var customSettings = new Settings { ScreenCapturePath = @"C:\Temp" }; Threaded <Session> .With(new PhantomJS(), customSettings) .VerifyThat(x => x.Settings.Should().Be(customSettings)) .End(); }
public void When_loading_with_generic_driver_and_custom_settings_Then_should_return_session_with_custom_settings() { var customSettings = new Settings { ScreenCapturePath = Environment.CurrentDirectory }; Threaded <Session> .With <PhantomJS>(customSettings) .VerifyThat(x => x.Settings.Should().Be(customSettings)) .End(); }
public void WhenILogin() { var username = ScenarioContext.Current.Get <string>("username"); var password = ScenarioContext.Current.Get <string>("password"); Threaded <Session> .With <InternetExplorer>() .NavigateTo <LoginPage>(string.Format("{0}/{1}", NancyHostSetup.BaseUrl, "Content/LoginPage.html")) .UsernameField.EnterText(username) .PasswordField.EnterText(password) .LoginButton.Click <GenericPage>(); }
public void given_search_terms_when_searching_for_flights_should_return_departure_choice_page() { Threaded <Session> .With <LocalFirefoxEnvironment>() .NavigateTo <HomePage>("https://www.aa.com/homePage.do") .FindFlightArea .From.EnterText("DFW") .VerifyThat(p => p.From.Text.Should().Be("DFW")) .LeavingOn.EnterText(DateTime.Now.AddDays(30).ToShortDateString()) .To.EnterText("LAS") .ReturningFrom.EnterText(DateTime.Now.AddDays(37).ToShortDateString()) .Search.Click <DepartureChoicePage>() .Session.End(); }
public void Given_session_already_loaded_When_loading_with_another_driver_Then_should_end_previous_session_driver_and_return_session_with_correct_driver() { Threaded <Session> .With <HeadlessChrome>() .Store(out var previousSession, s => s) .Verify(x => x.Driver is HeadlessChromeDriver); Threaded <Session> .With <InternetExplorer>() .Verify(x => x.Driver is InternetExplorerDriver) .End(); previousSession.Driver.Should().BeNull(); previousSession.End(); }
public void given_session_already_loaded_when_loading_with_another_driver_should_end_previous_session_driver_and_return_session_with_correct_driver() { Session previousSession; Threaded <Session> .With <LocalPhantomEnvironment>() .Store(out previousSession, s => s) .Verify(x => x.Driver is PhantomJSDriver); Threaded <Session> .With <LocalIeEnvironment>() .Verify(x => x.Driver is InternetExplorerDriver) .End(); previousSession.Driver.Should().BeNull(); previousSession.End(); }