Exemple #1
0
        public void ViewIsDisplayed()
        {
            AppResult[] results = app.WaitForElement(c => c.Child("UIView"));
            app.Screenshot("First screen.");

            Assert.IsTrue(results.Any());
        }
Exemple #2
0
        public void WelcomeTextIsDisplayed()
        {
            AppResult[] results = app.WaitForElement(c => c.Marked("Welcome to Xamarin Forms!"));
            app.Screenshot("Welcome screen.");

            Assert.IsTrue(results.Any());
        }
        public void OpenSecondTab()
        {
            app.Tap(c => c.Marked("Second"));
            AppResult[] results = app.WaitForElement(c => c.Marked("Second View"));
            app.Screenshot("Second tab is opened.");

            Assert.IsTrue(results.Any());
        }
        public void SwipeLeftOpensNextPage()
        {
            app.SwipeLeft();
            AppResult[] results = app.WaitForElement(c => c.Marked("February"));
            app.Screenshot("Next page is opened.");

            Assert.IsTrue(results.Any());
        }
Exemple #5
0
        public void ViewIsDisplayed()
        {
            // Pause until the view controller has loaded
            AppResult[] results = app.WaitForElement(c => c.Button("NewSecretFileButton"));            //.Marked("NewSecretFileButton"));
            app.Screenshot("First screen.");

            var result = results.Any();

            Assert.IsTrue(result);
        }
Exemple #6
0
        public void ViewIsDisplayed()
        {
            var results = app.WaitForElement(c => c.Marked("Allow"));

            app.Tap(x => x.Marked("Allow"));

            app.Screenshot("First screen.");

            Assert.IsTrue(results.Any());
        }
Exemple #7
0
        static void TestApp(iOSApp app)
        {
            app.WaitForElement(c => c.Marked("Auf geht's"));
            app.Tap(c => c.Marked("Auf geht's"));

            app.Screenshot("no-changes");

            app.Tap(c => c.Marked("Filter"));
            app.Tap(c => c.Marked("BFS"));
            app.Tap(c => c.Marked("BG"));
            app.Tap(c => c.Marked("HBFS"));

            app.Tap(c => c.Marked("1082"));
            app.Tap(c => c.Marked("11/12 M"));
            app.Tap(c => c.Marked("11/11 G"));

            app.ScrollDown("filterCollectionView", ScrollStrategy.Gesture);

            app.Tap(c => c.Marked("12"));
            app.Tap(c => c.Marked("1292"));

            app.ScrollUp("filterCollectionView", ScrollStrategy.Gesture);

            app.Screenshot("filter");

            app.Tap(c => c.Marked("Mein Plan"));

            app.Screenshot("my-plan");

            app.Tap(c => c.Marked("Schul-Plan"));
            app.SwipeRightToLeft();

            app.Screenshot("school-plan");

            app.TouchAndHold("Deutsch bei P. Pohl in Raum 301");

            app.Screenshot("sharing");
        }
 public void ViewIsDisplayed()
 {
     AppResult[] results = null;
     if (app.Device.IsPhone)
     {
         results = app.WaitForElement(c => c.Child("UIView"));
     }
     if (app.Device.IsTablet)
     {
         results = app.WaitForElement(c => c.Child("UIView"));
     }
     app.Screenshot("First screen.");
     Assert.IsTrue(results.Any());
 }
 public void NewTest()
 {
     app.Tap(x => x.Marked("Sign-in"));
     app.Screenshot("Tapped on view with class: UIButton marked: Sign-in");
     app.Tap(x => x.Class("UIWebView").Css("INPUT._56bg._4u9z._5ruq"));
     app.Screenshot("Tapped on view with class: UIWebView");
     app.EnterText(x => x.Class("UIWebView").Css("INPUT._56bg._4u9z._5ruq"), "*****@*****.**");
     app.Tap(x => x.Class("UIWebView").Css("INPUT#u_0_2"));
     app.Screenshot("Tapped on view with class: UIWebView");
     app.EnterText(x => x.Class("UIWebView").Css("INPUT#u_0_2"), "Imperial09!");
     app.Tap(x => x.Class("UIWebView").Css("BUTTON#u_0_6"));
     app.Screenshot("Tapped on view with class: UIWebView");
     app.Tap(x => x.Marked("OK"));
     app.Screenshot("Tapped on view with class: _UIAlertControllerActionView marked: OK");
     app.Tap(x => x.Class("UITableViewCellContentView"));
     app.Screenshot("Tapped on view with class: UITableViewCellContentView");
     app.Tap(x => x.Marked("Borrow"));
     app.Screenshot("Tapped on view with class: _UIAlertControllerActionView marked: Borrow");
     app.Tap(x => x.Text("Send borrow request"));
     app.Screenshot("Tapped on view with class: UIButtonLabel marked: Send borrow request");
     app.Tap(x => x.Marked("Okay"));
     app.Screenshot("Tapped on view with class: _UIAlertControllerActionView marked: Okay");
 }
        public void ClickAddButtonAddsOneItem(string param)
        {
            Func <AppQuery, AppQuery> addButton    = c => c.Button("addButton");
            Func <AppQuery, AppQuery> tableCells   = c => c.Class("UITableViewCell");
            Func <AppQuery, AppQuery> detailView   = c => c.Marked("Detail view content goes here");
            Func <AppQuery, AppQuery> masterButton = c => c.Button("Master");

            AppResult[] results = app.Query(detailView);
            if (results.Any())
            {
                // Detail view is show first by iPad.
                app.Tap(masterButton);
            }
            app.Tap(addButton);
            results = app.WaitForElement(tableCells);
            app.Screenshot("New item added.");

            Assert.AreEqual(1, results.Length);
        }
