How to use typeof method of Atata.AtataBuildingContext class

Best Atata code snippet using Atata.AtataBuildingContext.typeof

AtataContextBuilder.cs

Source:AtataContextBuilder.cs Github

copy

Full Screen

...79 else if (!(driverFactory is TDriverBuilder))80 {81 throw new ArgumentException(82 $@"Existing driver with ""{alias}"" alias has other factory type in {nameof(AtataContextBuilder)}.83Expected: {typeof(TDriverBuilder).FullName}84Actual: {driverFactory.GetType().FullName}", nameof(alias));85 }8687 return (TDriverBuilder)driverFactory;88 }8990 /// <summary>91 /// Use the driver builder.92 /// </summary>93 /// <typeparam name="TDriverBuilder">The type of the driver builder.</typeparam>94 /// <param name="driverBuilder">The driver builder.</param>95 /// <returns>The <typeparamref name="TDriverBuilder"/> instance.</returns>96 public TDriverBuilder UseDriver<TDriverBuilder>(TDriverBuilder driverBuilder)97 where TDriverBuilder : AtataContextBuilder, IDriverFactory98 {99 driverBuilder.CheckNotNull(nameof(driverBuilder));100101 BuildingContext.DriverFactories.Add(driverBuilder);102 BuildingContext.DriverFactoryToUse = driverBuilder;103104 return driverBuilder;105 }106107 /// <summary>108 /// Sets the alias of the driver to use.109 /// </summary>110 /// <param name="alias">The alias of the driver.</param>111 /// <returns>The <see cref="AtataContextBuilder"/> instance.</returns>112 public AtataContextBuilder UseDriver(string alias)113 {114 alias.CheckNotNullOrWhitespace(nameof(alias));115116 IDriverFactory driverFactory = BuildingContext.GetDriverFactory(alias);117118 if (driverFactory != null)119 BuildingContext.DriverFactoryToUse = driverFactory;120 else if (UsePredefinedDriver(alias) == null)121 throw new ArgumentException($"No driver with \"{alias}\" alias defined.", nameof(alias));122123 return this;124 }125126 /// <summary>127 /// Use specified driver instance.128 /// </summary>129 /// <param name="driver">The driver to use.</param>130 /// <returns>The <see cref="CustomDriverAtataContextBuilder"/> instance.</returns>131 public CustomDriverAtataContextBuilder UseDriver(IWebDriver driver)132 {133 driver.CheckNotNull(nameof(driver));134135 return UseDriver(() => driver);136 }137138 /// <summary>139 /// Use custom driver factory method.140 /// </summary>141 /// <param name="driverFactory">The driver factory method.</param>142 /// <returns>The <see cref="CustomDriverAtataContextBuilder"/> instance.</returns>143 public CustomDriverAtataContextBuilder UseDriver(Func<IWebDriver> driverFactory)144 {145 driverFactory.CheckNotNull(nameof(driverFactory));146147 return UseDriver(new CustomDriverAtataContextBuilder(BuildingContext, driverFactory));148 }149150 private IDriverFactory UsePredefinedDriver(string alias)151 {152 switch (alias.ToLowerInvariant())153 {154 case DriverAliases.Chrome:155 return UseChrome();156 case DriverAliases.Firefox:157 return UseFirefox();158 case DriverAliases.InternetExplorer:159 return UseInternetExplorer();160 case DriverAliases.Safari:161 return UseSafari();162 case DriverAliases.Opera:163 return UseOpera();164 case DriverAliases.Edge:165 return UseEdge();166 default:167 return null;168 }169 }170171 /// <summary>172 /// Sets the driver initialization stage.173 /// The default value is <see cref="AtataContextDriverInitializationStage.Build"/>.174 /// </summary>175 /// <param name="stage">The stage.</param>176 /// <returns>The <see cref="AtataContextBuilder"/> instance.</returns>177 public AtataContextBuilder UseDriverInitializationStage(AtataContextDriverInitializationStage stage)178 {179 BuildingContext.DriverInitializationStage = stage;180 return this;181 }182183 /// <summary>184 /// Creates and returns a new builder for <see cref="ChromeDriver"/>185 /// with default <see cref="DriverAliases.Chrome"/> alias.186 /// Sets this builder as a one to use for a driver creation.187 /// </summary>188 /// <returns>The <see cref="ChromeAtataContextBuilder"/> instance.</returns>189 public ChromeAtataContextBuilder UseChrome() =>190 UseDriver(new ChromeAtataContextBuilder(BuildingContext));191192 /// <summary>193 /// Creates and returns a new builder for <see cref="FirefoxDriver"/>194 /// with default <see cref="DriverAliases.Firefox"/> alias.195 /// Sets this builder as a one to use for a driver creation.196 /// </summary>197 /// <returns>The <see cref="FirefoxAtataContextBuilder"/> instance.</returns>198 public FirefoxAtataContextBuilder UseFirefox() =>199 UseDriver(new FirefoxAtataContextBuilder(BuildingContext));200201 /// <summary>202 /// Creates and returns a new builder for <see cref="InternetExplorerDriver"/>203 /// with default <see cref="DriverAliases.InternetExplorer"/> alias.204 /// Sets this builder as a one to use for a driver creation.205 /// </summary>206 /// <returns>The <see cref="InternetExplorerAtataContextBuilder"/> instance.</returns>207 public InternetExplorerAtataContextBuilder UseInternetExplorer() =>208 UseDriver(new InternetExplorerAtataContextBuilder(BuildingContext));209210 /// <summary>211 /// Creates and returns a new builder for <see cref="EdgeDriver"/>212 /// with default <see cref="DriverAliases.Edge"/> alias.213 /// Sets this builder as a one to use for a driver creation.214 /// </summary>215 /// <returns>The <see cref="EdgeAtataContextBuilder"/> instance.</returns>216 public EdgeAtataContextBuilder UseEdge() =>217 UseDriver(new EdgeAtataContextBuilder(BuildingContext));218219 /// <summary>220 /// Creates and returns a new builder for <see cref="OperaDriver"/>221 /// with default <see cref="DriverAliases.Opera"/> alias.222 /// Sets this builder as a one to use for a driver creation.223 /// </summary>224 /// <returns>The <see cref="OperaAtataContextBuilder"/> instance.</returns>225 public OperaAtataContextBuilder UseOpera() =>226 UseDriver(new OperaAtataContextBuilder(BuildingContext));227228 /// <summary>229 /// Creates and returns a new builder for <see cref="SafariDriver"/>230 /// with default <see cref="DriverAliases.Safari"/> alias.231 /// Sets this builder as a one to use for a driver creation.232 /// </summary>233 /// <returns>The <see cref="SafariAtataContextBuilder"/> instance.</returns>234 public SafariAtataContextBuilder UseSafari() =>235 UseDriver(new SafariAtataContextBuilder(BuildingContext));236237 /// <summary>238 /// Creates and returns a new builder for <see cref="RemoteWebDriver"/>239 /// with default <see cref="DriverAliases.Remote"/> alias.240 /// Sets this builder as a one to use for a driver creation.241 /// </summary>242 /// <returns>The <see cref="RemoteDriverAtataContextBuilder"/> instance.</returns>243 public RemoteDriverAtataContextBuilder UseRemoteDriver() =>244 UseDriver(new RemoteDriverAtataContextBuilder(BuildingContext));245246 /// <summary>247 /// Returns an existing or creates a new builder for <see cref="ChromeDriver"/> by the specified alias.248 /// </summary>249 /// <param name="alias">250 /// The driver alias.251 /// The default value is <see cref="DriverAliases.Chrome"/>.252 /// </param>253 /// <returns>The <see cref="ChromeAtataContextBuilder"/> instance.</returns>254 public ChromeAtataContextBuilder ConfigureChrome(string alias = DriverAliases.Chrome) =>255 ConfigureDriver(256 alias,257 () => new ChromeAtataContextBuilder(BuildingContext).WithAlias(alias));258259 /// <summary>260 /// Returns an existing or creates a new builder for <see cref="FirefoxDriver"/> by the specified alias.261 /// </summary>262 /// <param name="alias">263 /// The driver alias.264 /// The default value is <see cref="DriverAliases.Firefox"/>.265 /// </param>266 /// <returns>The <see cref="FirefoxAtataContextBuilder"/> instance.</returns>267 public FirefoxAtataContextBuilder ConfigureFirefox(string alias = DriverAliases.Firefox) =>268 ConfigureDriver(269 alias,270 () => new FirefoxAtataContextBuilder(BuildingContext).WithAlias(alias));271272 /// <summary>273 /// Returns an existing or creates a new builder for <see cref="InternetExplorerDriver"/> by the specified alias.274 /// </summary>275 /// <param name="alias">276 /// The driver alias.277 /// The default value is <see cref="DriverAliases.InternetExplorer"/>.278 /// </param>279 /// <returns>The <see cref="InternetExplorerAtataContextBuilder"/> instance.</returns>280 public InternetExplorerAtataContextBuilder ConfigureInternetExplorer(string alias = DriverAliases.InternetExplorer) =>281 ConfigureDriver(282 alias,283 () => new InternetExplorerAtataContextBuilder(BuildingContext).WithAlias(alias));284285 /// <summary>286 /// Returns an existing or creates a new builder for <see cref="EdgeDriver"/> by the specified alias.287 /// </summary>288 /// <param name="alias">289 /// The driver alias.290 /// The default value is <see cref="DriverAliases.Edge"/>.291 /// </param>292 /// <returns>The <see cref="EdgeAtataContextBuilder"/> instance.</returns>293 public EdgeAtataContextBuilder ConfigureEdge(string alias = DriverAliases.Edge) =>294 ConfigureDriver(295 alias,296 () => new EdgeAtataContextBuilder(BuildingContext).WithAlias(alias));297298 /// <summary>299 /// Returns an existing or creates a new builder for <see cref="OperaDriver"/> by the specified alias.300 /// </summary>301 /// <param name="alias">302 /// The driver alias.303 /// The default value is <see cref="DriverAliases.Opera"/>.304 /// </param>305 /// <returns>The <see cref="OperaAtataContextBuilder"/> instance.</returns>306 public OperaAtataContextBuilder ConfigureOpera(string alias = DriverAliases.Opera) =>307 ConfigureDriver(308 alias,309 () => new OperaAtataContextBuilder(BuildingContext).WithAlias(alias));310311 /// <summary>312 /// Returns an existing or creates a new builder for <see cref="SafariDriver"/> by the specified alias.313 /// </summary>314 /// <param name="alias">315 /// The driver alias.316 /// The default value is <see cref="DriverAliases.Safari"/>.317 /// </param>318 /// <returns>The <see cref="SafariAtataContextBuilder"/> instance.</returns>319 public SafariAtataContextBuilder ConfigureSafari(string alias = DriverAliases.Safari) =>320 ConfigureDriver(321 alias,322 () => new SafariAtataContextBuilder(BuildingContext).WithAlias(alias));323324 /// <summary>325 /// Returns an existing or creates a new builder for <see cref="RemoteWebDriver"/> by the specified alias.326 /// </summary>327 /// <param name="alias">328 /// The driver alias.329 /// The default value is <see cref="DriverAliases.Remote"/>.330 /// </param>331 /// <returns>The <see cref="RemoteDriverAtataContextBuilder"/> instance.</returns>332 public RemoteDriverAtataContextBuilder ConfigureRemoteDriver(string alias = DriverAliases.Remote) =>333 ConfigureDriver(334 alias,335 () => new RemoteDriverAtataContextBuilder(BuildingContext).WithAlias(alias));336337 [Obsolete("Use LogConsumers.Add(...) instead.")] // Obsolete since v2.0.0.338 public LogConsumerAtataContextBuilder<TLogConsumer> AddLogConsumer<TLogConsumer>()339 where TLogConsumer : ILogConsumer, new()340 =>341 LogConsumers.Add<TLogConsumer>();342343 [Obsolete("Use LogConsumers.Add(...) instead.")] // Obsolete since v2.0.0.344 public LogConsumerAtataContextBuilder<TLogConsumer> AddLogConsumer<TLogConsumer>(TLogConsumer consumer)345 where TLogConsumer : ILogConsumer346 =>347 LogConsumers.Add(consumer);348349 [Obsolete("Use LogConsumers.Add(...) instead.")] // Obsolete since v2.0.0.350 public LogConsumerAtataContextBuilder<ILogConsumer> AddLogConsumer(string typeNameOrAlias) =>351 LogConsumers.Add(typeNameOrAlias);352353 [Obsolete("Use LogConsumers.AddTrace() instead.")] // Obsolete since v2.0.0.354 public LogConsumerAtataContextBuilder<TraceLogConsumer> AddTraceLogging() =>355 LogConsumers.AddTrace();356357 [Obsolete("Use LogConsumers.AddDebug() instead.")] // Obsolete since v2.0.0.358 public LogConsumerAtataContextBuilder<DebugLogConsumer> AddDebugLogging() =>359 LogConsumers.AddDebug();360361 [Obsolete("Use LogConsumers.AddConsole() instead.")] // Obsolete since v2.0.0.362 public LogConsumerAtataContextBuilder<ConsoleLogConsumer> AddConsoleLogging() =>363 LogConsumers.AddConsole();364365 [Obsolete("Use LogConsumers.AddNUnitTestContext() instead.")] // Obsolete since v2.0.0.366 public LogConsumerAtataContextBuilder<NUnitTestContextLogConsumer> AddNUnitTestContextLogging() =>367 LogConsumers.AddNUnitTestContext();368369 [Obsolete("Use LogConsumers.AddNLog(...) instead.")] // Obsolete since v2.0.0.370 public LogConsumerAtataContextBuilder<NLogConsumer> AddNLogLogging(string loggerName = null) =>371 LogConsumers.AddNLog(loggerName);372373 [Obsolete("Use LogConsumers.AddNLogFile() instead.")] // Obsolete since v2.0.0.374 public LogConsumerAtataContextBuilder<NLogFileConsumer> AddNLogFileLogging() =>375 LogConsumers.AddNLogFile();376377 [Obsolete("Use LogConsumers.AddLog4Net(...) instead.")] // Obsolete since v2.0.0.378 public LogConsumerAtataContextBuilder<Log4NetConsumer> AddLog4NetLogging(string loggerName = null) =>379 LogConsumers.AddLog4Net(loggerName);380381 [Obsolete("Use LogConsumers.AddLog4Net(...) instead.")] // Obsolete since v2.0.0.382 public LogConsumerAtataContextBuilder<Log4NetConsumer> AddLog4NetLogging(string repositoryName, string loggerName = null) =>383 LogConsumers.AddLog4Net(repositoryName, loggerName);384385 [Obsolete("Use LogConsumers.AddLog4Net(...) instead.")] // Obsolete since v2.0.0.386 public LogConsumerAtataContextBuilder<Log4NetConsumer> AddLog4NetLogging(Assembly repositoryAssembly, string loggerName = null) =>387 LogConsumers.AddLog4Net(repositoryAssembly, loggerName);388389 /// <summary>390 /// Adds the variable.391 /// </summary>392 /// <param name="key">The variable key.</param>393 /// <param name="value">The variable value.</param>394 /// <returns>The <see cref="AtataContextBuilder"/> instance.</returns>395 public AtataContextBuilder AddVariable(string key, object value)396 {397 key.CheckNotNullOrWhitespace(nameof(key));398399 BuildingContext.Variables[key] = value;400401 return this;402 }403404 /// <summary>405 /// Adds the variables.406 /// </summary>407 /// <param name="variables">The variables to add.</param>408 /// <returns>The <see cref="AtataContextBuilder"/> instance.</returns>409 public AtataContextBuilder AddVariables(IDictionary<string, object> variables)410 {411 variables.CheckNotNull(nameof(variables));412413 foreach (var variable in variables)414 BuildingContext.Variables[variable.Key] = variable.Value;415416 return this;417 }418419 /// <summary>420 /// Adds the secret string to mask in log.421 /// </summary>422 /// <param name="value">The secret string value.</param>423 /// <param name="mask">The mask, which should replace the secret string.</param>424 /// <returns>The <see cref="AtataContextBuilder"/> instance.</returns>425 public AtataContextBuilder AddSecretStringToMaskInLog(string value, string mask = "{*****}")426 {427 value.CheckNotNullOrWhitespace(nameof(value));428 mask.CheckNotNullOrWhitespace(nameof(mask));429430 BuildingContext.SecretStringsToMaskInLog.Add(431 new SecretStringToMask(value, mask));432433 return this;434 }435436 [Obsolete("Use ScreenshotConsumers.Add<TScreenshotConsumer>() instead.")] // Obsolete since v2.0.0.437 public ScreenshotConsumerAtataContextBuilder<TScreenshotConsumer> AddScreenshotConsumer<TScreenshotConsumer>()438 where TScreenshotConsumer : IScreenshotConsumer, new()439 =>440 ScreenshotConsumers.Add<TScreenshotConsumer>();441442 [Obsolete("Use ScreenshotConsumers.Add(...) instead.")] // Obsolete since v2.0.0.443 public ScreenshotConsumerAtataContextBuilder<TScreenshotConsumer> AddScreenshotConsumer<TScreenshotConsumer>(TScreenshotConsumer consumer)444 where TScreenshotConsumer : IScreenshotConsumer445 =>446 ScreenshotConsumers.Add(consumer);447448 [Obsolete("Use ScreenshotConsumers.Add(...) instead.")] // Obsolete since v2.0.0.449 public ScreenshotConsumerAtataContextBuilder<IScreenshotConsumer> AddScreenshotConsumer(string typeNameOrAlias) =>450 ScreenshotConsumers.Add(typeNameOrAlias);451452 [Obsolete("Use ScreenshotConsumers.AddFile() instead.")] // Obsolete since v2.0.0.453 public ScreenshotConsumerAtataContextBuilder<FileScreenshotConsumer> AddScreenshotFileSaving() =>454 ScreenshotConsumers.AddFile();455456 /// <summary>457 /// Sets the factory method of the test name.458 /// </summary>459 /// <param name="testNameFactory">The factory method of the test name.</param>460 /// <returns>The <see cref="AtataContextBuilder"/> instance.</returns>461 public AtataContextBuilder UseTestName(Func<string> testNameFactory)462 {463 testNameFactory.CheckNotNull(nameof(testNameFactory));464465 BuildingContext.TestNameFactory = testNameFactory;466 return this;467 }468469 /// <summary>470 /// Sets the name of the test.471 /// </summary>472 /// <param name="testName">The name of the test.</param>473 /// <returns>The <see cref="AtataContextBuilder"/> instance.</returns>474 public AtataContextBuilder UseTestName(string testName)475 {476 BuildingContext.TestNameFactory = () => testName;477 return this;478 }479480 /// <summary>481 /// Sets the factory method of the test suite name.482 /// </summary>483 /// <param name="testSuiteNameFactory">The factory method of the test suite name.</param>484 /// <returns>The <see cref="AtataContextBuilder"/> instance.</returns>485 public AtataContextBuilder UseTestSuiteName(Func<string> testSuiteNameFactory)486 {487 testSuiteNameFactory.CheckNotNull(nameof(testSuiteNameFactory));488489 BuildingContext.TestSuiteNameFactory = testSuiteNameFactory;490 return this;491 }492493 /// <summary>494 /// Sets the name of the test suite (fixture/class).495 /// </summary>496 /// <param name="testSuiteName">The name of the test suite.</param>497 /// <returns>The <see cref="AtataContextBuilder"/> instance.</returns>498 public AtataContextBuilder UseTestSuiteName(string testSuiteName)499 {500 BuildingContext.TestSuiteNameFactory = () => testSuiteName;501 return this;502 }503504 /// <summary>505 /// Sets the factory method of the test suite (fixture/class) type.506 /// </summary>507 /// <param name="testSuiteTypeFactory">The factory method of the test suite type.</param>508 /// <returns>The <see cref="AtataContextBuilder"/> instance.</returns>509 public AtataContextBuilder UseTestSuiteType(Func<Type> testSuiteTypeFactory)510 {511 testSuiteTypeFactory.CheckNotNull(nameof(testSuiteTypeFactory));512513 BuildingContext.TestSuiteTypeFactory = testSuiteTypeFactory;514 return this;515 }516517 /// <summary>518 /// Sets the type of the test suite (fixture/class).519 /// </summary>520 /// <param name="testSuiteType">The type of the test suite.</param>521 /// <returns>The <see cref="AtataContextBuilder"/> instance.</returns>522 public AtataContextBuilder UseTestSuiteType(Type testSuiteType)523 {524 testSuiteType.CheckNotNull(nameof(testSuiteType));525526 BuildingContext.TestSuiteTypeFactory = () => testSuiteType;527 return this;528 }529530 /// <summary>531 /// Sets the UTC time zone.532 /// </summary>533 /// <returns>The <see cref="AtataContextBuilder"/> instance.</returns>534 public AtataContextBuilder UseUtcTimeZone() =>535 UseTimeZone(TimeZoneInfo.Utc);536537 /// <summary>538 /// Sets the time zone by identifier, which corresponds to the <see cref="TimeZoneInfo.Id"/> property.539 /// </summary>540 /// <param name="timeZoneId">The time zone identifier.</param>541 /// <returns>The <see cref="AtataContextBuilder"/> instance.</returns>542 public AtataContextBuilder UseTimeZone(string timeZoneId)543 {544 timeZoneId.CheckNotNullOrWhitespace(nameof(timeZoneId));545 TimeZoneInfo timeZone = TimeZoneInfo.FindSystemTimeZoneById(timeZoneId);546547 return UseTimeZone(timeZone);548 }549550 /// <summary>551 /// Sets the time zone.552 /// </summary>553 /// <param name="timeZone">The time zone.</param>554 /// <returns>The <see cref="AtataContextBuilder"/> instance.</returns>555 public AtataContextBuilder UseTimeZone(TimeZoneInfo timeZone)556 {557 timeZone.CheckNotNull(nameof(timeZone));558559 BuildingContext.TimeZone = timeZone;560 return this;561 }562563 /// <summary>564 /// Sets the base URL.565 /// </summary>566 /// <param name="baseUrl">The base URL.</param>567 /// <returns>The <see cref="AtataContextBuilder"/> instance.</returns>568 public AtataContextBuilder UseBaseUrl(string baseUrl)569 {570 if (baseUrl != null && !Uri.IsWellFormedUriString(baseUrl, UriKind.Absolute))571 throw new ArgumentException($"Invalid URL format \"{baseUrl}\".", nameof(baseUrl));572573 BuildingContext.BaseUrl = baseUrl;574 return this;575 }576577 /// <summary>578 /// Sets the base retry timeout.579 /// The default value is <c>5</c> seconds.580 /// </summary>581 /// <param name="timeout">The retry timeout.</param>582 /// <returns>The <see cref="AtataContextBuilder"/> instance.</returns>583 public AtataContextBuilder UseBaseRetryTimeout(TimeSpan timeout)584 {585 BuildingContext.BaseRetryTimeout = timeout;586 return this;587 }588589 /// <summary>590 /// Sets the base retry interval.591 /// The default value is <c>500</c> milliseconds.592 /// </summary>593 /// <param name="interval">The retry interval.</param>594 /// <returns>The <see cref="AtataContextBuilder"/> instance.</returns>595 public AtataContextBuilder UseBaseRetryInterval(TimeSpan interval)596 {597 BuildingContext.BaseRetryInterval = interval;598 return this;599 }600601 /// <summary>602 /// Sets the element find timeout.603 /// The default value is taken from <see cref="AtataBuildingContext.BaseRetryTimeout"/>, which is equal to <c>5</c> seconds by default.604 /// </summary>605 /// <param name="timeout">The retry timeout.</param>606 /// <returns>The <see cref="AtataContextBuilder"/> instance.</returns>607 public AtataContextBuilder UseElementFindTimeout(TimeSpan timeout)608 {609 BuildingContext.ElementFindTimeout = timeout;610 return this;611 }612613 /// <summary>614 /// Sets the element find retry interval.615 /// The default value is taken from <see cref="AtataBuildingContext.BaseRetryInterval"/>, which is equal to <c>500</c> milliseconds by default.616 /// </summary>617 /// <param name="interval">The retry interval.</param>618 /// <returns>The <see cref="AtataContextBuilder"/> instance.</returns>619 public AtataContextBuilder UseElementFindRetryInterval(TimeSpan interval)620 {621 BuildingContext.ElementFindRetryInterval = interval;622 return this;623 }624625 /// <summary>626 /// Sets the waiting timeout.627 /// The default value is taken from <see cref="AtataBuildingContext.BaseRetryTimeout"/>, which is equal to <c>5</c> seconds by default.628 /// </summary>629 /// <param name="timeout">The retry timeout.</param>630 /// <returns>The <see cref="AtataContextBuilder"/> instance.</returns>631 public AtataContextBuilder UseWaitingTimeout(TimeSpan timeout)632 {633 BuildingContext.WaitingTimeout = timeout;634 return this;635 }636637 /// <summary>638 /// Sets the waiting retry interval.639 /// The default value is taken from <see cref="AtataBuildingContext.BaseRetryInterval"/>, which is equal to <c>500</c> milliseconds by default.640 /// </summary>641 /// <param name="interval">The retry interval.</param>642 /// <returns>The <see cref="AtataContextBuilder"/> instance.</returns>643 public AtataContextBuilder UseWaitingRetryInterval(TimeSpan interval)644 {645 BuildingContext.WaitingRetryInterval = interval;646 return this;647 }648649 /// <summary>650 /// Sets the verification timeout.651 /// The default value is taken from <see cref="AtataBuildingContext.BaseRetryTimeout"/>, which is equal to <c>5</c> seconds by default.652 /// </summary>653 /// <param name="timeout">The retry timeout.</param>654 /// <returns>The <see cref="AtataContextBuilder"/> instance.</returns>655 public AtataContextBuilder UseVerificationTimeout(TimeSpan timeout)656 {657 BuildingContext.VerificationTimeout = timeout;658 return this;659 }660661 /// <summary>662 /// Sets the verification retry interval.663 /// The default value is taken from <see cref="AtataBuildingContext.BaseRetryInterval"/>, which is equal to <c>500</c> milliseconds by default.664 /// </summary>665 /// <param name="interval">The retry interval.</param>666 /// <returns>The <see cref="AtataContextBuilder"/> instance.</returns>667 public AtataContextBuilder UseVerificationRetryInterval(TimeSpan interval)668 {669 BuildingContext.VerificationRetryInterval = interval;670 return this;671 }672673 /// <summary>674 /// Sets the default control visibility.675 /// The default value is <see cref="Visibility.Any"/>.676 /// </summary>677 /// <param name="visibility">The visibility.</param>678 /// <returns>The <see cref="AtataContextBuilder"/> instance.</returns>679 public AtataContextBuilder UseDefaultControlVisibility(Visibility visibility)680 {681 BuildingContext.DefaultControlVisibility = visibility;682 return this;683 }684685 /// <summary>686 /// Sets the culture.687 /// The default value is <see cref="CultureInfo.CurrentCulture"/>.688 /// </summary>689 /// <param name="culture">The culture.</param>690 /// <returns>The <see cref="AtataContextBuilder"/> instance.</returns>691 public AtataContextBuilder UseCulture(CultureInfo culture)692 {693 BuildingContext.Culture = culture;694 return this;695 }696697 /// <summary>698 /// Sets the culture by the name.699 /// The default value is <see cref="CultureInfo.CurrentCulture"/>.700 /// </summary>701 /// <param name="cultureName">The name of the culture.</param>702 /// <returns>The <see cref="AtataContextBuilder"/> instance.</returns>703 public AtataContextBuilder UseCulture(string cultureName)704 {705 return UseCulture(CultureInfo.GetCultureInfo(cultureName));706 }707708 /// <summary>709 /// Sets the type of the assertion exception.710 /// The default value is a type of <see cref="AssertionException"/>.711 /// </summary>712 /// <typeparam name="TException">The type of the exception.</typeparam>713 /// <returns>The <see cref="AtataContextBuilder"/> instance.</returns>714 public AtataContextBuilder UseAssertionExceptionType<TException>()715 where TException : Exception716 {717 return UseAssertionExceptionType(typeof(TException));718 }719720 /// <summary>721 /// Sets the type of the assertion exception.722 /// The default value is a type of <see cref="AssertionException"/>.723 /// </summary>724 /// <param name="exceptionType">The type of the exception.</param>725 /// <returns>The <see cref="AtataContextBuilder"/> instance.</returns>726 public AtataContextBuilder UseAssertionExceptionType(Type exceptionType)727 {728 exceptionType.CheckIs<Exception>(nameof(exceptionType));729730 BuildingContext.AssertionExceptionType = exceptionType;731 return this;732 }733734 /// <summary>735 /// Sets the type of aggregate assertion exception.736 /// The default value is a type of <see cref="AggregateAssertionException"/>.737 /// The exception type should have public constructor with <c>IEnumerable&lt;AssertionResult&gt;</c> argument.738 /// </summary>739 /// <typeparam name="TException">The type of the exception.</typeparam>740 /// <returns>The <see cref="AtataContextBuilder"/> instance.</returns>741 public AtataContextBuilder UseAggregateAssertionExceptionType<TException>()742 where TException : Exception743 {744 return UseAggregateAssertionExceptionType(typeof(TException));745 }746747 /// <summary>748 /// Sets the type of aggregate assertion exception.749 /// The default value is a type of <see cref="AggregateAssertionException"/>.750 /// The exception type should have public constructor with <c>IEnumerable&lt;AssertionResult&gt;</c> argument.751 /// </summary>752 /// <param name="exceptionType">The type of the exception.</param>753 /// <returns>The <see cref="AtataContextBuilder"/> instance.</returns>754 public AtataContextBuilder UseAggregateAssertionExceptionType(Type exceptionType)755 {756 exceptionType.CheckIs<Exception>(nameof(exceptionType));757758 BuildingContext.AggregateAssertionExceptionType = exceptionType; ...

