<commit_before>﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using FluentAssertions;
using NUnit.Framework;

namespace Atata.Tests
{
    [TestFixture]
    public abstract class UITestFixtureBase
    {
        public const string BaseUrl = "http://localhost:50549";

        /// <summary>
        /// Usage of 2046 on Azure DevOps pipeline port often leads to failure during WebDriver instance creation.
        /// </summary>
        private readonly int[] _portsToIgnore = new[] { 2046 };

        private EventListLogConsumer _eventListLogConsumer;

        protected IEnumerable<LogEventInfo> LogEntries => _eventListLogConsumer.Items;

        public static bool IsOSLinux =>
            RuntimeInformation.IsOSPlatform(OSPlatform.Linux);

        protected AtataContextBuilder ConfigureBaseAtataContext()
        {
            _eventListLogConsumer = new EventListLogConsumer();

            return AtataContext.Configure()
                .UseChrome()
                    .WithArguments(GetChromeArguments())
                    .WithPortsToIgnore(_portsToIgnore)
                .UseBaseUrl(BaseUrl)
                .UseCulture("en-US")
                .UseNUnitTestName()
                .UseNUnitTestSuiteName()
                .UseNUnitTestSuiteType()
                .LogConsumers.AddNUnitTestContext()
                .LogConsumers.Add(_eventListLogConsumer)
                    .WithMessageNestingLevelIndent(string.Empty)
                .LogNUnitError()
                .OnCleanUpAddArtifactsToNUnitTestContext();
        }

        private static IEnumerable<string> GetChromeArguments()
        {
            yield return "disable-extensions";
            yield return "start-maximized";
            yield return "disable-infobars";

            if (IsOSLinux)
                yield return "headless";
        }

        [TearDown]<commit_msg>Add `"headless"` argument to Chrome in `UITestFixtureBase`<commit_after>﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using FluentAssertions;
using NUnit.Framework;

namespace Atata.Tests
{
    [TestFixture]
    public abstract class UITestFixtureBase
    {
        public const string BaseUrl = "http://localhost:50549";

        /// <summary>
        /// Usage of 2046 on Azure DevOps pipeline port often leads to failure during WebDriver instance creation.
        /// </summary>
        private readonly int[] _portsToIgnore = new[] { 2046 };

        private EventListLogConsumer _eventListLogConsumer;

        protected IEnumerable<LogEventInfo> LogEntries => _eventListLogConsumer.Items;

        public static bool IsOSLinux =>
            RuntimeInformation.IsOSPlatform(OSPlatform.Linux);

        protected AtataContextBuilder ConfigureBaseAtataContext()
        {
            _eventListLogConsumer = new EventListLogConsumer();

            return AtataContext.Configure()
                .UseChrome()
                    .WithArguments(GetChromeArguments())
                    .WithPortsToIgnore(_portsToIgnore)
                .UseBaseUrl(BaseUrl)
                .UseCulture("en-US")
                .UseNUnitTestName()
                .UseNUnitTestSuiteName()
                .UseNUnitTestSuiteType()
                .LogConsumers.AddNUnitTestContext()
                .LogConsumers.Add(_eventListLogConsumer)
                    .WithMessageNestingLevelIndent(string.Empty)
                .LogNUnitError()
                .OnCleanUpAddArtifactsToNUnitTestContext();
        }

        private static IEnumerable<string> GetChromeArguments()
        {
            yield return "disable-extensions";
            yield return "start-maximized";
            yield return "disable-infobars";
            yield return "headless";
        }

        [TearDown]
{'fraction_non_alphanumeric': 0.07923848726524312, 'fraction_numerical': 0.006688963210702341, 'mean_word_length': 2.145631067961165, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 15, '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': '7233467', 'n_tokens_mistral': 1028, 'n_tokens_neox': 955, 'n_words': 207}