Skip to content

Commit 04b595b

Browse files
Androbinkblok
andauthored
Add failing ContentFrame test (#1972)
* Add failing ContentFrame test * Remove PuppeteerTest attribute Co-authored-by: Darío Kondratiuk <[email protected]>
1 parent cc42ae6 commit 04b595b

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<html>
2+
3+
<body>
4+
<iframe src="https://example.com"></iframe>
5+
</body>
6+
7+
</html>

lib/PuppeteerSharp.Tests/ElementHandleTests/ContentFrameTests.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,12 @@ namespace PuppeteerSharp.Tests.ElementHandleTests
1010
[Collection(TestConstants.TestFixtureCollectionName)]
1111
public class ContentFrameTests : PuppeteerPageBaseTest
1212
{
13+
private readonly LaunchOptions _headfulOptions;
14+
1315
public ContentFrameTests(ITestOutputHelper output) : base(output)
1416
{
17+
_headfulOptions = TestConstants.DefaultBrowserOptions();
18+
_headfulOptions.Headless = false;
1519
}
1620

1721
[PuppeteerTest("elementhandle.spec.ts", "ElementHandle.contentFrame", "should work")]
@@ -24,5 +28,16 @@ public async Task ShouldWork()
2428
var frame = await elementHandle.ContentFrameAsync();
2529
Assert.Equal(Page.FirstChildFrame(), frame);
2630
}
31+
32+
[PuppeteerFact]
33+
public async Task ShouldWorkHeadful()
34+
{
35+
await using var Browser = await Puppeteer.LaunchAsync(_headfulOptions);
36+
await using var Page = await Browser.NewPageAsync();
37+
await Page.GoToAsync($"{TestConstants.ServerUrl}/frame-example.html");
38+
var elementHandle = await Page.QuerySelectorAsync("iframe");
39+
var frame = await elementHandle.ContentFrameAsync();
40+
Assert.Equal(Page.FirstChildFrame(), frame);
41+
}
2742
}
2843
}

0 commit comments

Comments
 (0)