public void Multiple_ViaSingleConfig()
        {
            AtataContextBuilder builder = AtataContext.Configure().
                                          ApplyJsonConfig("Configs/LogConsumers");

            LogConsumerInfo[] expected =
            {
                new LogConsumerInfo(new DebugLogConsumer  {
                    Separator = " - "
                }),
                new LogConsumerInfo(new TraceLogConsumer(), LogLevel.Trace, true)
                {
                    MessageNestingLevelIndent = "_ ",
                    MessageStartSectionPrefix = "S:",
                    MessageEndSectionPrefix   = "E:",
                },
                new LogConsumerInfo(new NUnitTestContextLogConsumer(), LogLevel.Info, false),
                new LogConsumerInfo(new NLogConsumer      {
                    LoggerName = "somelogger"
                }, LogLevel.Warn, false),
                new LogConsumerInfo(new CustomLogConsumer {
                    IntProperty = 15
                }, LogLevel.Error)
            };

            AssertLogConsumers(expected, builder.BuildingContext.LogConsumers);

            JsonConfig.Current.LogConsumers.Count.Should().Be(expected.Length);
        }
Beispiel #2
0
        public void Configuration_MultiDriver()
        {
            var contextBuilder = AtataContext.Configure().
                                 UseEdge().
                                 UseChrome();

            var context = contextBuilder.BuildingContext;

            Assert.That(context.DriverFactories, Has.Count.EqualTo(2));
            Assert.That(context.DriverFactoryToUse.Alias, Is.EqualTo(DriverAliases.Chrome));

            contextBuilder.
            UseFirefox();

            Assert.That(context.DriverFactories, Has.Count.EqualTo(3));
            Assert.That(context.DriverFactoryToUse.Alias, Is.EqualTo(DriverAliases.Firefox));

            contextBuilder.
            UseDriver(DriverAliases.Edge);

            Assert.That(context.DriverFactories, Has.Count.EqualTo(3));
            Assert.That(context.DriverFactoryToUse.Alias, Is.EqualTo(DriverAliases.Edge));

            contextBuilder.
            UseDriver(DriverAliases.InternetExplorer);

            Assert.That(context.DriverFactories, Has.Count.EqualTo(4));
            Assert.That(context.DriverFactoryToUse.Alias, Is.EqualTo(DriverAliases.InternetExplorer));
        }
Beispiel #3
0
 public void SetUp()
 {
     AtataContext.Configure()
     .UseTestName(TestContext.TestName)
     .LogConsumers.Add(new TextOutputLogConsumer(TestContext.WriteLine))
     .Build();
 }
 public void SetUp()
 {
     AtataContext.Configure().
     ApplyJsonConfig <AtataConfig>().
     UseChrome().
     WithArguments("start-maximized", "disable-infobars", "disable-extensions").
     // Base URL can be set here, but in this sample it is defined in Atata.json config file.
     //UseBaseUrl("https://demo.atata.io/").
     UseCulture("en-US").
     UseNUnitTestName().
     AddNUnitTestContextLogging().
     // Configure logging:
     //    WithMinLevel(LogLevel.Info).
     //    WithoutSectionFinish().
     AddNLogLogging().    // Actual NLog configuration is located in NLog.config file.
     // Logs can be found in "{repo folder}\src\AtataSampleApp.UITests\bin\Debug\Logs\"
     AddScreenshotFileSaving().
     // Below are possible ways to specify folder path to store screenshots for individual tests.
     // Both examples build the same path which is used by default.
     //    WithFolderPath(@"Logs\{build-start}\{test-name}").
     //    WithFolderPath(() => $@"Logs\{AtataContext.BuildStart:yyyy-MM-dd HH_mm_ss}\{AtataContext.Current.TestName}").
     LogNUnitError().
     TakeScreenshotOnNUnitError().
     UseAssertionExceptionType <NUnit.Framework.AssertionException>().
     UseNUnitAggregateAssertionStrategy().
     Build();
 }
