Skip to content

Commit ca5bc78

Browse files
#116 Remove obsolete configuration properties: "logNUnitError", "takeScreenshotOnNUnitError", "takePageSnapshotOnNUnitError", "onCleanUpAddArtifactsToNUnitTestContext", "onCleanUpAddDirectoryFilesToNUnitTestContext"
1 parent c86e046 commit ca5bc78

File tree

5 files changed

+0
-138
lines changed

5 files changed

+0
-138
lines changed

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

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -194,30 +194,6 @@ public double? RetryInterval
194194
/// </summary>
195195
public bool UseNUnitTestSuiteType { get; set; }
196196

197-
[Obsolete("Don't use the property as it will be removed in v3.")] // Obsolete since v2.5.0.
198-
public bool LogNUnitError { get; set; }
199-
200-
[Obsolete("Don't use the property as it will be removed in v3.")] // Obsolete since v2.5.0.
201-
public bool TakeScreenshotOnNUnitError { get; set; }
202-
203-
[Obsolete("Don't use the property as it will be removed in v3.")] // Obsolete since v2.5.0.
204-
public string TakeScreenshotOnNUnitErrorTitle { get; set; }
205-
206-
[Obsolete("Don't use the property as it will be removed in v3.")] // Obsolete since v2.5.0.
207-
public ScreenshotKind? TakeScreenshotOnNUnitErrorKind { get; set; }
208-
209-
[Obsolete("Don't use the property as it will be removed in v3.")] // Obsolete since v2.5.0.
210-
public bool TakePageSnapshotOnNUnitError { get; set; }
211-
212-
[Obsolete("Don't use the property as it will be removed in v3.")] // Obsolete since v2.5.0.
213-
public string TakePageSnapshotOnNUnitErrorTitle { get; set; }
214-
215-
[Obsolete("Don't use the property as it will be removed in v3.")] // Obsolete since v2.5.0.
216-
public bool OnCleanUpAddArtifactsToNUnitTestContext { get; set; }
217-
218-
// TODO: Make obsolete in v2.6.0.
219-
public string OnCleanUpAddDirectoryFilesToNUnitTestContext { get; set; }
220-
221197
/// <summary>
222198
/// Gets or sets a value indicating whether to use <see cref="NUnitAggregateAssertionStrategy"/> as the aggregate assertion strategy.
223199
/// </summary>

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

