Skip to content

Commit 07d6607

Browse files
#97 Add support of DomTestIdAttributeName and DomTestIdAttributeDefaultCase configuration properties
1 parent 7658c41 commit 07d6607

File tree

4 files changed

+26
-4
lines changed

4 files changed

+26
-4
lines changed

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,16 @@ public double? RetryInterval
170170
/// </summary>
171171
public string WarningReportStrategyType { get; set; }
172172

173+
/// <summary>
174+
/// Gets or sets the name of the DOM test identifier attribute.
175+
/// </summary>
176+
public string DomTestIdAttributeName { get; set; }
177+
178+
/// <summary>
179+
/// Gets or sets the default case of the DOM test identifier attribute.
180+
/// </summary>
181+
public TermCase? DomTestIdAttributeDefaultCase { get; set; }
182+
173183
/// <summary>
174184
/// Gets or sets a value indicating whether to use NUnit test name.
175185
/// </summary>

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,12 @@ public static AtataContextBuilder Map<TConfig>(TConfig config, AtataContextBuild
8787
ActivatorEx.CreateInstance<IWarningReportStrategy>(
8888
TypeFinder.FindInAssemblies(config.WarningReportStrategyType, lazyAssembliesToFindTypesIn.Value)));
8989

90+
if (config.DomTestIdAttributeName is not null)
91+
builder.UseDomTestIdAttributeName(config.DomTestIdAttributeName);
92+
93+
if (config.DomTestIdAttributeDefaultCase is not null)
94+
builder.UseDomTestIdAttributeDefaultCase(config.DomTestIdAttributeDefaultCase.Value);
95+
9096
if (config.UseNUnitTestName)
9197
builder.UseNUnitTestName();
9298

test/Atata.Configuration.Json.Tests/Configs/StandardSettings.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,8 @@
1515
"customStringVar": "strvar"
1616
},
1717

18+
"domTestIdAttributeName": "data-autoid",
19+
"domTestIdAttributeDefaultCase": "midSentence",
20+
1821
"useAllNUnitFeatures": true
1922
}

test/Atata.Configuration.Json.Tests/StandardSettingsTests.cs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,24 @@ public void Regular()
1111
.Build()
1212
.ToResultSubject();
1313

14-
result.ValueOf(x => x.DriverInitializationStage).Should.Equal(AtataContextDriverInitializationStage.OnDemand);
14+
result.ValueOf(x => x.DriverInitializationStage).Should.Be(AtataContextDriverInitializationStage.OnDemand);
1515

16-
result.ValueOf(x => x.BaseUrl).Should.Equal("https://demo.atata.io/");
16+
result.ValueOf(x => x.BaseUrl).Should.Be("https://demo.atata.io/");
1717

18-
result.ValueOf(x => x.Artifacts.FullName.Value).Should.Equal(
18+
result.ValueOf(x => x.Artifacts.FullName.Value).Should.Be(
1919
Path.Combine(
2020
AppDomain.CurrentDomain.BaseDirectory,
2121
"artifacts",
2222
DateTime.Now.Year.ToString(),
2323
nameof(StandardSettingsTests),
2424
TestContext.CurrentContext.Test.Name));
2525

26-
result.ValueOf(x => x.TimeZone.Id).Should.Equal("UTC");
26+
result.ValueOf(x => x.TimeZone.Id).Should.Be("UTC");
2727

2828
result.ValueOf(x => x.Variables["customIntVar"]).Should.Be(7L);
2929
result.ValueOf(x => x.Variables["customStringVar"]).Should.Be("strvar");
30+
31+
result.ValueOf(x => x.DomTestIdAttributeName).Should.Be("data-autoid");
32+
result.ValueOf(x => x.DomTestIdAttributeDefaultCase).Should.Be(TermCase.MidSentence);
3033
}
3134
}

0 commit comments

Comments
 (0)