public void BeforeEachTest()
        {
            app = ConfigureApp.Android.StartApp ();
            app.Screenshot ("Given the app is loaded");
            app.Tap (x => x.Button ("btn_play"));

            app.WaitForElement (x => x.Id ("tv_bingoItem"));

            var results = app.Query (x => x.Id ("tv_bingoItem"));
            Assert.AreEqual (25, results.Length);
            app.Screenshot ("25 items should be shown");
        }
Ejemplo n.º 2
0
        public void SignIn()
        {
            app.Tap(x => x.Class("FormsTextView").Text("SIGN IN"));
            app.Screenshot("Tapped on view FormsTextView with Text: 'SIGN IN'");

            app.Tap(x => x.Class("WebView").Id("agentWebView").Css("#cred_userid_inputtext"));
            app.EnterText(x => x.Class("WebView").Id("agentWebView").Css("#cred_userid_inputtext"), "*****@*****.**");
            app.Tap(x => x.Class("WebView").Id("agentWebView").Css("#cred_password_inputtext"));
            app.EnterText(x => x.Class("WebView").Id("agentWebView").Css("#cred_password_inputtext"), "P@ssword");
            app.Screenshot("Username and password entered");

            app.Tap(x => x.Class("WebView").Id("agentWebView").Css("#cred_sign_in_button"));
            app.Screenshot("Tapped on sign in button");
        }
Ejemplo n.º 3
0
 public void ClickingHamburgerShouldRevealDrawer()
 {
     app.Screenshot("Launch");
     app.Tap(t => t.Class("ImageButton"));
     app.WaitForElement(t => t.Text("Discussion"));
     app.Screenshot("Tap Hamburger");
 }
        protected BasePage(AndroidApp app, Func<AppQuery, AppQuery> androidTrait)
            : this(app)
        {
            Assert.DoesNotThrow(() => app.WaitForElement(androidTrait), "Unable to verify on page: " + this.GetType().Name);

            app.Screenshot("On " + this.GetType().Name);
        }
Ejemplo n.º 5
0
        public void SignInPageDisplayed()
        {
            AppResult[] results = app.WaitForElement(c => c.Marked(" Sign in to Sample App"));
            app.Screenshot("Sign In screen.");

            Assert.IsTrue(results.Any());
        }
Ejemplo n.º 6
0
 public void AppDidLaunch()
 {
     app.WaitForElement(c => c.Id("fab"));
     app.Tap(c => c.Id("fab"));
     Assert.AreNotEqual("ERROR!", app.Query(c => c.Id("textView1"))[0].Text);
     app.Screenshot("App launched");
 }
Ejemplo n.º 7
0
        public void VerticalPhrases()
        {
            app.Tap(x => x.Class("TextView").Index(1));
            app.Tap(x => x.Class("TextView").Index(6));
            app.Tap(x => x.Class("TextView").Index(11));
            app.Tap(x => x.Class("TextView").Index(16));
            app.Screenshot("4 in a column are selected");
            app.Tap(x => x.Class("TextView").Index(21));

            app.WaitForElement(x => x.Id("alertTitle"));

            var results = app.Query(x => x.Id("alertTitle"));

            Assert.AreEqual("You won, congratulations!", results [0].Text);
            app.Screenshot("A Congratulating dialog should appear");
        }
Ejemplo n.º 8
0
        public void TapRandomButtonsTest()
        {
            var rand = new Random();

            for (var i = 0; i < 10; i++)
            {
                var buttons = _app.Query(c => c.Button()).ToArray();

                if (!buttons.Any())
                {
                    break;
                }

                try
                {
                    _app.Tap(c => c.Button().Index(rand.Next(0, buttons.Length - 1)));
                }
                catch
                {
                    // Fail silently, this is probably due to the number of buttons on the page being reduced between
                    // the app.Query() and the app.Tap().
                }

                var word = i == 0 ? "a" : "another";

                _app.Screenshot($"Tapped {word} random button");

                Thread.Sleep(3000);  // This should allow any animations to complete in most cases
            }
        }
Ejemplo n.º 9
0
        public CustomerSalesPage(AndroidApp app)
            : base(app)
        {
            app.WaitForElement("WEEKLY AVERAGE", timeout: TimeSpan.FromMinutes(2));

            app.Screenshot("On " + this.GetType().Name);
        }
Ejemplo n.º 10
0
        public void WelcomeTextIsDisplayed()
        {
            AppResult[] results = app.WaitForElement(c => c.Marked("Welcome to Xamarin Forms!"));
            app.Screenshot("Welcome screen.");

            Assert.IsTrue(results.Any());
        }
