microsoft / EasyRepro

Automated UI testing API for Dynamics 365
MIT License
512 stars 285 forks source link

[HOW-TO] Run tests on Jenkins #1400

Open IvanRastamanov opened 7 months ago

IvanRastamanov commented 7 months ago

Question

Hey All,

Trying to run tests using Jenkins, code and NuGet packages are downloaded, built and tests discovered, but then error appears about starting browser.


Starting test execution, please wait... A total of 1 test files matched the specified pattern. Failed UITestJenkins [4 s] Error Message: Test method .CreateSDA.UITestJenkins threw exception: System.InvalidOperationException: session not created: Microsoft Edge failed to start: crashed. (chrome not reachable) (The process started from msedge location C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe is no longer running, so msedgedriver is assuming that msedge has crashed.) (SessionNotCreated) Stack Trace: at OpenQA.Selenium.WebDriver.UnpackAndThrowOnError(Response errorResponse, String commandToExecute) at OpenQA.Selenium.WebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters) at OpenQA.Selenium.WebDriver.StartSession(ICapabilities desiredCapabilities) at OpenQA.Selenium.WebDriver..ctor(ICommandExecutor executor, ICapabilities capabilities) at OpenQA.Selenium.Chromium.ChromiumDriver..ctor(ChromiumDriverService service, ChromiumOptions options, TimeSpan commandTimeout) at Microsoft.Dynamics365.UIAutomation.Browser.BrowserDriverFactory.CreateWebDriver(BrowserOptions options) in C:\Workspace2\Microsoft.Dynamics365.UIAutomation.Browser\BrowserDriverFactory.cs:line 42 at Microsoft.Dynamics365.UIAutomation.Browser.InteractiveBrowser.get_Driver() in C:\Workspace2\Microsoft.Dynamics365.UIAutomation.Browser\InteractiveBrowser.cs:line 83 at Inkubit.CreateSDA.UITestJenkins() in C:\Workspace2\Microsoft.Dynamics365.UIAutomation.Sample\\Create\CreateSDA.cs:line 486


Test code is the simpliest: [TestMethod] [TestCategory("TestJenkins")] public void UITestJenkins() { var client = new WebClient(TestSettings.Options);

        using (var xrmApp = new XrmApp(client))
        {
            client.Browser.Driver.Navigate().GoToUrl("https://www.bing.com/");
            Thread.Sleep(2000);

            var searchText = client.Browser.Driver.FindElement(By.XPath(".//input[@name='q']"));
            searchText.SendKeys("Bill Gates" + Keys.Enter);
            Thread.Sleep(5000);
        }
    }

Browser can be started manually from mentioned location. When I start it manually from VisualStudio, this also works OK.

With best regards