<commit_before>﻿namespace Slinqy.Test.Functional
{
    using System;
    using System.Configuration;
    using BoDi;
    using Models;
    using OpenQA.Selenium;
    using OpenQA.Selenium.Chrome;
    using TechTalk.SpecFlow;

    /// <summary>
    /// Code for setting up the local environment for performing the tests.
    /// </summary>
    [Binding]
    public sealed class Setup : IDisposable
    {
        /// <summary>
        /// Simple object container for SpecFlows dependency injection of objects in to Step classes.
        /// </summary>
        private readonly IObjectContainer objectContainer;

        /// <summary>
        /// Maintains a reference to the current web browser.
        /// </summary>
        private WebBrowser webBrowser;

        /// <summary>
        /// Maintains a reference to the current web driver.
        /// </summary>
        private IWebDriver webDriver;

        /// <summary>
        /// Initializes a new instance of the <see cref="Setup"/> class.
        /// </summary>
        /// <param name="objectContainer">Specifies the object container instance to use for DI.</param>
        public
        Setup(
            IObjectContainer objectContainer)
        {
            this.objectContainer = objectContainer;
        }

        /// <summary>
        /// Initializes the web browser for UI tests.
        /// </summary>
        [BeforeScenario]
        public
        void
        InitializeWebBrowser()
        {
            this.webDriver        = new ChromeDriver();
            var exampleAppBaseUri = new Uri(GetSetting("ExampleApp.BaseUri"));

            this.webBrowser       = new WebBrowser(this.webDriver, exampleAppBaseUri);

            this.webDriver
                .Manage()
                .Timeouts()
                .ImplicitlyWait(
                    TimeSpan.FromSeconds(10)
                );

            this.objectContainer.RegisterInstanceAs(this.webBrowser);
        }

        /// <summary>
        /// Disposes resources.
        /// </summary>
        public
        void
        Dispose()
        {
            this.webBrowser.Dispose();
            this.webDriver.Dispose();
        }

        /// <summary>
        /// Gets the specified configuration setting.
        /// </summary>
        /// <param name="settingName">Specifies the name of the configuration setting to get.</param>
        /// <returns>Returns the value of the configuration setting if found.  Otherwise null is returned.</returns>
        private
        static
        string
        GetSetting(
            string settingName)
        {
            var settingValue = Environment.GetEnvironmentVariable(settingName);

            if (string.IsNullOrWhiteSpace(settingValue))
                settingValue = ConfigurationManager.AppSettings[settingName];

            return settingValue;
        }
    }
}<commit_msg>Reduce the default wait time for the IWebDriver to wait to find requested elements.<commit_after>﻿namespace Slinqy.Test.Functional
{
    using System;
    using System.Configuration;
    using BoDi;
    using Models;
    using OpenQA.Selenium;
    using OpenQA.Selenium.Chrome;
    using TechTalk.SpecFlow;

    /// <summary>
    /// Code for setting up the local environment for performing the tests.
    /// </summary>
    [Binding]
    public sealed class Setup : IDisposable
    {
        /// <summary>
        /// Simple object container for SpecFlows dependency injection of objects in to Step classes.
        /// </summary>
        private readonly IObjectContainer objectContainer;

        /// <summary>
        /// Maintains a reference to the current web browser.
        /// </summary>
        private WebBrowser webBrowser;

        /// <summary>
        /// Maintains a reference to the current web driver.
        /// </summary>
        private IWebDriver webDriver;

        /// <summary>
        /// Initializes a new instance of the <see cref="Setup"/> class.
        /// </summary>
        /// <param name="objectContainer">Specifies the object container instance to use for DI.</param>
        public
        Setup(
            IObjectContainer objectContainer)
        {
            this.objectContainer = objectContainer;
        }

        /// <summary>
        /// Initializes the web browser for UI tests.
        /// </summary>
        [BeforeScenario]
        public
        void
        InitializeWebBrowser()
        {
            this.webDriver        = new ChromeDriver();
            var exampleAppBaseUri = new Uri(GetSetting("ExampleApp.BaseUri"));

            this.webBrowser       = new WebBrowser(this.webDriver, exampleAppBaseUri);

            this.webDriver
                .Manage()
                .Timeouts()
                .ImplicitlyWait(
                    TimeSpan.FromSeconds(5)
                );

            this.objectContainer.RegisterInstanceAs(this.webBrowser);
        }

        /// <summary>
        /// Disposes resources.
        /// </summary>
        public
        void
        Dispose()
        {
            this.webBrowser.Dispose();
            this.webDriver.Dispose();
        }

        /// <summary>
        /// Gets the specified configuration setting.
        /// </summary>
        /// <param name="settingName">Specifies the name of the configuration setting to get.</param>
        /// <returns>Returns the value of the configuration setting if found.  Otherwise null is returned.</returns>
        private
        static
        string
        GetSetting(
            string settingName)
        {
            var settingValue = Environment.GetEnvironmentVariable(settingName);

            if (string.IsNullOrWhiteSpace(settingValue))
                settingValue = ConfigurationManager.AppSettings[settingName];

            return settingValue;
        }
    }
}
{'fraction_non_alphanumeric': 0.09496822943499914, 'fraction_numerical': 0.0005151983513652757, 'mean_word_length': 1.650887573964497, 'pattern_counts': {'":': 0, '<': 49, '<?xml version=': 0, '>': 49, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6186230', 'n_tokens_mistral': 1420, 'n_tokens_neox': 1373, 'n_words': 395}