Skip to content

Commit

Permalink
chore: roll driver to 1.41.0-beta
Browse files Browse the repository at this point in the history
Reference microsoft#2772
  • Loading branch information
yury-s committed Jan 16, 2024
1 parent dbeac36 commit 9edbddd
Show file tree
Hide file tree
Showing 39 changed files with 1,193 additions and 63 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@

| | Linux | macOS | Windows |
| :--- | :---: | :---: | :---: |
| Chromium <!-- GEN:chromium-version -->120.0.6099.56<!-- GEN:stop --> ||||
| Chromium <!-- GEN:chromium-version -->121.0.6167.57<!-- GEN:stop --> ||||
| WebKit <!-- GEN:webkit-version -->17.4<!-- GEN:stop --> ||||
| Firefox <!-- GEN:firefox-version -->119.0<!-- GEN:stop --> ||||
| Firefox <!-- GEN:firefox-version -->121.0<!-- GEN:stop --> ||||

Playwright for .NET is the official language port of [Playwright](https://playwright.dev), the library to automate [Chromium](https://www.chromium.org/Home), [Firefox](https://www.mozilla.org/en-US/firefox/new/) and [WebKit](https://webkit.org/) with a single API. Playwright is built to enable cross-browser web automation that is **ever-green**, **capable**, **reliable** and **fast**.

Expand Down
2 changes: 1 addition & 1 deletion src/Common/Version.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<PropertyGroup>
<AssemblyVersion>1.40.0</AssemblyVersion>
<PackageVersion>$(AssemblyVersion)</PackageVersion>
<DriverVersion>1.40.0</DriverVersion>
<DriverVersion>1.41.0-beta-1705092460000</DriverVersion>
<ReleaseVersion>$(AssemblyVersion)</ReleaseVersion>
<FileVersion>$(AssemblyVersion)</FileVersion>
<NoDefaultExcludes>true</NoDefaultExcludes>
Expand Down
25 changes: 25 additions & 0 deletions src/Playwright.Tests/BrowserContextRouteTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -356,4 +356,29 @@ await context.RouteAsync("**/empty.html", (route) =>
await page.GotoAsync(Server.EmptyPage);
Assert.AreEqual(new List<int>() { 3, 2, 1 }, interceped);
}

[PlaywrightTest("browsercontext-route.spec.ts", "should work if handler with times parameter was removed from another handler")]
public async Task ShouldWorkIfHandlerWithTimesParameterWasRemovedFromAnotherHandler()
{
await using var context = await Browser.NewContextAsync();
var page = await context.NewPageAsync();
var intercepted = new List<string>();
Action<IRoute> handler = (route) =>
{
intercepted.Add("first");
route.ContinueAsync();
};
await context.RouteAsync("**/*", handler, new() { Times = 1 });
await context.RouteAsync("**/*", async (route) =>
{
intercepted.Add("second");
await context.UnrouteAsync("**/*", handler);
await route.FallbackAsync();
});
await page.GotoAsync(Server.EmptyPage);
Assert.AreEqual(new List<string>() { "second" }, intercepted);
intercepted.Clear();
await page.GotoAsync(Server.EmptyPage);
Assert.AreEqual(new List<string>() { "second" }, intercepted);
}
}
23 changes: 23 additions & 0 deletions src/Playwright.Tests/PageRouteTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -766,4 +766,27 @@ await page.RouteAsync("**/empty.html", (route) =>
await page.GotoAsync(Server.EmptyPage);
Assert.AreEqual(new List<int>() { 3, 2, 1 }, interceped);
}

[PlaywrightTest("page-route.spec.ts", "should work if handler with times parameter was removed from another handler")]
public async Task ShouldWorkIfHandlerWithTimesParameterWasRemovedFromAnotherHandler()
{
var intercepted = new List<string>();
Action<IRoute> handler = (route) =>
{
intercepted.Add("first");
route.ContinueAsync();
};
await Page.RouteAsync("**/*", handler, new() { Times = 1 });
await Page.RouteAsync("**/*", async (route) =>
{
intercepted.Add("second");
await Page.UnrouteAsync("**/*", handler);
await route.FallbackAsync();
});
await Page.GotoAsync(Server.EmptyPage);
Assert.AreEqual(new List<string>() { "second" }, intercepted);
intercepted.Clear();
await Page.GotoAsync(Server.EmptyPage);
Assert.AreEqual(new List<string>() { "second" }, intercepted);
}
}
28 changes: 28 additions & 0 deletions src/Playwright.Tests/PageScreenshotTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -447,4 +447,32 @@ public async Task PathOptionShouldThrowForUnsupportedMimeType()
var exception = await PlaywrightAssert.ThrowsAsync<ArgumentException>(() => Page.ScreenshotAsync(new() { Path = "file.txt" }));
StringAssert.Contains("path: unsupported mime type \"text/plain\"", exception.Message);
}

[PlaywrightTest("page-screenshot.spec.ts", "should hide elements based on attr")]
public async Task ShouldHideElementsBasedOnAttr()
{
await Page.SetViewportSizeAsync(500, 500);
await Page.GotoAsync(Server.Prefix + "/grid.html");
await Page.Locator("div").Nth(5).EvaluateAsync("element => element.setAttribute('data-test-screenshot', 'hide')");
var screenshot = await Page.ScreenshotAsync(new() { Style = @"[data-test-screenshot=""hide""] {
visibility: hidden;
}" });
Assert.True(ScreenshotHelper.PixelMatch("hide-should-work.png", screenshot));
var visibility = await Page.Locator("div").Nth(5).EvaluateAsync<string>("element => element.style.visibility");
Assert.AreEqual("", visibility);
}

[PlaywrightTest("page-screenshot.spec.ts", "should remove elements based on attr")]
public async Task ShouldRemoveElementsBasedOnAttr()
{
await Page.SetViewportSizeAsync(500, 500);
await Page.GotoAsync(Server.Prefix + "/grid.html");
await Page.Locator("div").Nth(5).EvaluateAsync("element => element.setAttribute('data-test-screenshot', 'remove')");
var screenshot = await Page.ScreenshotAsync(new() { Style = @"[data-test-screenshot=""remove""] {
visibility: none;
}" });
Assert.True(ScreenshotHelper.PixelMatch("remove-should-work.png", screenshot));
var display = await Page.Locator("div").Nth(5).EvaluateAsync<string>("element => element.style.display");
Assert.AreEqual("", display);
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 9edbddd

Please sign in to comment.