Full Screen

Full Screen

AtataBuildingContext.cs

Source:AtataBuildingContext.cs Github

copy

Full Screen

...246 /// <summary>247 /// Gets or sets the type of the assertion exception.248 /// The default value is a type of <see cref="AssertionException"/>.249 /// </summary>250 public Type AssertionExceptionType { get; set; } = typeof(AssertionException);251252 /// <summary>253 /// Gets or sets the type of the aggregate assertion exception.254 /// The default value is a type of <see cref="AggregateAssertionException"/>.255 /// The exception type should have public constructor with <c>IEnumerable&lt;AssertionResult&gt;</c> argument.256 /// </summary>257 public Type AggregateAssertionExceptionType { get; set; } = typeof(AggregateAssertionException);258259 /// <summary>260 /// Gets or sets the aggregate assertion strategy.261 /// The default value is an instance of <see cref="AtataAggregateAssertionStrategy"/>.262 /// </summary>263 public IAggregateAssertionStrategy AggregateAssertionStrategy { get; set; } = new AtataAggregateAssertionStrategy();264265 /// <summary>266 /// Gets or sets the strategy for warning assertion reporting.267 /// The default value is an instance of <see cref="AtataWarningReportStrategy"/>.268 /// </summary>269 public IWarningReportStrategy WarningReportStrategy { get; set; } = new AtataWarningReportStrategy();270271 /// <summary> ...