Exemple #11
0
 public void UpdateFirstName()
 {
     app.WaitForElement(x => x.Marked("Armstead, Evan"));             // wait for the list to appear
     app.Screenshot("App start, display list");
     app.ScrollDownTo("Green, Monica");
     app.Screenshot("Scrolled to Monica Green");
     app.Tap(x => x.Marked("Green, Monica"));
     app.WaitForElement(x => x.Class("MKNewAnnotationContainerView")); // wait for the map to appear
     Thread.Sleep(2000);                                               // wait 2 seconds to give map time to fully render
     app.Screenshot("Detail screen");
     app.Tap(x => x.Id("edit.png"));
     app.Screenshot("Edit screen");
     app.ScrollDownTo("First");
     app.Tap(x => x.Marked("Monica"));
     app.ClearText();
     app.Screenshot("Cleared first name field");
     app.EnterText("Erica");
     app.DismissKeyboard();
     app.Screenshot("Altered value of company name field");
     app.Tap(x => x.Id("save.png"));
     app.WaitForElement(x => x.Class("MKNewAnnotationContainerView")); // wait for the map to appear
     Thread.Sleep(2000);                                               // wait 2 seconds to give map time to fully render
     app.Screenshot("Saved changes, navigated to detail screen, first name updated");
     app.Tap(x => x.Marked("List"));
     app.ScrollDownTo("Green, Erica");
     app.Screenshot("First name updated on list screen, first name updated");
 }
 public void UpdateFirstName()
 {
     app.Screenshot("App Started");
     app.EnterText(x => x.Class("UITextField"), "UseLocalDataSource");
     app.Screenshot("Entered data parition phrase");
     app.Tap(x => x.Text("Continue"));
     app.WaitForElement(x => x.Marked("Armstead, Evan"));
     Thread.Sleep(3000);             // wait a few seconds for list images to fully load
     app.Screenshot("Display list");
     app.Tap(x => x.Marked("Armstead, Evan"));
     app.WaitForElement(x => x.Class("MKNewAnnotationContainerView")); // wait for the map to appear
     Thread.Sleep(2000);                                               // wait 2 seconds to give map time to fully render
     app.Screenshot("Detail screen");
     app.Tap(x => x.Id("edit.png"));
     app.Screenshot("Edit screen");
     app.ScrollDownTo("First");
     app.Tap(x => x.Marked("Evan"));
     app.ClearText();
     app.Screenshot("Cleared first name field");
     app.EnterText("Jonathan");
     app.DismissKeyboard();
     app.Screenshot("Altered value of first name field");
     app.Tap(x => x.Id("save.png"));
     app.WaitForElement(x => x.Class("MKNewAnnotationContainerView")); // wait for the map to appear
     Thread.Sleep(2000);                                               // wait 2 seconds to give map time to fully render
     app.Screenshot("Saved changes, navigated to detail screen, first name updated");
     app.Tap(x => x.Marked("List"));
     app.Screenshot("First name updated on list screen");
 }
 public void SampleTest()
 {
     app.Screenshot("First screen.");
 }
