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"));
    }
Beispiel #2
0
        public void AlertShowsUp()
        {
            //creating an anrray of menu items:
            string[] stringArray = new string[12];
            stringArray[0]  = "background location";
            stringArray[1]  = "contacts";
            stringArray[2]  = "calendar";
            stringArray[3]  = "reminders";
            stringArray[4]  = "microphone";
            stringArray[5]  = "motion";
            stringArray[6]  = "camera";
            stringArray[7]  = "twitter";
            stringArray[8]  = "apns";
            stringArray[9]  = "apple music";
            stringArray[10] = "speech recognition";
            stringArray[11] = "health kit";


            for (int i = 0; i < stringArray.Length; i++)
            {
                //tapping each menu item
                app.Tap(x => x.Marked(stringArray[i]));
                //taking screenshot
                app.Screenshot("Show Alert for " + stringArray[i]);
                //Adding a sleep before tapping the next menu item to give the UI time to be ready
                Thread.Sleep(10 * 1000);
                if (i >= 6)
                {
                    app.ScrollDown();
                }
            }
        }
Beispiel #3
0
        public void AlertShowsUp()
        {
            //creating an anrray of menu items:
            string[] stringArray = new string[12];
            stringArray[0]  = "background location";
            stringArray[1]  = "contacts";
            stringArray[2]  = "calendar";
            stringArray[3]  = "reminders";
            stringArray[4]  = "microphone";
            stringArray[5]  = "motion";
            stringArray[6]  = "camera";
            stringArray[7]  = "twitter";
            stringArray[8]  = "apns";
            stringArray[9]  = "apple music";
            stringArray[10] = "speech recognition";
            stringArray[11] = "health kit";


            for (int i = 0; i < stringArray.Length; i++)
            {
                //tapping each menu item
                app.Tap(x => x.Marked(stringArray[i]));
                //taking the screenshot
                app.Screenshot("Show Alert for " + stringArray[i]);
                //There is generally no need to call DismissSpringboardAlerts()in user test code, I'm calling this method to play it safe
                app.DismissSpringboardAlerts();
                app.Screenshot("alert dismissed");
                //adding a sleep of 5 seconds before tapping the next menu item to give the UI time to be ready
                Thread.Sleep(5 * 1000);
                if (i >= 6)
                {
                    app.ScrollDown();
                }
            }
        }
Beispiel #4
0
 public void Notifications()
 {
     Thread.Sleep(7000);
     app.Tap(x => x.Id("icon-tab_bar-notification"));
     app.ScrollDown();
     Console.Write("--- Notification Success ---");
     Thread.Sleep(3000);
     History();
 }
Beispiel #5
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");
        }
Beispiel #6
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();
            }
        }