Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 11 additions & 15 deletions tests/E2E.NUnit.Tests/LocatorFrame/LocatorFrameTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -156,24 +156,20 @@ public async Task Click_should_survive_iframe_navigation()
await navigated;
}

// Known difference, hardkoded/e2e-dotnet#1066: a frame-scoped getByRole also matches the nested frame's button.
[Test]
public async Task GetBy_coverage_role_text_test_id_label_placeholder()
{
await ExpectedToFailAsync("observed matched 2 nodes", async () =>
{
await Browser.GotoAsync(Routed);
var button1 = Browser.FrameLocator("iframe").GetByRole("button");
var button2 = Browser.FrameLocator("iframe").GetByText("Hello", exact: false);
var button3 = Browser.FrameLocator("iframe").GetByTestId("buttonId");
await Expect.That(button1).ToHaveTextAsync("Hello iframe");
await Expect.That(button2).ToHaveTextAsync("Hello iframe");
await Expect.That(button3).ToHaveTextAsync("Hello iframe");
var input1 = Browser.FrameLocator("iframe").GetByLabel("Name");
await Expect.That(input1).ToHaveValueAsync("");
var input2 = Browser.FrameLocator("iframe").GetByPlaceholder("Placeholder");
await Expect.That(input2).ToHaveValueAsync("");
});
await Browser.GotoAsync(Routed);
var button1 = Browser.FrameLocator("iframe").GetByRole("button");
var button2 = Browser.FrameLocator("iframe").GetByText("Hello", exact: false);
var button3 = Browser.FrameLocator("iframe").GetByTestId("buttonId");
await Expect.That(button1).ToHaveTextAsync("Hello iframe");
await Expect.That(button2).ToHaveTextAsync("Hello iframe");
await Expect.That(button3).ToHaveTextAsync("Hello iframe");
var input1 = Browser.FrameLocator("iframe").GetByLabel("Name");
await Expect.That(input1).ToHaveValueAsync("");
var input2 = Browser.FrameLocator("iframe").GetByPlaceholder("Placeholder");
await Expect.That(input2).ToHaveValueAsync("");
}

[Test]
Expand Down
10 changes: 3 additions & 7 deletions tests/E2E.NUnit.Tests/SelectorsFrame/SelectorsFrameTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -85,16 +85,12 @@ public async Task DollarDollarEval_should_not_throw_for_missing_frame()
Assert.That(await Browser.FrameLocator("iframe").Locator("canvas").AllTextContentsAsync(), Has.Count.EqualTo(0));
}

// Known difference, hardkoded/e2e-dotnet#1066: a frame-scoped getByRole also matches the nested frame's button.
[Test]
public async Task Should_work_for_DollarEval()
{
await ExpectedToFailAsync("observed count 2", async () =>
{
await Browser.GotoAsync(Routed);
await Expect.That(Browser.FrameLocator("iframe").GetByRole("button")).ToHaveCountAsync(1);
await Expect.That(Browser.FrameLocator("iframe").Locator("button")).ToHaveCountAsync(1);
});
await Browser.GotoAsync(Routed);
await Expect.That(Browser.FrameLocator("iframe").GetByRole("button")).ToHaveCountAsync(1);
await Expect.That(Browser.FrameLocator("iframe").Locator("button")).ToHaveCountAsync(1);
}

[Test]
Expand Down
Loading