Full Screen

Full Screen

AttributesAtataContextBuilderTests.cs

Source:AttributesAtataContextBuilderTests.cs Github

copy

Full Screen

...55 {56 _sut.Component<StubPage>()57 .Add(_stubAttributes);58 _sut.BuildingContext.Attributes.ComponentMap.Keys.First()59 .Should().Be(typeof(StubPage));60 _sut.BuildingContext.Attributes.ComponentMap.Values61 .Should().ContainSingle().Which62 .Should().Equal(_stubAttributes);63 }64 [Test]65 public void AttributesAtataContextBuilder_Component_ByType()66 {67 _sut.Component(typeof(StubPage))68 .Add(_stubAttributes);69 _sut.BuildingContext.Attributes.ComponentMap.Keys.First()70 .Should().Be(typeof(StubPage));71 _sut.BuildingContext.Attributes.ComponentMap.Values72 .Should().ContainSingle().Which73 .Should().Equal(_stubAttributes);74 }75 [TestCase("Atata.Tests." + nameof(StubPage) + ", Atata.Tests")]76 [TestCase("Atata.Tests." + nameof(StubPage))]77 [TestCase(nameof(StubPage))]78 public void AttributesAtataContextBuilder_Component_ByTypeName(string typeName)79 {80 _sut.Component(typeName)81 .Add(_stubAttributes);82 _sut.BuildingContext.Attributes.ComponentMap.Keys.First()83 .Should().Be(typeof(StubPage));84 _sut.BuildingContext.Attributes.ComponentMap.Values85 .Should().ContainSingle().Which86 .Should().Equal(_stubAttributes);87 }88 }89}...

