Ejemplo n.º 1
0
        public void NavigateToTextTestPage()
        {
            FlutterDriver.Click(FlutterBy.Text("Navigate to Taps Test Page"));

            FlutterDriver.WaitFor(FlutterBy.Text("Taps Page"));

            FlutterDriver.GetText(FlutterBy.ValueKey("tapCounter")).Should().Be("0", because: "the counter is initially 0");
        }
Ejemplo n.º 2
0
        public void SetupScreenshotTests()
        {
            // NOTE: If we take the screenshot immediately on app startup, we occasionally get this error:
            // Original error: {"code":-32000,"message":"Could not capture image screenshot."}
            //
            // So its better to wait for some state to converge first
            FlutterDriver.WaitFor(FlutterBy.Text("Navigate to Finders and Position Test Page"));

            OutputPath = System.IO.Path.Combine(TestContext.TestRunResultsDirectory, $"{DateTime.Now.ToString("yyyyMMddHHmmss")}.png");
        }
Ejemplo n.º 3
0
        public void WaitFor_NeverExists_Driver()
        {
            // TODO: Better exception
            try
            {
                FlutterDriver.WaitFor(ControlThatNeverExists, 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");
            }
        }
Ejemplo n.º 4
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);
        }
Ejemplo n.º 5
0
        public void PageBack()
        {
            FlutterDriver.Click(FlutterBy.PageBack());

            FlutterDriver.WaitFor(FlutterBy.Text("Navigate to Finders and Position Test Page"));
        }
Ejemplo n.º 6
0
        public void NavigateToTextTestPage()
        {
            FlutterDriver.Click(FlutterBy.Text("Navigate to Text Fields Test Page"));

            FlutterDriver.WaitFor(TextFieldControl);
        }
Ejemplo n.º 7
0
 public void WaitFor_Driver()
 {
     // TODO: Better exception
     FlutterDriver.WaitFor(ControlThatAlwaysExists);
 }