Exemple #14
0
        public void CrawlDevices()
        {
            app.Screenshot("Login");
            app.Tap(b => b.Button("Local"));
            app.EnterText("Hestia");
            app.Screenshot("Server connect");
            app.Tap(t => t.Text("Enter IP"));
            app.EnterText("94.212.164.28");
            app.Tap(t => t.Text("Connect"));
            app.Screenshot("Devices");
            app.Tap(b => b.Button("Edit"));
            app.Screenshot("Devices edit mode");
            app.Tap(i => i.Id("AddDeviceIcon"));
            app.Screenshot("New device manufacturer");
            app.Tap(t => t.Text("mock"));
            app.Screenshot("New device type");
            app.Tap(t => t.Text("lock"));
            app.Screenshot("New device properties");

            var l = app.Query(t => t.Text("NAME"));

            app.TapCoordinates(l[1].Rect.CenterX, l[1].Rect.CenterY + 20);
            app.EnterText("TestLock");

            l = app.Query(t => t.Text("IP"));
            app.TapCoordinates(l[1].Rect.CenterX, l[1].Rect.CenterY + 20);
            app.EnterText("0.0.0.0");

            app.Tap(b => b.Button("Save"));
            app.Screenshot("Added device");
            app.Tap(t => t.Text("TestLock"));
            app.Screenshot("Device activators");
            app.Tap(c => c.Class("UISwitch"));
            app.Tap(t => t.Text("Devices"));
            app.Tap(b => b.Button("Edit"));

            app.Tap(t => t.Text("TestLock"));
            app.Screenshot("Edit device");
            l = app.Query(t => t.Text("TestLock"));
            app.TapCoordinates(l[0].Rect.CenterX, l[0].Rect.CenterY);
            app.EnterText("UITestLock");
            app.Tap(b => b.Button("Save"));

            app.WaitForElement(t => t.Text("UITestLock"));
            l = app.Query(t => t.Text("UITestLock"));
            app.TapCoordinates(l[0].Rect.X, l[0].Rect.CenterY);
            app.Screenshot("Delete device");
            app.TapCoordinates(l[0].Rect.Width - 1, l[0].Rect.CenterY);
            app.Tap(b => b.Button("Done"));
        }
Exemple #15
0
 public void FirstScreenIsTheOnboardingScreen()
 {
     app.Screenshot("Onboarding screen.");
 }
Exemple #16
0
 public void NewTest()
 {
     app.Tap(x => x.Marked(".NET-Programmierer und Architekten: Strategien 2017"));
     app.Screenshot("Tapped on view with class: UILabel marked: .NET-Programmierer und Architekten: Strategien 2017");
     app.Tap(x => x.Class("UISwitch"));
     app.Screenshot("Tapped on view with class: UISwitch");
     app.SetSliderValue(x => x.Class("UISlider"), 6000000);
     app.Tap(x => x.Class("UINavigationItemButtonView"));
     app.Screenshot("Tapped on view with class: UINavigationItemButtonView");
     app.Tap(x => x.Id("favorites.png"));
     app.Screenshot("Tapped on view with class: UITabBarSwappableImageView");
     app.Tap(x => x.Id("speakers.png"));
     app.Screenshot("Tapped on view with class: UITabBarSwappableImageView");
     app.Tap(x => x.Marked("Dominick Baier"));
     app.Screenshot("Tapped on view with class: UILabel marked: Dominick Baier");
     app.Tap(x => x.Text("Conference App"));
     app.Screenshot("Tapped on view with class: UILabel marked: Conference App");
     app.Tap(x => x.Id("Feedback.png"));
     app.Screenshot("Tapped on view with class: UITabBarSwappableImageView");
     //app.Tap(x => x.Class("UIImageView").Index(22));
     //app.Screenshot("Tapped on view with class: UIImageView");
     app.Tap(x => x.Marked("E-Mail"));
     app.Screenshot("Tapped on view with class: UITextFieldLabel marked: E-Mail");
     app.EnterText(x => x.Class("UITextField"), "*****@*****.**");
     app.Tap(x => x.Marked("Alter"));
     app.Screenshot("Tapped on view with class: UITextFieldLabel marked: Alter");
     app.EnterText(x => x.Class("UITextField").Index(1), "45");
     app.Tap(x => x.Marked("Geschlecht"));
     app.Screenshot("Tapped on view with class: UITextFieldLabel marked: Geschlecht");
     app.Tap(x => x.Marked("Mann").Index(1));
     app.Screenshot("Tapped on view with class: UILabel marked: Mann");
     app.Tap(x => x.Marked("Done"));
     app.Screenshot("Tapped on view with class: UIToolbarTextButton marked: Done");
     app.Tap(x => x.Text("Senden"));
     app.Screenshot("Tapped on view with class: UIButtonLabel marked: Senden");
     app.Tap(x => x.Marked("OK"));
     app.Screenshot("Tapped on view with class: _UIAlertControllerActionView marked: OK");
 }
 public void UpdateFirstName()
 {
     app.Screenshot("App Started");
     app.Tap(x => x.Marked("Enter a unique phrase"));
     app.EnterText("UseLocalDataSource");
     app.Screenshot("Entered data parition phrase");
     app.Tap(x => x.Marked("Continue"));
     Thread.Sleep(10000);             // wait 10 seconds to let list and all images load
     app.Screenshot("App start, display list");
     app.ScrollDownTo("Green, Monica");
     app.Screenshot("Scrolled to Monica Green");
     app.Tap(x => x.Marked("Green, Monica"));
     app.WaitForElement(x => x.Class("MKNewAnnotationContainerView")); // wait for the map to appear
     Thread.Sleep(2000);                                               // wait 2 seconds to give map time to fully render
     app.Screenshot("Detail screen");
     app.Tap(x => x.Id("edit.png"));
     app.Screenshot("Edit screen");
     app.ScrollDownTo("First");
     app.Tap(x => x.Marked("Monica"));
     Thread.Sleep(1000);
     app.ClearText();
     app.Screenshot("Cleared first name field");
     app.EnterText("Erica");
     app.DismissKeyboard();
     app.Screenshot("Altered value of company name field");
     app.Tap(x => x.Id("save.png"));
     app.WaitForElement(x => x.Class("MKNewAnnotationContainerView")); // wait for the map to appear
     Thread.Sleep(2000);                                               // wait 2 seconds to give map time to fully render
     app.Screenshot("Saved changes, navigated to detail screen, first name updated");
     app.Tap(x => x.Marked("List"));
     app.Screenshot("First name updated on list screen, first name updated");
 }
    public void BasicFahrenheitSetup()
    {
        // Let something load before proceeding
        app.WaitForElement(x => x.Id("JunctionTemperatureLabel"));
        app.Screenshot("Initial launch");

        app.SetSliderValue(x => x.Class("UISlider"), 12);
        app.SetSliderValue(x => x.Class("UISlider").Index(1), 5);
        // Have to scroll down on small screens to make lower views accessible
        app.ScrollDown(withinMarked: "CalcScrollView");
        app.SetSliderValue(x => x.Class("UISlider").Index(2), 0.5);
        app.Screenshot("Sliders set for 5V from 12V at 0.5A");

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

        app.SetOrientationPortrait();
        app.Tap(x => x.Id("hamburger.png"));
        app.Screenshot("Opened settings");

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

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

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

        Assert.IsTrue(temperatureF[0].Label.Equals("JUNCTION TEMP: 221.9 ˚F"));
    }