Ejemplo n.º 11
0
        protected BasePage(AndroidApp app, Func <AppQuery, AppQuery> androidTrait)
            : this(app)
        {
            Assert.DoesNotThrow(() => app.WaitForElement(androidTrait), "Unable to verify on page: " + this.GetType().Name);

            app.Screenshot("On " + this.GetType().Name);
        }
Ejemplo n.º 12
0
        public void AppLaunches()
        {
            app.Repl();
            app.Screenshot("First screen.");
            app.Screenshot("");
            //app.Tap()
            app.Tap("NoResourceEntry-11");
            app.Tap("NoResourceEntry-18");
            app.EnterText("5541380221");

            app.Tap("NoResourceEntry-21");
            app.EnterText("drfgdfgdf");

            app.Tap("NoResourceEntry-22");
            app.Screenshot("First screen.");
        }
        public CustomerSalesPage(AndroidApp app)
            : base(app)
        {
            app.WaitForElement("WEEKLY AVERAGE", timeout: TimeSpan.FromMinutes(2));

            app.Screenshot("On " + this.GetType().Name);
        }
Ejemplo n.º 14
0
 public void AppLaunches()
 {
     app.Screenshot("First screen.");
     app.EnterText(c => c.Marked("WeightText"), "70");
     app.EnterText(c => c.Marked("HeightText"), "1.8");
     app.Tap(c => c.Marked("Calculate"));
     app.WaitForElement(c => c.Marked("ResultText").Text("21.6"));
 }
Ejemplo n.º 15
0
        public void AppLaunches()
        {
            //Carousel Swipe
            app.SwipeRightToLeft();
            app.WaitForElement(x => x.Id("NoResourceEntry-1"));
            app.SwipeRightToLeft();
            app.WaitForElement(x => x.Id("NoResourceEntry-2"));
            app.SwipeRightToLeft();
            app.WaitForElement(x => x.Id("NoResourceEntry-3"));
            app.SwipeRightToLeft();
            app.Screenshot("LoginPage");

            //Login Credentials
            app.WaitForElement(x => x.Marked("Email address"));
            app.Tap(x => x.Index(48));
            app.EnterText("*****@*****.**");
            app.DismissKeyboard();
            app.Tap(x => x.Button("btnContinue"));
            app.WaitForElement(x => x.Marked("PIN"));
            app.EnterText("6804");
            app.DismissKeyboard();
            app.Tap(x => x.Button("btnContinue"));
            app.Screenshot("Logging in with my credentials");

            //End of Introduction
            app.WaitForElement(x => x.Marked("NEXT"));
            app.Flash(x => x.Marked("NEXT"));
            app.Tap(x => x.Marked("NEXT"));
            app.Tap(x => x.Marked("NEXT"));
            app.Tap(x => x.Marked("NEXT"));
            app.Tap(x => x.Marked("OK, GOT IT"));
            app.Screenshot("End of Introduction");
            app.Back();

            //Hollenbeck Home
            app.Flash(x => x.Marked("Hollenbeck Home"));
            app.Tap(x => x.Marked("Hollenbeck Home"));
            app.WaitForElement(x => x.Marked("SCHEDULE A TOUR"));
            app.ScrollDownTo(x => x.Marked("MORE"));
            app.Tap(x => x.Marked("Prices (starting at)"));
            Thread.Sleep(TimeSpan.FromSeconds(3));
            app.Screenshot("Hollenbeck Home Info");
            app.Back();

            app.Repl();
        }
Ejemplo n.º 16
0
        public void CreditCardNumber_TooShort_DisplayErrorMessage()
        {
            //First, wait for the default screen and set context on the input box.
            //Take a screenshot
            app.WaitForElement(c => c.Marked("action_bar_title").Text("Enter Credit Card Number"));
            app.Screenshot("Default View");

            //Then, enter a string of digits and take a screenshot
            app.EnterText(c => c.Marked("creditCardNumberText"), new string('9', 15));
            app.Screenshot("Text Entered");
            app.WaitForElement(c => c.Marked("action_bar_title").Text("Enter Credit Card Number"));

            //Finally, progress with validation and verify the message.
            app.Tap(c => c.Marked("validateButton"));
            app.WaitForElement(c => c.Marked("errorMessagesText").Text("Credit card number is too short."));
            app.Screenshot("Complete");
        }
