Skip to content

Commit

Permalink
Merge pull request #11 from RohitM-IN/dev
Browse files Browse the repository at this point in the history
Update to 1.2.0
  • Loading branch information
RohitM-IN authored Aug 26, 2023
2 parents 0918101 + 4507476 commit dbce993
Show file tree
Hide file tree
Showing 4 changed files with 129 additions and 3 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Selenium Manager is a .NET library designed to simplify parallel testing and dyn
- [Initializing Selenium Manager](#initializing-selenium-manager)
- [Enqueuing Actions](#enqueuing-actions)
- [Parallel Testing](#parallel-testing)
- [Configuration Settings](#configuration-settings)
- [API Reference](doc/API_REFERENCE.md)
- [Contributing](doc/CONTRIBUTING.md)
- [License](#license)
Expand Down Expand Up @@ -77,6 +78,12 @@ await Task.WhenAll(tasks);

```

### Configuration Setting

The behavior of Selenium Manager can be customized using the `ConfigurationSettings` class. This class encapsulates various configuration options related to Selenium Grid communication, browser options, concurrency, and more. For detailed information about the available properties and their usage, please refer to the [ConfigurationSettings Reference](/doc/Configuration.md).



## API Reference

For detailed information about the available classes, methods, and options, please refer to the [API Reference](/doc/API_REFERENCE.md).
Expand Down
1 change: 0 additions & 1 deletion SeleniumManager.Core/DataContract/ConfigurationSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ public string GridHost
public Dictionary<string, int> statistics { get; set; }
public string UserName { get; set; }
public string Password { get; set; }
public int MaxConcurrency { get; set; }
public Endpoints Endpoints { get; set; }
public Options Options { get; set; } = new Options();
}
Expand Down
5 changes: 3 additions & 2 deletions SeleniumManager.Core/SeleniumManager.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@
This include managing Queues, Parallel Tests, etc.</Description>
<Copyright>MIT License</Copyright>
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
<AssemblyVersion>1.1.0.0</AssemblyVersion>
<Version>1.1.0.0</Version>
<AssemblyVersion>1.2.0.0</AssemblyVersion>
<Version>1.2.0.0</Version>
<GenerateDocumentationFile>True</GenerateDocumentationFile>
<FileVersion>1.2.0.0</FileVersion>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
Expand Down
119 changes: 119 additions & 0 deletions doc/Configuration.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
# ConfigurationSettings in Selenium Manager

The `ConfigurationSettings` class is a core component of the Selenium Manager library. It's designed to encapsulate various configuration options that govern how the Selenium Manager interacts with Selenium Grid, manages WebDriver instances, and handles test execution.

## Table of Contents

- [Introduction](#Introduction)
- [Properties](#Properties)
- [GridHost](#GridHost)
- [statistics](#statistics)
- [UserName](#UserName)
- [Password](#Password)
- [MaxConcurrency](#MaxConcurrency)
- [Endpoints](#Endpoints)
- [Options](#Options)
- [Usage](#Usage)
- [Examples](#Examples)

## Introduction

The `ConfigurationSettings` class acts as a configuration hub for Selenium Manager, allowing you to customize how the library behaves in different scenarios. It provides a structured way to define settings related to Selenium Grid communication, browser options, concurrency, and more.

## Properties

### GridHost

- **Type**: `string`
- **Description**: The URL of the Selenium Grid hub where browser instances are managed and tests are executed. This URL can include the scheme (`http` or `https`), host, and port.

### statistics

- **Type**: `Dictionary<string, int>`
- **Description**: A dictionary that holds browser statistics, influencing the distribution of test actions across different browsers. The key is the browser name (e.g., "chrome," "firefox"), and the value is the desired ratio of instances for that browser.

### UserName

- **Type**: `string`
- **Description**: The username used for authenticating with the Selenium Grid hub. If your Selenium Grid requires authentication, provide the appropriate username here. If not required, leave it empty.

### Password
- **Type**: `string`
- **Description**: The password used for authenticating with the Selenium Grid hub. If your Selenium Grid requires authentication, provide the appropriate password here. If not required, leave it empty.

### Endpoints
- **Type**: `Endpoints`
- **Description**: A collection of endpoint URLs used by Selenium Manager to communicate with different parts of the Selenium Grid infrastructure. These endpoints include URLs for retrieving status, session details, and more.

### Options
- **Type**: Options
- **Description**: A collection of browser-specific options used to configure the behavior of WebDriver instances. This property holds sub-properties for each browser type (e.g., Chrome, Firefox) to allow you to set browser-specific options.

## Usage

You can leverage the `ConfigurationSettings` class to tailor the behavior of the Selenium Manager to your requirements. Customize the various properties to match your Selenium Grid setup, browser preferences, and desired concurrency level.

## Examples

### Basic Configuration

```csharp
var configSettings = new ConfigurationSettings
{
GridHost = "http://localhost:4444/wd/hub",
statistics = new Dictionary<string, int>
{
{ "chrome", 1 },
{ "firefox", 1 },
{ "MicrosoftEdge", 1 }
},
UserName = "your-username",
Password = "your-password",
MaxConcurrency = 5,
Endpoints = new Endpoints
{
Status = "/status",
// ... other endpoint URLs
},
Options = new Options
{
ChromeOptions = new ChromeOptions(),
FirefoxOptions = new FirefoxOptions(),
// ... other browser-specific options
}
};

```

### Configuration via Custom Config.json

```json
{
"Gridhost": "http://127.0.0.1:4444",
"UserName": "",
"Password": "",
"statistics": {
"Chrome": 2,
"MicrosoftEdge": 1,
"Firefox": 1,
"Internet Explorer": 0
},
"endpoints": {
"status": "/status"
}
}
```

Using above config file

```csharp
var Config = new ConfigManager("path/to/custom_config.json");

var manager = new SeleniumManager(Config);

```

---

This example demonstrates how to configure the ConfigurationSettings class to suit your Selenium Manager needs. Adjust the properties according to your testing environment and preferences.

0 comments on commit dbce993

Please sign in to comment.