Beispiel #5
0
 public void Setup()
 {
     AtataContext.Configure().
     UseChrome().
     UseBaseUrl("https://rozetka.com.ua/").
     Build();
 }
Beispiel #6
0
        public void Remote_WithOptions()
        {
            var context = RemoteDriverAtataContextBuilderOverride.Context;

            using (context.UseNullDriver())
            {
                AtataContextBuilder builder = AtataContext.Configure().
                                              ApplyJsonConfig(@"Configs/RemoteChrome.json");

                builder.BuildingContext.DriverFactoryToUse.Create();
            }

            ICapabilities capabilities = context.Capabilities;

            capabilities.GetCapability(CapabilityType.BrowserName).Should().Be(DriverAliases.Chrome);

            var chromeCapabilities = (Dictionary <string, object>)capabilities.GetCapability(ChromeOptions.Capability);

            chromeCapabilities.Should().Equal(new Dictionary <string, object>
            {
                ["detach"] = true,
                ["cap1"]   = true,
                ["cap2"]   = 5,
                ["cap3"]   = "str"
            });
        }
        public void Regular()
        {
            AtataContext.Configure().
            ApplyJsonConfig <CustomJsonConfig>(@"Configs/CustomSettings.json");

            CustomJsonConfig.Current.BaseUrl.Should().Be("https://demo.atata.io/");
            CustomJsonConfig.Current.IntProperty.Should().Be(5);
            CustomJsonConfig.Current.StringProperty.Should().Be("str");
            CustomJsonConfig.Current.BoolProperty.Should().Be(true);
            CustomJsonConfig.Current.BoolProperty2.Should().Be(false);
            CustomJsonConfig.Current.StringArrayValues.Should().Equal(new[] { "str1", "str2", "str3" });
            CustomJsonConfig.Current.StringListValues.Should().Equal(new[] { "str1", "str2", "str3" });

            CustomJsonConfig.Current.Section.StringProperty.Should().Be("section_str");
            CustomJsonConfig.Current.Section.BoolProperty.Should().Be(true);

            CustomJsonConfig.Current.Items.Should().BeEquivalentTo(new[]
            {
                new CustomJsonConfig.CustomItemSection
                {
                    Name  = "item1",
                    Value = 5
                },
                new CustomJsonConfig.CustomItemSection
                {
                    Name  = "item2",
                    Value = 7
                }
            });
        }
Beispiel #8
0
 /// <summary>
 ///   Build Atata Context method
 /// </summary>
 public static AtataContextBuilder BuildContext()
 {
     return(AtataContext.Configure()
            .UseNUnitTestName()
            .AddScreenshotFileSaving()
            .WithFolderPath(AppDomain.CurrentDomain.BaseDirectory + @"\Logs\{build-start}\{test-name}"));
 }
        private static Subject <List <EventSubscriptionItem> > CreateSutForConfig(string configName)
        {
            AtataContextBuilder builder = AtataContext.Configure().
                                          ApplyJsonConfig(BuildConfigPath(configName));

            return(builder.BuildingContext.EventSubscriptions.ToSutSubject());
        }
 public void SetUp()
 {
     AtataContext.Configure().
     UseDriver(_driverAlias).
     UseTestName(() => $"[{_driverAlias}]{TestContext.CurrentContext.Test.Name}").
     Build();
 }
Beispiel #11
0
        public void SetUp()
        {
#if DEBUG
            AtataContext.Configure()
            .UseDriver(_driverAlias)
            .UseBaseUrl("https://localhost:44345/")
            .Build();
            AtataContext.Current.Driver.Maximize();
#elif DEV
            AtataContext.Configure()
            .UseDriver(_driverAlias)
            .UseBaseUrl("https://svea-webpay-sdk-001-dev.azurewebsites.net/")
            .Build();
            AtataContext.Current.Driver.Maximize();
#elif RELEASE
            var config = new ConfigurationBuilder()
                         .AddJsonFile("appsettings.json")
                         .AddEnvironmentVariables()
                         .Build();

            AtataContext.Configure()
            .UseChrome()
            .WithOptions(DriverOptionsFactory.GetDriverOptions(Driver.Chrome) as ChromeOptions)
            .UseBaseUrl(config.GetSection("SampleWebsite").GetSection("Url").Value)
            .Build();
            AtataContext.Current.Driver.Maximize();
#endif
        }
