Skip to content

Commit d21dfaa

Browse files
#13 Add mapping of Base, ElementFind, Waiting, Verification timeout and interval; #14 Deprecate mapping of RetryTimeout and RetryInterval; Update GeneralSettings_NUnit test
1 parent 31556ec commit d21dfaa

File tree

5 files changed

+103
-14
lines changed

5 files changed

+103
-14
lines changed

README.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -367,8 +367,14 @@ string sectionBoolValue = AppConfig.Current.Section.BoolProperty;
367367
"takeScreenshotOnNUnitError": true,
368368
"takeScreenshotOnNUnitErrorTitle": "string",
369369
"assertionExceptionType": "string", // Replaces Atata.AssertionException type with custom type, e.g.: "NUnit.Framework.AssertionException, nunit.framework".
370-
"retryTimeout": 5, // Sets the retry timeout in seconds.
371-
"retryInterval": 0.5, // Sets the retry interval in seconds.
370+
"baseRetryTimeout": 5, // Sets the base retry timeout in seconds.
371+
"baseRetryInterval": 0.5, // Sets the base retry interval in seconds.
372+
"elementFindTimeout": 5, // Sets the element find timeout in seconds.
373+
"elementFindRetryInterval": 0.5, // Sets the element find retry interval in seconds.
374+
"waitingTimeout": 5, // Sets the waiting timeout in seconds.
375+
"waitingRetryInterval": 0.5, // Sets the waiting retry interval in seconds.
376+
"verificationTimeout": 5, // Sets the verification timeout in seconds.
377+
"verificationRetryInterval": 0.5, // Sets the verification retry interval in seconds.
372378
"logConsumers": [ // Configures list of log consumers.
373379
{
374380
"type": "nunit", // Supports: "debug", "trace", "nunit", "nlog" and custom consumers registered via LogConsumerAliases.Register method.

src/Atata.Configuration.Json.Tests/Configs/Chrome+NUnit.json

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,12 @@
1919
}
2020
],
2121
"assertionExceptionType": "NUnit.Framework.AssertionException, nunit.framework",
22-
"retryTimeout": 7,
23-
"retryInterval": 0.7
22+
"baseRetryTimeout": 7,
23+
"baseRetryInterval": 0.7,
24+
"elementFindTimeout": 8,
25+
"elementFindRetryInterval": 0.8,
26+
"waitingTimeout": 9,
27+
"waitingRetryInterval": 0.9,
28+
"verificationTimeout": 10,
29+
"verificationRetryInterval": 1
2430
}

src/Atata.Configuration.Json.Tests/GeneralSettingsTests.cs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,17 @@ public void GeneralSettings_NUnit()
2323

2424
context.AssertionExceptionType.Should().Be(typeof(NUnit.Framework.AssertionException));
2525

26-
context.RetryTimeout.Should().Be(TimeSpan.FromSeconds(7));
27-
context.RetryInterval.Should().Be(TimeSpan.FromSeconds(0.7));
26+
context.BaseRetryTimeout.Should().Be(TimeSpan.FromSeconds(7));
27+
context.BaseRetryInterval.Should().Be(TimeSpan.FromSeconds(0.7));
28+
29+
context.ElementFindTimeout.Should().Be(TimeSpan.FromSeconds(8));
30+
context.ElementFindRetryInterval.Should().Be(TimeSpan.FromSeconds(0.8));
31+
32+
context.WaitingTimeout.Should().Be(TimeSpan.FromSeconds(9));
33+
context.WaitingRetryInterval.Should().Be(TimeSpan.FromSeconds(0.9));
34+
35+
context.VerificationTimeout.Should().Be(TimeSpan.FromSeconds(10));
36+
context.VerificationRetryInterval.Should().Be(TimeSpan.FromSeconds(1));
2837

2938
context.TestNameFactory().Should().Be(nameof(GeneralSettings_NUnit));
3039
}

