Beispiel #1
0
 public void TearDownFixture()
 {
     if (DriverPoolUsage == DriverPoolUsage.Fixture)
     {
         DriverPool.CloseAllForScope(this);
     }
 }
        /// <summary>
        /// Use the driver pool with optionally resricting the pool with <paramref name="poolScopeObject"/>.
        /// </summary>
        /// <param name="builder">An <see cref="AtataContextBuilder"/>.</param>
        /// <param name="poolScopeObject">
        /// The pool scope object.
        /// Is optional.
        /// Mostly can be a fixture class object.
        /// When is <see langword="null"/> then will use whole global common pool;
        /// otherwise will use separate pool for particular scope object.
        /// </param>
        /// <returns></returns>
        public static AtataContextBuilder UseDriverPool(this AtataContextBuilder builder, object poolScopeObject = null)
        {
            IDriverFactory driverFactory = builder.BuildingContext.DriverFactoryToUse;

            RemoteWebDriver driver = DriverPool.Acquire(driverFactory, poolScopeObject);

            return(builder.UseDriver(driver).
                   OnCleanUp(ReleaseCurrentDriver));
        }
Beispiel #3
0
        /// <summary>
        /// Use the driver pool with optionally restricting the pool with <paramref name="poolScopeObject"/>.
        /// </summary>
        /// <param name="builder">An <see cref="AtataContextBuilder"/>.</param>
        /// <param name="poolScopeObject">
        /// The pool scope object.
        /// Is optional.
        /// Mostly can be a fixture class object.
        /// When is <see langword="null"/> then will use whole global common pool;
        /// otherwise will use separate pool for particular scope object.
        /// </param>
        /// <returns>The same <see cref="AtataContextBuilder"/> instance.</returns>
        public static AtataContextBuilder UseDriverPool(this AtataContextBuilder builder, object poolScopeObject = null)
        {
            IDriverFactory driverFactory = builder.BuildingContext.DriverFactoryToUse;

            IWebDriver driver = DriverPool.Acquire(driverFactory, poolScopeObject);

            return(builder.UseDriver(driver)
                   .EventSubscriptions.Add <AtataContextCleanUpEvent>(ReleaseCurrentDriver));
        }
 private static void ReleaseCurrentDriver()
 {
     DriverPool.Release(AtataContext.Current?.Driver);
 }
Beispiel #5
0
 private static void ReleaseCurrentDriver(AtataContextCleanUpEvent eventData)
 {
     DriverPool.Release(eventData.Context.Driver);
 }
Beispiel #6
0
 public void GlobalTearDown()
 {
     DriverPool.CloseAll();
 }