Ejemplo n.º 17
0
        public void AppLaunches()
        {
            app.Flash(x => x.Id("txt"));
            app.Tap(x => x.Id("txt"));
            app.Tap(x => x.Text("Technology"));
            Thread.Sleep(TimeSpan.FromSeconds(4));
            app.Screenshot("Flashed and Tapped 'All' button, then Tapped 'Technology' button");

            app.Flash(x => x.Id("ab_refresh"));
            app.Tap(x => x.Id("ab_refresh"));
            app.Screenshot("Flashed and Tapped refresh button");

            app.Flash(x => x.Id("ab_search"));
            app.Tap(x => x.Id("ab_search"));
            app.EnterText("Microsoft");
            app.Screenshot("Entered Microsoft");

            Thread.Sleep(TimeSpan.FromSeconds(2));
            app.PressEnter();
            app.Screenshot("Searched for 'Microsoft' in the Search Bar");

            app.ScrollDown();
            Thread.Sleep(TimeSpan.FromSeconds(1));
            app.ScrollDown();
            Thread.Sleep(TimeSpan.FromSeconds(1));
            app.Screenshot("Swiped down a few times");

            app.WaitForElement(x => x.Marked("Facebook, Microsoft to Run Mega-Cable From Va. to Spain"));
            app.Flash(x => x.Marked("Facebook, Microsoft to Run Mega-Cable From Va. to Spain"));
            app.Screenshot("Flashed Microsoft News Article");

            Thread.Sleep(TimeSpan.FromSeconds(2));
            app.Tap(x => x.Marked("Facebook, Microsoft to Run Mega-Cable From Va. to Spain"));
            app.Screenshot("Tapped on Microsoft and Facebook Article'");
        }
Ejemplo n.º 18
0
 public void ClickingHamburgerShouldRevealDrawer()
 {
     app.Screenshot("Launch");
     app.Tap(t => t.Marked("Navigate up"));
     app.WaitForElement(t => t.Text("Discussion"));
     app.Screenshot("Tap Hamburger");
 }
Ejemplo n.º 19
0
        public void BeforeEachTest()
        {
            app = ConfigureApp
                  .Android
                  .PreferIdeSettings()
                  .StartApp();

            app.Screenshot("First screen.");
        }
Ejemplo n.º 20
0
        public void PhaseListViewEnabled()
        {
            //arrange & act
            app.Screenshot("First screen.");
            var phaseListView = app.WaitForElement("PhasesListView");

            //assert
            Assert.That(phaseListView.First().Enabled);
        }
Ejemplo n.º 21
0
        public void AppLaunches()
        {
            app.WaitForElement(x => x.Text(("Use my phone number")));
            app.Flash(x => x.Text("Use my phone number"));
            app.Tap(x => x.Text("Use my phone number"));
            app.Screenshot("Phone Number Field");

            app.Tap(x => x.Id("dgts__countryCode"));
            app.Screenshot("Country Code Field");

            app.ScrollDownTo((x => x.Id("text1").Text("United States +1")));
            app.Tap(x => x.Id("text1").Text("United States +1"));
            app.Screenshot("Scrolling down to United States Field");

            app.EnterText("4087188819");
            app.Screenshot("Phone number Field");
            app.Tap((x => x.Text("Continue")));
        }
Ejemplo n.º 22
0
        public void TamperedEnabled_CappuccinoTest()
        {
            app.Tap(x => x.Marked("DrinkType"));
            app.Screenshot("Tapped Drink Type");

            app.Tap(x => x.Marked("Cappuccino"));
            app.Screenshot("Tapped on Cappuccino");

            app.DismissKeyboard();

            app.Screenshot("Dismissed Keyboard");
            var result = app.Query("Tamered").First();

            Assert.IsTrue(result.Enabled, "Tampered is enabled");
        }
Ejemplo n.º 23
0
        public void ClickSubmitButton(string firstName, string lastname)
        {
            Func <AppQuery, AppQuery> firstNameEditText = c => c.Id("firstNameEditText");
            Func <AppQuery, AppQuery> lastNameEditText  = c => c.Id("lastNameEditText");
            Func <AppQuery, AppQuery> submitButton      = c => c.Id("submitButton");
            Func <AppQuery, AppQuery> statusTextView    = c => c.Id("statusTextView");

            app.EnterText(firstNameEditText, firstName);
            app.EnterText(lastNameEditText, lastname);
            app.Screenshot("Name entered");
            app.Tap(submitButton);

            AppResult [] results = app.Query(statusTextView);
            app.Screenshot("Submit Button Pressed");

            var t = results [0].Text;

            Assert.AreEqual($"Thank you {firstName} {lastname}", results [0].Text);
        }
