35 lines
1.4 KiB
C#
35 lines
1.4 KiB
C#
using Autofac;
|
|
using ESuite.UI.E2E.Helpers;
|
|
using ESuite.UI.E2E.Hooks;
|
|
using OpenQA.Selenium;
|
|
using OpenQA.Selenium.Chrome;
|
|
using Reqnroll.Autofac;
|
|
using System.Reflection;
|
|
|
|
namespace ESuite.UI.E2E
|
|
{
|
|
public static class DependencyConfig
|
|
{
|
|
[ScenarioDependencies]
|
|
public static void ConfigureDependencies(ContainerBuilder builder)
|
|
{
|
|
var stepDefinitionTypes = Assembly.GetExecutingAssembly()
|
|
.GetTypes()
|
|
.Where(t => t.Name.EndsWith("StepDefinitions"));
|
|
|
|
// Register all StepDefinition classes as themselves
|
|
foreach (var type in stepDefinitionTypes)
|
|
{
|
|
builder.RegisterType(type).AsSelf().InstancePerLifetimeScope();
|
|
}
|
|
|
|
// Register specific hooks or other necessary dependencies
|
|
builder.RegisterType<ScenarioHooks>().As<ScenarioHooks>().InstancePerLifetimeScope();
|
|
builder.RegisterType<ChromeDriver>().As<IWebDriver>().SingleInstance();
|
|
builder.RegisterType<BrowserContext>().As<BrowserContext>().InstancePerLifetimeScope();
|
|
builder.RegisterType<APIHelper>().As<APIHelper>().InstancePerLifetimeScope();
|
|
builder.RegisterType<AutomationTestManagerHelper>().As<AutomationTestManagerHelper>().InstancePerLifetimeScope();
|
|
|
|
}
|
|
}
|
|
} |