static void RunWebDriver(DriverManager driverManager, Uri url, string actionTag = null)
 {
     Driver = driverManager.SelectedDriver.GetDriver();
     Driver.Manage().Window.Maximize();
     Progress.Set("website", 50);
     //Driver.Navigate().GoToUrl(url);
     try
     {
         HostManager hostManager = new HostManager(url, Driver);
         Log.Debug($"Host manager url: {hostManager.Url.ToString()}");
         var host = hostManager.GetHost();
         if (host != null && actionTag != null)
         {
             IAction action = host.GetAction(actionTag);
             action.DoAction();
             Progress.Set("website", 100);
         }
         else
         {
             Driver.Navigate().GoToUrl(url);
             Progress.Set("website", 100);
         }
     }
     catch (Exception e)
     {
         Log.Fatal(e, "Wystapil problem z hostmenadzerem");
     }
 }
Exemple #2
0
    /// <inheritdoc />
    protected override async void RunTestCases(
        IEnumerable <IXunitTestCase> testCases,
        IMessageSink executionMessageSink,
        ITestFrameworkExecutionOptions executionOptions)
    {
        var   exceptions = new List <Exception>();
        IHost?host       = null;

        try
        {
            host = _hostManager.BuildDefaultHost();
        }
        catch (TargetInvocationException tie)
        {
            exceptions.Add(tie.InnerException);
        }
        catch (Exception ex)
        {
            exceptions.Add(ex);
        }

        // ReSharper disable once PossibleMultipleEnumeration
        var hostMap = testCases
                      .GroupBy(tc => tc.TestMethod.TestClass, TestClassComparer.Instance)
                      .ToDictionary(group => group.Key, group =>
        {
            try
            {
                return(_hostManager.GetHost(group.Key.Class.ToRuntimeType()));
            }
            catch (TargetInvocationException tie)
            {
                exceptions.Add(tie.InnerException);
            }
            catch (Exception ex)
            {
                exceptions.Add(ex);
            }

            return(null);
        });

        try
        {
            await _hostManager.StartAsync(default).ConfigureAwait(false);