Ejemplo n.º 24
0
        public static void ScrollDownAndTap(this AndroidApp app, Func <AppQuery, AppQuery> lambda = null, string screenshot = null)
        {
            app.ScrollDownEnough(lambda);
            app.Tap(lambda);

            if (screenshot != null)
            {
                app.Screenshot(screenshot);
            }
        }
Ejemplo n.º 25
0
        private FileInfo TakeScreenshotOfExample(string exampleName)
        {
            // need to ensure that we take screenshot with same orientation
            _app.SetOrientationPortrait();

            _app.WaitForElement(c => c.Marked("examplesList"));

            _app.ScrollDownTo(c => c.Text(exampleName));

            _app.Screenshot(exampleName);

            _app.Tap(c => c.Text(exampleName));

            _app.WaitForElement(c => c.Marked("fragment_container"));

            _app.Invoke("InitExampleForUiTest");

            return(_app.Screenshot(exampleName));
        }
Ejemplo n.º 26
0
        public void CollectSymbols()
        {
            try
            {
                _app.Tap(q => q.Id("btnUpload"));
                var totalWaitTimeSeconds = 40 * 60;
                var retryCounter         = 200;
                var iterationTimeout     = TimeSpan.FromSeconds(totalWaitTimeSeconds / retryCounter);
                while (true)
                {
                    try
                    {
                        _app.WaitForElement(query => query.Id("done_text"), timeout: iterationTimeout);
                        _app.Screenshot("💯");
                        break;
                    }
                    catch (Exception e) when(e.InnerException is TimeoutException)
                    {
                        if (--retryCounter == 0)
                        {
                            _app.Screenshot("Timeout");
                            throw;
                        }

                        // Check if it failed
                        var result = _app.Query(p => p.Id("alertTitle"));

                        if (result?.Any() == true)
                        {
                            _app.Screenshot("Error");
                            throw new Exception("Error modal found, app errored.");
                        }
                    }
                }
                CollectSymbolSuccess = true;
            }
            catch
            {
                CollectSymbolSuccess = false;
                throw;
            }
        }
Ejemplo n.º 27
0
        public void ClickingButtonTwiceShouldChangeItsLabel()
        {
            Func <AppQuery, AppQuery> MyButton = c => c.Button("myButton");

            app.Tap(MyButton);
            app.Tap(MyButton);
            AppResult[] results = app.Query(MyButton);
            app.Screenshot("Button clicked twice.");

            Assert.AreEqual("2 clicks!", results[0].Text);
        }
        public void FirstTest()
        {
            app.WaitForElement(x => x.Id("textView1"));
            app.Screenshot("Waited for view with class: TextView with id: textView1 with text: Login on demo app");
            app.Tap(x => x.Id("TbxUsername"));
            app.EnterText(x => x.Id("TbxUsername"), "admin");
            app.Tap(x => x.Id("TbxPassword"));
            app.EnterText(x => x.Id("TbxPassword"), "admin");


            app.Tap(x => x.Id("BtnLogin"));

            app.WaitForElement(x => x.Text("add"));
            app.Screenshot("Waited for view with class: Button with text: add");
            app.Tap(x => x.Text("Karol"));
            app.WaitForElement(x => x.Text("Go Back"));
            app.Screenshot("Waited for view with class: Button with text: Go Back");
            app.Tap(x => x.Text("Go Back"));
            app.WaitForElement(x => x.Text("edit"));
            app.Screenshot("Waited for view with class: Button with text: edit");
        }
Ejemplo n.º 29
0
        public void WeatherApp_TestSearchCapability_ShouldDisplayCorrectLocation()
        {
            // Tap on the Zip Code input
            app.WaitForElement(c => c.Css("#zip-code-input"));

            app.Screenshot("Entering the Zip Code");
            app.Tap(c => c.Css("#zip-code-input"));

            // Enter the Zip Code
            app.EnterText("90210");

            // Perform the Search
            app.Screenshot("Performing the Search");
            app.Tap(c => c.Css("#get-weather-btn"));

            // Wait for the title to appear
            app.WaitFor(() => app.Query(c => c.Css("#title")).First().TextContent == "Beverly Hills");

            // Check the correct postcode appears
            app.Screenshot("Viewing the Search Results");
        }
Ejemplo n.º 30
0
        public async Task AppLaunches()
        {
            // waiting for mapview to load
            app.WaitForElement(x => x.Id("MyMapView"), timeout: TimeSpan.FromSeconds(200));

            // waiting for respective buttons to load
            app.WaitForElement(x => x.Id("la"), timeout: TimeSpan.FromSeconds(200));
            app.WaitForElement(x => x.Id("lv"), timeout: TimeSpan.FromSeconds(200));

            // click/tap on button
            app.Tap(x => x.Id("la"));
            // waiting for 10 secods for map to render.
            Task.Delay(10000);
            app.Screenshot("Los Angeles");

            // click/tap on button
            app.Tap(x => x.Id("lv"));
            // waiting for 10 secods for map to render.
            Task.Delay(10000);
            app.Screenshot("Los Vegas");
        }
