Skip to content

Commit 4e28486

Browse files
committed
Updated dotnet tools
1 parent 6ff67cc commit 4e28486

File tree

2 files changed

+21
-8
lines changed

2 files changed

+21
-8
lines changed

.config/dotnet-tools.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"version": 1,
3+
"isRoot": true,
4+
"tools": {
5+
"microsoft.playwright.cli": {
6+
"version": "1.2.3",
7+
"commands": [
8+
"playwright"
9+
],
10+
"rollForward": false
11+
}
12+
}
13+
}

Tests/TodosTests.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ namespace PlaywrightTestFramework.Tests;
1313
[AllureNUnit]
1414
public class TodosTests
1515
{
16-
private IPlaywright _playwright;
17-
private IBrowser _browser;
18-
private IPage _page;
16+
private IPlaywright? _playwright;
17+
private IBrowser? _browser;
18+
private IPage? _page;
1919

2020
[SetUp]
2121
public async Task SetUp()
@@ -33,7 +33,7 @@ public async Task SetUp()
3333
[AllureFeature("Demo Test")]
3434
public async Task AddAndToggleTodo_ShouldMarkItemCompleted()
3535
{
36-
var todo = new TodosPage(_page);
36+
var todo = new TodosPage(_page!);
3737
await todo.NavigateAsync();
3838

3939
const string todoText = "Write awesome Playwright tests";
@@ -42,7 +42,7 @@ public async Task AddAndToggleTodo_ShouldMarkItemCompleted()
4242
Assert.That(await todo.GetFirstTodoTextAsync(), Is.EqualTo(todoText));
4343

4444
await todo.ToggleFirstTodoAsync();
45-
var classAttr = await _page.Locator("ul.todo-list li:first-child")
45+
var classAttr = await _page!.Locator("ul.todo-list li:first-child")
4646
.GetAttributeAsync("class");
4747
Assert.That(classAttr, Does.Contain("completed"));
4848
}
@@ -56,13 +56,13 @@ public async Task TearDown()
5656
Directory.CreateDirectory("Screenshots");
5757
var file = Path.Combine("Screenshots",
5858
$"{TestContext.CurrentContext.Test.Name + DateTime.Today.ToString("dd MM yyyy hh mm ss")}.png");
59-
await _page.ScreenshotAsync(new PageScreenshotOptions { Path = file });
59+
await _page!.ScreenshotAsync(new PageScreenshotOptions { Path = file });
6060
Console.WriteLine($"Screenshot saved to: {Path.GetFullPath(file)}");
6161
AllureLifecycle.Instance.AddAttachment("Failure Screenshot", "image/png", file);
6262

6363
}
6464

65-
await _browser.CloseAsync();
66-
_playwright.Dispose();
65+
await _browser!.CloseAsync();
66+
_playwright!.Dispose();
6767
}
6868
}

0 commit comments

Comments
 (0)