Full Screen

Full Screen

typeof

Using AI Code Generation

copy

Full Screen

1using Atata;2using NUnit.Framework;3{4 {5 public void _2()6 {7 Go.To<HomePage>()8 .Header.Should.Equal("Atata Samples");9 .Should.Equal(typeof(AtataBuildingContext));10 }11 }12}13using Atata;14using NUnit.Framework;15{16 {17 public void _3()18 {19 Go.To<HomePage>()20 .Header.Should.Equal("Atata Samples");21 .Should.Equal(typeof(AtataBuildingContext));22 }23 }24}25using Atata;26using NUnit.Framework;27{28 {29 public void _4()30 {31 Go.To<HomePage>()32 .Header.Should.Equal("Atata Samples");33 .Should.Equal(typeof(AtataBuildingContext));34 }35 }36}37using Atata;38using NUnit.Framework;39{40 {41 public void _5()42 {43 Go.To<HomePage>()44 .Header.Should.Equal("Atata Samples");45 .Should.Equal(typeof(AtataBuildingContext));46 }47 }48}49using Atata;50using NUnit.Framework;51{52 {53 public void _6()54 {55 Go.To<HomePage>()56 .Header.Should.Equal("Atata Samples");57 .Should.Equal(typeof(AtataBuildingContext));58 }59 }60}