Lines changed: 0 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -106,89 +106,6 @@ public static AtataContextBuilder Map<TConfig>(TConfig config, AtataContextBuild
106106

107107
List<string> warnings = [];
108108

109-
// TODO: v3. Remove all the code below related to NUnit event handlers.
110-
#pragma warning disable CS0618 // Type or member is obsolete
111-
if (config.LogNUnitError)
112-
{
113-
builder.EventSubscriptions.LogNUnitError();
114-
115-
warnings.Add("""
116-
"logNUnitError" configuration property is deprecated. Use the following configuration instead:
117-
{
118-
"eventSubscriptions": [
119-
{
120-
"handlerType": "Atata.LogNUnitErrorEventHandler, Atata"
121-
}
122-
]
123-
}
124-
""");
125-
}
126-
127-
if (config.TakeScreenshotOnNUnitError)
128-
{
129-
ScreenshotKind screenshotKind = config.TakeScreenshotOnNUnitErrorKind ?? ScreenshotKind.Default;
130-
131-
if (config.TakeScreenshotOnNUnitErrorTitle is not null)
132-
builder.EventSubscriptions.TakeScreenshotOnNUnitError(screenshotKind, config.TakeScreenshotOnNUnitErrorTitle);
133-
else
134-
builder.EventSubscriptions.TakeScreenshotOnNUnitError(screenshotKind);
135-
136-
warnings.Add("""
137-
"takeScreenshotOnNUnitError", "takeScreenshotOnNUnitErrorKind" and "takeScreenshotOnNUnitErrorTitle" configuration properties are deprecated. Use the following configuration instead:
138-
{
139-
"eventSubscriptions": [
140-
{
141-
"handlerType": "Atata.TakeScreenshotOnNUnitErrorEventHandler, Atata",
142-
"screenshotKind": "default", // Optional. "default" by default. Can be "viewport" or "fullPage".
143-
"screenshotTitle": "Failed" // Optional. "Failed" by default.
144-
}
145-
]
146-
}
147-
""");
148-
}
149-
150-
if (config.TakePageSnapshotOnNUnitError)
151-
{
152-
if (config.TakePageSnapshotOnNUnitErrorTitle is not null)
153-
builder.EventSubscriptions.TakePageSnapshotOnNUnitError(config.TakePageSnapshotOnNUnitErrorTitle);
154-
else
155-
builder.EventSubscriptions.TakePageSnapshotOnNUnitError();
156-
157-
warnings.Add("""
158-
"takePageSnapshotOnNUnitError" and "takePageSnapshotOnNUnitErrorTitle" configuration properties are deprecated. Use the following configuration instead:
159-
{
160-
"eventSubscriptions": [
161-
{
162-
"handlerType": "Atata.TakePageSnapshotOnNUnitErrorEventHandler, Atata",
163-
"snapshotTitle": "Failed" // Optional. "Failed" by default.
164-
}
165-
]
166-
}
167-
""");
168-
}
169-
170-
if (config.OnCleanUpAddArtifactsToNUnitTestContext)
171-
{
172-
builder.EventSubscriptions.AddArtifactsToNUnitTestContext();
173-
174-
warnings.Add("""
175-
"onCleanUpAddArtifactsToNUnitTestContext" configuration property is deprecated. Use the following configuration instead:
176-
{
177-
"eventSubscriptions": [
178-
{
179-
"handlerType": "Atata.AddArtifactsToNUnitTestContextEventHandler, Atata"
180-
}
181-
]
182-
}
183-
""");
184-
}
185-
#pragma warning restore CS0618 // Type or member is obsolete
186-
187-
if (config.OnCleanUpAddDirectoryFilesToNUnitTestContext is not null)
188-
{
189-
builder.EventSubscriptions.AddDirectoryFilesToNUnitTestContext(config.OnCleanUpAddDirectoryFilesToNUnitTestContext);
190-
}
191-
192109
if (config.UseNUnitAggregateAssertionStrategy)
193110
builder.UseNUnitAggregateAssertionStrategy();
194111

test/Atata.Configuration.Json.Tests/Atata.Configuration.Json.Tests.csproj

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,6 @@
3737
<None Update="Configs\Attributes\Global.json">
3838
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
3939
</None>
40-
<None Update="Configs\NUnitObsoleteProperties.json">
41-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
42-
</None>
4340
<None Update="Configs\Chrome+NUnit.json">
4441
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
4542
</None>

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

Lines changed: 0 additions & 9 deletions
This file was deleted.

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

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -55,25 +55,6 @@ public void GeneralAndNUnit()
5555
}
5656
}
5757

58-
[Test]
59-
public void ObsoleteNUnitProperties()
60-
{
61-
List<string> logEntries = [];
62-
63-
using var context = AtataContext.Configure()
64-
.UseDriverInitializationStage(AtataContextDriverInitializationStage.None)
65-
.ApplyJsonConfig("Configs/NUnitObsoleteProperties.json")
66-
.LogConsumers.Add(new TextOutputLogConsumer(logEntries.Add))
67-
.WithMinLevel(LogLevel.Warn)
68-
.Build();
69-
70-
logEntries.Should().HaveCount(4);
71-
logEntries[0].Should().Contain("\"logNUnitError\" configuration property is deprecated");
72-
logEntries[1].Should().Contain("\"takeScreenshotOnNUnitError\", \"takeScreenshotOnNUnitErrorKind\" and \"takeScreenshotOnNUnitErrorTitle\" configuration properties are deprecated");
73-
logEntries[2].Should().Contain("\"takePageSnapshotOnNUnitError\" and \"takePageSnapshotOnNUnitErrorTitle\" configuration properties are deprecated");
74-
logEntries[3].Should().Contain("\"onCleanUpAddArtifactsToNUnitTestContext\" configuration property is deprecated");
75-
}
76-
7758
[Test]
7859
public void VerificationProperties()
7960
{

0 commit comments

Comments
 (0)