Skip to content

Commit 043e0de

Browse files
committed
Added real world pages as tests
1 parent 4876f2b commit 043e0de

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

AngleSharp.Scripting.JavaScript.Tests/AngleSharp.Scripting.JavaScript.Tests.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@
8383
<Compile Include="InteractionTests.cs" />
8484
<Compile Include="JqueryTests.cs" />
8585
<Compile Include="Mocks\DelayedRequester.cs" />
86+
<Compile Include="PageTests.cs" />
8687
<Compile Include="Properties\AssemblyInfo.cs" />
8788
<Compile Include="ScriptEvalTests.cs" />
8889
<Compile Include="ScriptingTests.cs" />
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
namespace AngleSharp.Scripting.JavaScript.Tests
2+
{
3+
using NUnit.Framework;
4+
using System.Threading.Tasks;
5+
6+
[TestFixture]
7+
public class PageTests
8+
{
9+
//[Test]
10+
public async Task RunHtml5Test()
11+
{
12+
var target = "http://html5test.com";
13+
var config = Configuration.Default.WithJavaScript().WithCss().WithDefaultLoader(setup => setup.IsResourceLoadingEnabled = true);
14+
var context = BrowsingContext.New(config);
15+
var document = await context.OpenAsync(target);
16+
var points = document.QuerySelector("#score > .pointsPanel > h2 > strong").TextContent;
17+
Assert.AreNotEqual("0", points);
18+
}
19+
20+
//[Test]
21+
public async Task RunTaobao()
22+
{
23+
var target = "https://meadjohnson.world.tmall.com/search.htm?search=y&orderType=defaultSort&scene=taobao_shop";
24+
var config = Configuration.Default.WithJavaScript().WithCss().WithDefaultLoader(setup => setup.IsResourceLoadingEnabled = true);
25+
var context = BrowsingContext.New(config);
26+
var document = await context.OpenAsync(target);
27+
var prices = document.QuerySelectorAll("span.c-price");
28+
Assert.AreNotEqual(0, prices.Length);
29+
}
30+
}
31+
}

0 commit comments

Comments
 (0)