Exemple #1
0
        public void GetSemanticsId_ByScript()
        {
            var result = FlutterDriver.ExecuteScript("flutter:getSemanticsId", FlutterBy.Tooltip("FUT: FlutterBy.Tooltip (Increment 3)").ToBase64());

            result.Should().BeOfType(typeof(long));

            ((long)result).Should().NotBe(0);
        }
Exemple #2
0
        public void GetRenderObjectDiagnostics_Javascript()
        {
            var by = FlutterBy.ValueKey("counter");

            var response = FlutterDriver.ExecuteScript("flutter:getRenderObjectDiagnostics", by.ToBase64(), new Dictionary <string, object>()
            {
                { "includeProperties", true },
                { "subtreeDepth", 2 }
            });

            var responseAsDictionary = response as Dictionary <string, object>;

            AssertGetRenderObjectDiagnosticsResponse(responseAsDictionary);
        }
Exemple #3
0
        public void WaitForAbsent_ExistsForFailQuickly_ByScript()
        {
            try
            {
                // NOTE: The final parameter is in SECONDS
                FlutterDriver.ExecuteScript("flutter:waitForAbsent", ControlThatAlwaysExists.ToBase64(), 1);

                Assert.Fail($"We should never see this statement - the control being searched for ALWAYS EXISTS; so an exception should have been thrown. ");
            }
            catch (OpenQA.Selenium.WebDriverException ex)
            {
                ex.Message.Should().Contain("Timeout while executing waitForAbsent");
            }
        }
Exemple #4
0
        public void WaitFor_NeverExists_ByScript()
        {
            // TODO: Better exception
            try
            {
                FlutterDriver.ExecuteScript("flutter:waitFor", ControlThatNeverExists.ToBase64(), 1);

                Assert.Fail($"We should never see this statement - the control being searched for ALWAYS EXISTS; so an exception should have been thrown. ");
            }
            catch (OpenQA.Selenium.WebDriverException ex)
            {
                ex.Message.Should().Contain("Timeout while executing waitFor");
            }
        }
Exemple #5
0
        public void WaitForAbsent_NeverExists_ByScript()
        {
            // HACK: On my own box, there is no issue - but when I run this on the CI/CD I get the following error:

            /*
             *  Test method GreyhamWooHoo.Flutter.SystemTests.WaitForTests.WaitForAbsent_NeverExists_ByScript threw exception:
             *  OpenQA.Selenium.WebDriverException: An unknown server-side error occurred while processing the command. Original error: Cannot execute command waitForAbsent, server reponse {
             *  "isError": true,
             *  "response": "Timeout while executing waitForAbsent: TimeoutException after 0:00:01.000000: Future not completed\n",
             *  "type": "_extensionType",
             *  "method": "ext.flutter.driver"
             *  } */

            // To get around this, I wait for the page to 'converge' first
            FlutterDriver.WaitFor(ControlThatAlwaysExists);

            // NOTE: The final parameter is in SECONDS
            FlutterDriver.ExecuteScript("flutter:waitForAbsent", ControlThatNeverExists.ToBase64(), 1);
        }
Exemple #6
0
        public void GetCenter_ByScript()
        {
            var response = FlutterDriver.ExecuteScript("flutter:getCenter", Control.ToBase64());

            AssertPositionResultContract(response);
        }
Exemple #7
0
        public void GetTopLeft_ByScript()
        {
            var result = FlutterDriver.ExecuteScript("flutter:getTopLeft", Control.ToBase64());

            AssertPositionResultContract(result);
        }
Exemple #8
0
        private Position GetPosition_ByScript(string position)
        {
            var response = FlutterDriver.ExecuteScript(position, Control.ToBase64()) as Dictionary <string, object>;

            return(new Position(System.Convert.ToDouble(response["dx"]), System.Convert.ToDouble(response["dy"])));
        }
Exemple #9
0
 public void WaitFor_ByScript()
 {
     // TODO: Better exception
     FlutterDriver.ExecuteScript("flutter:waitFor", ControlThatAlwaysExists.ToBase64());
 }
Exemple #10
0
        public void CheckHealth_Javascript()
        {
            var result = FlutterDriver.ExecuteScript("flutter:checkHealth");

            result.Should().Be("ok");
        }
Exemple #11
0
        public void GetRenderTree_Javascript()
        {
            var result = FlutterDriver.ExecuteScript("flutter:getRenderTree");

            result.ToString().StartsWith("RenderView#").Should().BeTrue(because: "the render tree always starts with that text");
        }
Exemple #12
0
        public void ForceGC_Javascript()
        {
            var result = FlutterDriver.ExecuteScript("flutter:forceGC");

            result.Should().BeNull();
        }
Exemple #13
0
        public void ClearTimeline_Javascript()
        {
            var result = FlutterDriver.ExecuteScript("flutter:clearTimeline");

            result.Should().BeNull();
        }