src/Atata.Configuration.Json/JsonConfig`1.cs

Lines changed: 54 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,14 +54,64 @@ public DriverJsonSection Driver
5454
public string Culture { get; set; }
5555

5656
/// <summary>
57-
/// Gets or sets the retry timeout in seconds.
57+
/// Gets or sets the base retry timeout in seconds.
5858
/// </summary>
59-
public double? RetryTimeout { get; set; }
59+
[Obsolete("Use BaseRetryTimeout instead.")] // Obsolete since v0.17.0.
60+
public double? RetryTimeout
61+
{
62+
get => BaseRetryTimeout;
63+
set => BaseRetryTimeout = value;
64+
}
65+
66+
/// <summary>
67+
/// Gets or sets the base retry interval in seconds.
68+
/// </summary>
69+
[Obsolete("Use BaseRetryInterval instead.")] // Obsolete since v0.17.0.
70+
public double? RetryInterval
71+
{
72+
get => BaseRetryInterval;
73+
set => BaseRetryInterval = value;
74+
}
75+
76+
/// <summary>
77+
/// Gets or sets the base retry timeout in seconds.
78+
/// </summary>
79+
public double? BaseRetryTimeout { get; set; }
80+
81+
/// <summary>
82+
/// Gets or sets the base retry interval in seconds.
83+
/// </summary>
84+
public double? BaseRetryInterval { get; set; }
85+
86+
/// <summary>
87+
/// Gets or sets the element find timeout in seconds.
88+
/// </summary>
89+
public double? ElementFindTimeout { get; set; }
90+
91+
/// <summary>
92+
/// Gets or sets the element find retry interval in seconds.
93+
/// </summary>
94+
public double? ElementFindRetryInterval { get; set; }
95+
96+
/// <summary>
97+
/// Gets or sets the waiting timeout in seconds.
98+
/// </summary>
99+
public double? WaitingTimeout { get; set; }
100+
101+
/// <summary>
102+
/// Gets or sets the waiting retry interval in seconds.
103+
/// </summary>
104+
public double? WaitingRetryInterval { get; set; }
105+
106+
/// <summary>
107+
/// Gets or sets the verification timeout in seconds.
108+
/// </summary>
109+
public double? VerificationTimeout { get; set; }
60110

61111
/// <summary>
62-
/// Gets or sets the retry interval in seconds.
112+
/// Gets or sets the verification retry interval in seconds.
63113
/// </summary>
64-
public double? RetryInterval { get; set; }
114+
public double? VerificationRetryInterval { get; set; }
65115

66116
public string AssertionExceptionType { get; set; }
67117

src/Atata.Configuration.Json/Mapping/JsonConfigMapper.cs

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,29 @@ public static AtataContextBuilder Map<TConfig>(TConfig config, AtataContextBuild
1313
if (config.Culture != null)
1414
builder.UseCulture(config.Culture);
1515

16-
if (config.RetryTimeout != null)
17-
builder.UseRetryTimeout(TimeSpan.FromSeconds(config.RetryTimeout.Value));
16+
if (config.BaseRetryTimeout != null)
17+
builder.UseBaseRetryTimeout(TimeSpan.FromSeconds(config.BaseRetryTimeout.Value));
1818

19-
if (config.RetryInterval != null)
20-
builder.UseRetryInterval(TimeSpan.FromSeconds(config.RetryInterval.Value));
19+
if (config.BaseRetryInterval != null)
20+
builder.UseBaseRetryInterval(TimeSpan.FromSeconds(config.BaseRetryInterval.Value));
21+
22+
if (config.ElementFindTimeout != null)
23+
builder.UseElementFindTimeout(TimeSpan.FromSeconds(config.ElementFindTimeout.Value));
24+
25+
if (config.ElementFindRetryInterval != null)
26+
builder.UseElementFindRetryInterval(TimeSpan.FromSeconds(config.ElementFindRetryInterval.Value));
27+
28+
if (config.WaitingTimeout != null)
29+
builder.UseWaitingTimeout(TimeSpan.FromSeconds(config.WaitingTimeout.Value));
30+
31+
if (config.WaitingRetryInterval != null)
32+
builder.UseWaitingRetryInterval(TimeSpan.FromSeconds(config.WaitingRetryInterval.Value));
33+
34+
if (config.VerificationTimeout != null)
35+
builder.UseVerificationTimeout(TimeSpan.FromSeconds(config.VerificationTimeout.Value));
36+
37+
if (config.VerificationRetryInterval != null)
38+
builder.UseVerificationRetryInterval(TimeSpan.FromSeconds(config.VerificationRetryInterval.Value));
2139

2240
if (config.AssertionExceptionType != null)
2341
builder.UseAssertionExceptionType(Type.GetType(config.AssertionExceptionType, true));

0 commit comments

Comments
 (0)