Ejemplo n.º 31
0
Archivo: Tests.cs Proyecto: wenlz/Moyeu
 public void InitialLaunch()
 {
     app.WaitForElement(q => q.Id("FlashBarText"));
     app.WaitForNoElement(q => q.Id("FlashBarText"),
                          postTimeout: TimeSpan.FromSeconds(1));
     app.Screenshot("Loaded map");
 }
Ejemplo n.º 32
0
    public void BasicFahrenheitSetup()
    {
        // Let something load before proceeding
        app.WaitForElement(x => x.Marked("JunctionTemperatureLabel"));
        app.Screenshot("Initial launch");

        app.SetSliderValue(x => x.Class("FormsSeekBar").Index(0), 250);
        app.SetSliderValue(x => x.Class("FormsSeekBar").Index(1), 208);
        app.ScrollDown();               // Might be necessary on small screens
        app.SetSliderValue(x => x.Class("FormsSeekBar").Index(2), 50);
        app.Screenshot("Sliders set for 5V from 12V at 0.5A");

        app.ScrollUp();
        app.SetOrientationLandscape();
        app.Screenshot("Setup in landscape");

        app.SetOrientationPortrait();
        app.Tap(x => x.Marked("OK"));
        app.Screenshot("Opened settings");

        app.Tap(x => x.Text("Fahrenheit (°F)"));
        app.Screenshot("Tapped on view with class: FormsTextView");

        app.SwipeRightToLeft();
        app.Screenshot("Swiped left");

        app.WaitForElement(x => x.Marked("JunctionTemperatureLabel"));
        var temperatureF = app.Query(x => x.Marked("JunctionTemperatureLabel"));

        Assert.IsTrue(temperatureF[0].Text.Equals("JUNCTION TEMP: 222.1 ˚F"));
    }
Ejemplo n.º 33
0
        /// <summary>
        /// Incrementally scrolls down until the desired elements are found
        /// </summary>
        public static AppResult[] ScrollDownEnough(this AndroidApp app, Func <AppQuery, AppQuery> lambda, string screenshot = null)
        {
            AppResult rootView = null;
            int       count    = 0;
            int       maxTries = 20;

            AppResult[] lastTry;
            while (count < maxTries)
            {
                lastTry = app.Query(lambda);

                if (lastTry.Any())
                {
                    if (screenshot != null)
                    {
                        app.Screenshot(screenshot);
                    }

                    return(lastTry);
                }

                if (rootView == null)
                {
                    rootView = app.Query(e => e.All()).FirstOrDefault();

                    if (rootView == null)
                    {
                        throw new Exception("Unable to get root view");
                    }
                }

                //Will try to scroll +/-100 from the vertical center point
                float gap = 100;

                //Take into account where the screen is not large and the gap would be too big
                if (rootView.Rect.Height < gap * 2)
                {
                    gap = rootView.Rect.Height / 4;
                }

                app.DragCoordinates(rootView.Rect.CenterX, rootView.Rect.CenterY + gap, rootView.Rect.CenterX, rootView.Rect.CenterY - gap);
                count++;
            }

            if (count == maxTries)
            {
                throw new Exception("Unable to scroll down to find element");
            }

            return(new AppResult[0]);
        }
        public virtual void BeforeEachTest()
        {
            app = AppInitializer.StartApp();

            Thread.Sleep(TimeSpan.FromSeconds(5));

            if (app.Query("SIGN IN").Any())
            {
                new SplashScreenPage(app)
                    .ExitSplashScreen();
            }

            //waiting for next screen to load
            Thread.Sleep(TimeSpan.FromSeconds(5));

            app.Screenshot("On Home Page");
        }
		public void BeforeEachTest ()
		{
			// TODO: If the Android app being tested is included in the solution then open
			// the Unit Tests window, right click Test Apps, select Add App Project
			// and select the app projects that should be tested.
			app = ConfigureApp
				.Android
				// TODO: Update this path to point to your Android app and uncomment the
				// code if the app is not included in the solution.
				.ApkFile ("../../../Tasky.Droid/bin/Release/com.xamarin.samples.taskydroid.apk")
				.StartApp ();


			app.Screenshot("uslika.png");

			//app.Repl();

			return;
		}