Full Screen

Full Screen

typeof

Using AI Code Generation

copy

Full Screen

1AtataBuildingContext context = new AtataBuildingContext();2Type type = context.GetType();3Console.WriteLine(type);4AtataBuildingContext context = new AtataBuildingContext();5Type type = typeof(AtataBuildingContext);6Console.WriteLine(type);7Type type = typeof(AtataBuildingContext);8Console.WriteLine(type);9AtataBuildingContext context = new AtataBuildingContext();10Type type = context.GetType();11Console.WriteLine(type);12AtataBuildingContext context = new AtataBuildingContext();13Type type = typeof(AtataBuildingContext);14Console.WriteLine(type);15Type type = typeof(AtataBuildingContext);16Console.WriteLine(type);17AtataBuildingContext context = new AtataBuildingContext();18Type type = context.GetType();19Console.WriteLine(type);20AtataBuildingContext context = new AtataBuildingContext();21Type type = typeof(AtataBuildingContext);22Console.WriteLine(type);23Type type = typeof(AtataBuildingContext);24Console.WriteLine(type);25AtataBuildingContext context = new AtataBuildingContext();26Type type = context.GetType();27Console.WriteLine(type);

Full Screen

Full Screen

typeof

Using AI Code Generation

copy

Full Screen

1using Atata;2using NUnit.Framework;3{4 {5 public void Test()6 {7 Go.To<HomePage>()8 .SignIn.ClickAndGo<SignInPage>()9 .Email.Set("

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Atata automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful