public void TestFlightBooking()
        {
            DateTime depdateValue    = DateTime.Now.AddDays(2);
            string   depatureDate    = depdateValue.ToString("ddd") + " " + depdateValue.ToString("MMM dd yyyy");
            DateTime returndateValue = DateTime.Now.AddDays(3);
            string   returnDate      = returndateValue.ToString("ddd") + " " + returndateValue.ToString("MMM dd yyyy");

            actor.AttemptsTo(FlightBooking.For("Goa", "Mumbai", depatureDate, returnDate, 1, 1, "Economy"));
            actor.AttemptsTo(Click.On(FlightBookingPage.SearchButton));
            actor.AttemptsTo(Click.On(FlightBookingPage.DepFlight));
            actor.AttemptsTo(Click.On(FlightBookingPage.ReturnFlight));
            Thread.Sleep(3000);
            actor.AttemptsTo(Click.On(FlightBookingPage.BookNowButton));
            actor.AttemptsTo(Click.On(FlightBookingPage.ContinueButton));

            actor.AttemptsTo(SwitchWindow.To(actor.AskingFor(WindowHandle.Last())));
            actor.WaitsUntil(Appearance.Of(FlightConfirmationPage.DepartureFlightDetails), IsEqualTo.True());
            actor.WaitsUntil(Appearance.Of(FlightConfirmationPage.ReturnFlightDetails), IsEqualTo.True());
        }
Example #2
0
        /// <summary>
        /// Gets the latest window handle and switches to it.
        /// </summary>
        /// <param name="actor">The Screenplay actor.</param>
        public void PerformAs(IActor actor)
        {
            string handle = actor.AsksFor(WindowHandle.Latest());

            actor.AttemptsTo(SwitchWindow.To(handle));
        }