<commit_before>using NUnit.Framework;
using static NSelene.Selene;
using OpenQA.Selenium;

namespace NSelene.Tests.Integration.SharedDriver.ConfigurationSpec
{
    using System;
    using Harness;

    [TestFixture]
    public class Configuration_SetValueByJs_Specs : BaseTest
    {

        [TearDown]
        public void TeardownTest()
        {
            Configuration.SetValueByJs = false;
        }

        [Test]
        public void SetValue_ViaElementCustomizedToJs_SetsItFasterThanNormalSetValue()
        {
            Configuration.SetValueByJs = false;
            Given.OpenedPageWithBody(@"
                <input id='field1' value='should be cleared'>
                <input id='field2' value='should be cleared'>
            ");
            var beforeType = DateTime.Now;
            S("#field1").SetValue(new string('*', 100));
            var afterType = DateTime.Now;
            var setValueTime = afterType - beforeType;

            var beforeJsSetValue = afterType;
            S("#field2").With(setValueByJs: true).SetValue(new string('*', 100));
            var afterJsSetValue = DateTime.Now;
            
            // THEN
            S("#field1").Should(Have.Value(new string('*', 100)));
            S("#field2").Should(Have.Value(new string('*', 100)));
            
            var jsTime = afterJsSetValue - beforeJsSetValue;
            Assert.Less(jsTime, setValueTime / 3);
        }<commit_msg>removed unneeded teardown (it's already set in base test, and not relevant in context of test logic to this test)<commit_after>using NUnit.Framework;
using static NSelene.Selene;
using OpenQA.Selenium;

namespace NSelene.Tests.Integration.SharedDriver.ConfigurationSpec
{
    using System;
    using Harness;

    [TestFixture]
    public class Configuration_SetValueByJs_Specs : BaseTest
    {

        [Test]
        public void SetValue_ViaElementCustomizedToJs_SetsItFasterThanNormalSetValue()
        {
            Configuration.SetValueByJs = false;
            Given.OpenedPageWithBody(@"
                <input id='field1' value='should be cleared'>
                <input id='field2' value='should be cleared'>
            ");
            var beforeType = DateTime.Now;
            S("#field1").SetValue(new string('*', 100));
            var afterType = DateTime.Now;
            var setValueTime = afterType - beforeType;

            var beforeJsSetValue = afterType;
            S("#field2").With(setValueByJs: true).SetValue(new string('*', 100));
            var afterJsSetValue = DateTime.Now;
            
            // THEN
            S("#field1").Should(Have.Value(new string('*', 100)));
            S("#field2").Should(Have.Value(new string('*', 100)));
            
            var jsTime = afterJsSetValue - beforeJsSetValue;
            Assert.Less(jsTime, setValueTime / 3);
        }
{'fraction_non_alphanumeric': 0.10790861159929702, 'fraction_numerical': 0.01335676625659051, 'mean_word_length': 2.201349831271091, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '377393', 'n_tokens_mistral': 817, 'n_tokens_neox': 770, 'n_words': 169}