Beispiel #12
0
 public void SetUpScenario()
 {
     AtataContext.Configure()
     .EventSubscriptions.Add <ScreenshotFileSavedEvent>(eventData => _outputHelper.AddAttachment(eventData.FilePath))
     .LogConsumers.Add(new TextOutputLogConsumer(_outputHelper.WriteLine))
     .Build();
 }
Beispiel #13
0
        public void Global()
        {
            AtataContextBuilder builder = AtataContext.Configure().
                                          ApplyJsonConfig("Configs/Attributes/Global");

            var result = builder.BuildingContext.Attributes.Global;

            result.Should().HaveCount(4);

            var attribute1 = result[0].Should().BeOfType <TermFindSettingsAttribute>().Subject;

            attribute1.Case.Should().Be(TermCase.LowerMerged);
            attribute1.TargetTypes.Should().Equal(typeof(Field <,>));
            attribute1.TargetAttributeTypes.Should().Equal(typeof(FindByIdAttribute));
            attribute1.ExcludeTargetTypes.Should().Equal(typeof(CheckBox <>));

            var attribute2 = result[1].Should().BeOfType <FindSettingsAttribute>().Subject;

            attribute2.Visibility.Should().Be(Visibility.Any);
            attribute2.TargetTypes.Should().Equal(typeof(Table <,>), typeof(Table <, ,>));
            attribute2.TargetAttributeTypes.Should().Equal(typeof(FindByClassAttribute), typeof(FindByFieldSetAttribute), typeof(FindByLabelAttribute));
            attribute2.ExcludeTargetNames.Should().Equal("a", "b");
            attribute2.ExcludeTargetParentTypes.Should().Equal(typeof(Frame <>));

            var attribute3 = result[2].Should().BeOfType <FindByIdAttribute>().Subject;

            attribute3.Values.Should().Equal("some-id");

            var attribute4 = result[3].Should().BeOfType <FindByNameAttribute>().Subject;

            attribute4.Values.Should().Equal("name1", "name2");
        }
Beispiel #14
0
 public void SetUp()
 {
     AtataContext.Configure().
     ApplyJsonConfig <AppConfig>().
     UseBaseRetryTimeout(TimeSpan.FromSeconds(15)).
     Build();
 }
        public void Default_WithAlias()
        {
            AtataContextBuilder builder = AtataContext.Configure().
                                          ApplyJsonConfig(environmentAlias: "QA");

            builder.BuildingContext.BaseUrl.Should().EndWith("atata.qa");
        }
        public void Default()
        {
            AtataContextBuilder builder = AtataContext.Configure().
                                          ApplyJsonConfig();

            builder.BuildingContext.BaseUrl.Should().EndWith("atata");
        }
Beispiel #17
0
        public void SetUp()
        {
#if NETCOREAPP2_0
            string baseUrl = "http://localhost:50549";
#else
            string baseUrl = System.Configuration.ConfigurationManager.AppSettings["TestAppUrl"];
#endif

            stringListLogConsumer = new StringListLogConsumer();

            AtataContext.Configure().
            UseChrome().
            WithArguments("disable-extensions", "no-sandbox", "start-maximized").
#if NETCOREAPP2_0
            WithFixOfCommandExecutionDelay().
            WithLocalDriverPath().
#endif
            UseBaseUrl(baseUrl).
            UseCulture("en-us").
            UseNUnitTestName().
            AddNUnitTestContextLogging().
            AddLogConsumer(stringListLogConsumer).
            LogNUnitError().
            Build();

            OnSetUp();
        }
 public void SetUp()
 {
     // Find information about AtataContext set-up on https://atata-framework.github.io/getting-started/#set-up.
     AtataContext.Configure().
     ApplyJsonConfig <AppConfig>().
     UseBaseRetryTimeout(TimeSpan.FromSeconds(15)).
     Build();
 }
