private async Task <bool> checkIfThereIsActiveTestsAreRunningAsync(String URL)
        {
            try
            {
                HttpClient client = new HttpClient
                {
                    BaseAddress = new Uri(URL),
                    Timeout     = TimeSpan.FromSeconds(15)
                };
                var response = await client.GetAsync("grid/api/hub");

                if (response.IsSuccessStatusCode)
                {
                    GridHub gridHub = await response.Content.ReadAsAsync <GridHub>();

                    if (gridHub.SlotCounts.Free != gridHub.SlotCounts.Total && gridHub.NewSessionRequestCount == 0)
                    {
                        return(true);
                    }
                }
                return(false);
            }
            catch (Exception)
            {
                return(false);
            }
        }
Exemple #2
0
 public static string ToJson(this GridHub self) => JsonConvert.SerializeObject(self, SeleniumNodeRunner.Converter.Settings);