Exemple #19
0
 public void AppLaunches()
 {
     app.Screenshot("First screen.");
 }
 public static void EnterText(this iOSApp app, Func <AppQuery, AppQuery> lambda, string text, string screenshot)
 {
     app.EnterText(lambda, text);
     app.Screenshot(screenshot);
 }
Exemple #21
0
        public void LikeLoop()
        {
            // Run infinite loop
            while (true)
            {
                var all = app.Query(q => q.Class("WKWebView").Css("*"));

                var hashtags = new List <string> ();

                // Search for hashtag
                foreach (var element in all)
                {
                    if (!string.IsNullOrEmpty(element.TextContent) && element.Class == "_ezgzd")
                    {
                        var regex   = new Regex(@"(?<=#)\w+");
                        var matches = regex.Matches(element.TextContent);

                        foreach (Match m in matches)
                        {
                            hashtags.Add(m.Value);
                        }
                    }
                }

                // Search for the like button
                foreach (var element in all)
                {
                    if (element.Class.Contains("coreSpriteHeartOpen"))
                    {
                        // Tap the like button
                        app.TapCoordinates(element.Rect.CenterX, element.Rect.CenterY);

                        // Capture a screenshot
                        var imageFileInfo = app.Screenshot(DateTime.Now.ToString());

                        CustomVisionResponse imagePrediction = null;

                        try {
                            // Analyze the image with Microsoft Custom Vision
                            var predictionRequestTask = MakePredictionRequest(imageFileInfo.FullName);
                            predictionRequestTask.Wait();

                            // Save predictions
                            imagePrediction = predictionRequestTask.Result;
                        } catch (Exception ex) {
                            Console.WriteLine($"Failed to get image ML details: {ex.Message}");
                        } finally {
                            File.Delete(imageFileInfo.FullName);
                        }

                        try {
                            // Report results: hashtags + ML predictions + metadata to AWS
                            ReportLikeToAWS(imagePrediction, hashtags).Wait();
                        } catch (Exception ex) {
                            Console.WriteLine($"Failed to report like to AWS: {ex.Message}");
                        }

                        break;
                    }
                }

                app.ScrollDown();
            }
        }
Exemple #22
0
 public void AppDidLaunch()
 {
     app.Screenshot("App launched");
 }
Exemple #23
0
 public void System_dialog_display()
 {
     Thread.Sleep(10 * 1000); // Wait for 10 Seconds, so by this time the location system dialog should pop-up
     app.DismissSpringboardAlerts();
     app.Screenshot("First screen.");
 }