Skip to content

Commit 4e472ab

Browse files
authored
Network refactor (#1923)
1 parent adb2c74 commit 4e472ab

File tree

111 files changed

+548
-242
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

111 files changed

+548
-242
lines changed

.github/workflows/demo.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,14 @@ name: Demo Project
22

33
on:
44
push:
5+
branches:
6+
- master
7+
- release-*
58
pull_request:
6-
branches: [ master ]
9+
branches: [master]
10+
paths:
11+
- "**.cs"
12+
- "**.csproj"
713

814
jobs:
915
build:

.github/workflows/dotnet.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ name: build
22

33
on:
44
push:
5+
branches:
6+
- master
7+
- release-*
58
pull_request:
69
branches: [ master ]
710
paths:

lib/PuppeteerSharp.Tests/AccessibilityTests/AccessibilityTests.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
using System;
21
using System.Threading.Tasks;
3-
using Newtonsoft.Json;
42
using PuppeteerSharp.PageAccessibility;
53
using PuppeteerSharp.Tests.Attributes;
64
using PuppeteerSharp.Xunit;
@@ -97,6 +95,7 @@ await Page.SetContentAsync(@"
9795
Role= "combobox",
9896
Name= "",
9997
Value= "First Option",
98+
HasPopup = "menu",
10099
Children= new SerializedAXNode[]{
101100
new SerializedAXNode
102101
{
@@ -162,7 +161,8 @@ public async Task RoleDescription()
162161
{
163162
await Page.SetContentAsync("<div tabIndex=-1 aria-roledescription='foo'>Hi</div>");
164163
var snapshot = await Page.Accessibility.SnapshotAsync();
165-
Assert.Equal("foo", snapshot.Children[0].RoleDescription);
164+
// See https://chromium-review.googlesource.com/c/chromium/src/+/3088862
165+
Assert.Null(snapshot.Children[0].RoleDescription);
166166
}
167167

168168
[PuppeteerTest("accessibility.spec.ts", "Accessibility", "orientation")]

lib/PuppeteerSharp.Tests/AccessibilityTests/RootOptionTests.cs

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,13 @@ await Page.SetContentAsync(@"
6060
");
6161

6262
var menu = await Page.QuerySelectorAsync("div[role=\"menu\"]");
63-
Assert.Equal(
64-
new SerializedAXNode
65-
{
66-
Role = "menu",
67-
Name = "My Menu",
68-
Children = new[]
63+
var snapshot = await Page.Accessibility.SnapshotAsync(new AccessibilitySnapshotOptions { Root = menu });
64+
var nodeToCheck = new SerializedAXNode
65+
{
66+
Role = "menu",
67+
Name = "My Menu",
68+
Orientation = "vertical",
69+
Children = new[]
6970
{
7071
new SerializedAXNode
7172
{
@@ -83,8 +84,9 @@ await Page.SetContentAsync(@"
8384
Name = "Third Item"
8485
}
8586
}
86-
},
87-
await Page.Accessibility.SnapshotAsync(new AccessibilitySnapshotOptions { Root = menu }));
87+
};
88+
89+
Assert.Equal(nodeToCheck, snapshot);
8890
}
8991

9092
[PuppeteerTest("accessibility.spec.ts", "root option", "should return null when the element is no longer in DOM")]

lib/PuppeteerSharp.Tests/HeadfulTests/HeadfulTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public async Task ShouldHaveDefaultUrlWhenLaunchingBrowser()
7272
}
7373

7474
[PuppeteerTest("headful.spec.ts", "HEADFUL", "headless should be able to read cookies written by headful")]
75-
[SkipBrowserFact(skipFirefox: true)]
75+
[PuppeteerFact(Skip = "Puppeteer ignores this in windows we do not have a platform filter yet")]
7676
public async Task HeadlessShouldBeAbleToReadCookiesWrittenByHeadful()
7777
{
7878
using (var userDataDir = new TempDirectory())

lib/PuppeteerSharp.Tests/NetworkTests/NetworkEventTests.cs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
using Microsoft.AspNetCore.Http;
2-
using Microsoft.AspNetCore.Http.Features;
3-
using Newtonsoft.Json.Linq;
41
using PuppeteerSharp.Tests.Attributes;
52
using PuppeteerSharp.Xunit;
63
using System.Collections.Generic;
@@ -129,7 +126,7 @@ public async Task ShouldFireEventsInProperOrder()
129126
Page.Response += (_, _) => events.Add("response");
130127
Page.RequestFinished += (_, _) => events.Add("requestfinished");
131128
await Page.GoToAsync(TestConstants.EmptyPage);
132-
Assert.Equal(new[] { "request", "response", "requestfinished" }, events);
129+
Assert.Equal(new[] { "request", "response", "requestfinished" }, events.ToArray());
133130
}
134131

135132
[PuppeteerTest("network.spec.ts", "Network Events", "should support redirects")]
@@ -144,14 +141,15 @@ public async Task ShouldSupportRedirects()
144141
Server.SetRedirect("/foo.html", "/empty.html");
145142
const string FOO_URL = TestConstants.ServerUrl + "/foo.html";
146143
var response = await Page.GoToAsync(FOO_URL);
144+
System.Console.WriteLine(string.Concat(events, ','));
147145
Assert.Equal(new[] {
148146
$"GET {FOO_URL}",
149147
$"302 {FOO_URL}",
150148
$"DONE {FOO_URL}",
151149
$"GET {TestConstants.EmptyPage}",
152150
$"200 {TestConstants.EmptyPage}",
153151
$"DONE {TestConstants.EmptyPage}"
154-
}, events);
152+
}, events.ToArray());
155153

156154
// Check redirect chain
157155
var redirectChain = response.Request.RedirectChain;

lib/PuppeteerSharp.Tests/NetworkTests/ResponseJsonTests.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
using System.Collections.Generic;
2-
using System.Linq;
3-
using System.Net;
41
using System.Threading.Tasks;
5-
using Microsoft.AspNetCore.Http;
62
using Newtonsoft.Json.Linq;
73
using PuppeteerSharp.Tests.Attributes;
84
using PuppeteerSharp.Xunit;

lib/PuppeteerSharp/AddTagOptions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,4 @@ public class AddTagOptions
2626
/// <seealso href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script"/>
2727
public string Type { get; set; }
2828
}
29-
}
29+
}

lib/PuppeteerSharp/BoxModel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,4 @@ internal BoxModel()
3939
/// </summary>
4040
public int Height { get; internal set; }
4141
}
42-
}
42+
}

lib/PuppeteerSharp/BoxModelPoint.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@ public struct BoxModelPoint
1515
/// </summary>
1616
public decimal Y { get; set; }
1717
}
18-
}
18+
}

0 commit comments

Comments
 (0)