Beispiel #19
0
        public void Handle(ScreenshotFileSavedEvent eventData, AtataContext context)
        {
            string relativeFilePath = eventData.FilePath.Replace(ExtentContext.WorkingDirectoryPath, null);

            ExtentContext.ResolveFor(context).Test.Log(
                Status.Info,
                CreateMediaEntityModelProvider(relativeFilePath, eventData.ScreenshotInfo.Title));
        }
Beispiel #20
0
 public void SetUp()
 {
     AtataContext.Configure().
     UseChrome().
     WithDriverPath(".\\chromedriver").
     UseBaseUrl("https://rozetka.com.ua").
     Build();
 }
        public void When_DriverInitializationStage_Build()
        {
            var sut = AtataContext.Configure()
                      .UseDriverInitializationStage(AtataContextDriverInitializationStage.Build);

            Assert.Throws <InvalidOperationException>(() =>
                                                      sut.Build());
        }
Beispiel #22
0
 public void SetUo()
 {
     AtataContext.Configure()
     .UseChrome().WithArguments("start-maximized")
     //.UseBaseUrl("http://www.yesk.com.ua/")
     .Build()
     ;
 }
        public void AbsolutePath_WithAlias()
        {
            string filePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Simple.json");

            AtataContextBuilder builder = AtataContext.Configure().
                                          ApplyJsonConfig(filePath, "QA");

            builder.BuildingContext.BaseUrl.Should().EndWith("simple.qa");
        }
 public void SetUp()
 {
     AtataContext.Configure().
     UseChrome().
     UseBaseUrl("https://atata-framework.github.io/atata-sample-app/#!/").
     UseTestName(TestContext.TestName).
     AddTraceLogging().
     Build();
 }
        public void FolderPath()
        {
            string filePath = AppDomain.CurrentDomain.BaseDirectory;

            AtataContextBuilder builder = AtataContext.Configure().
                                          ApplyJsonConfig(filePath);

            builder.BuildingContext.BaseUrl.Should().EndWith("atata");
        }
Beispiel #26
0
        public void SetUp()
        {
            Context = AtataContext.Configure()
                      .UseDriverInitializationStage(AtataContextDriverInitializationStage.None)
                      .Build();

            Sut = new EventBus(Context)
                  .ToSutSubject();
        }
        public void When_DriverInitializationStage_None()
        {
            var sut = AtataContext.Configure()
                      .UseDriverInitializationStage(AtataContextDriverInitializationStage.None);

            sut.Build();

            Assert.That(AtataContext.Current.Driver, Is.Null);
        }
Beispiel #28
0
 public void SetUp()
 {
     AtataContext.Configure().
     UseDriver(driverAlias).
     UseTestName(() => $"[{driverAlias}]{TestContext.CurrentContext.Test.Name}").
     AddNUnitTestContextLogging().
     LogNUnitError().
     Build();
 }
Beispiel #29
0
        public void AtataContextBuilder_ConfigureChrome_After_UseFirefox_WithSameAlias_Throws()
        {
            var builder = AtataContext.Configure()
                          .UseFirefox()
                          .WithAlias("drv");

            Assert.Throws <ArgumentException>(() =>
                                              builder.ConfigureChrome("drv"));
        }
Beispiel #30
0
        public void AtataContextBuilder_ConfigureChrome_After_UseChrome_ExtendsSameFactory()
        {
            var builder = AtataContext.Configure()
                          .UseChrome()
                          .ConfigureChrome();

            builder.BuildingContext.DriverFactories.Should().HaveCount(1);
            builder.BuildingContext.DriverFactoryToUse.Alias.Should().Be(DriverAliases.Chrome);
        }