diff --git a/.github/workflows/integrity-checks.yml b/.github/workflows/integrity-checks.yml deleted file mode 100644 index 81dade8d..00000000 --- a/.github/workflows/integrity-checks.yml +++ /dev/null @@ -1,33 +0,0 @@ -name: Integrity Checks - -on: - push: - branches: - - main - - release-* - pull_request: - branches: - - main - - release-* - -jobs: - verify_generated_files: - name: Perform API Integrity Check - runs-on: ubuntu-20.04 - steps: - - uses: actions/checkout@v2 - with: - submodules: true - fetch-depth: 0 - - name: Setup .NET Core - uses: actions/setup-dotnet@v1 - with: - dotnet-version: 5.0.x - - name: Install prerequisites and download drivers - shell: pwsh - run: .\build.ps1 driver -prereqs - - name: Generate API - run: .\build.ps1 roll - shell: pwsh - - name: Verify generated API is up to date - run: git diff --exit-code \ No newline at end of file diff --git a/.github/workflows/nuget-package-tests.yml b/.github/workflows/nuget-package-tests.yml index 943a7ddd..a6148c21 100644 --- a/.github/workflows/nuget-package-tests.yml +++ b/.github/workflows/nuget-package-tests.yml @@ -27,9 +27,7 @@ jobs: dotnet-version: 5.0.x - name: Install prerequisites and download drivers shell: pwsh - run: | - .\build.ps1 driver -prereqs - .\build.ps1 wwwroot + run: ./build.ps1 driver -prereqs - name: Install Playwright CLI run: dotnet tool install --global Microsoft.Playwright.CLI - name: Build NUnit Package diff --git a/.github/workflows/smoke-tests.yml b/.github/workflows/smoke-tests.yml index a4928f69..59d0c101 100644 --- a/.github/workflows/smoke-tests.yml +++ b/.github/workflows/smoke-tests.yml @@ -26,9 +26,7 @@ jobs: dotnet-version: 5.0.x - name: Install prerequisites and download drivers shell: pwsh - run: | - ./build.ps1 driver - ./build.ps1 wwwroot + run: ./build.ps1 driver - name: Building... run: dotnet build ./src - name: Installing Browsers and dependencies... diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index cdc2d323..355331bf 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -31,9 +31,7 @@ jobs: dotnet-version: 5.0.x - name: Install prerequisites and download drivers shell: pwsh - run: | - ./build.ps1 driver - ./build.ps1 wwwroot + run: ./build.ps1 driver - name: Building... run: dotnet build ./src - name: Installing Browsers and dependencies... @@ -71,9 +69,7 @@ jobs: dotnet-version: 5.0.x - name: Install prerequisites and download drivers shell: pwsh - run: | - ./build.ps1 driver - ./build.ps1 wwwroot + run: ./build.ps1 driver - name: Building... run: | dotnet build -f netstandard2.0 ./src/Playwright/Playwright.csproj diff --git a/.gitmodules b/.gitmodules index 9ab899db..e69de29b 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +0,0 @@ -[submodule "playwright"] - path = playwright - url = https://github.com/microsoft/playwright diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 8fcfb66c..7ea73d5e 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -80,7 +80,7 @@ if you have PowerShell installed on your system. When you get the repo, you need to initialize the submodules and download the driver to start work. To do this, you can call: ```ps -.\build.ps1 driver -prereqs +./build.ps1 driver -prereqs ``` This will run the following commands: @@ -111,35 +111,25 @@ The resulting code will follow our style guides. This is also enforced in our CI Tests can either be executed in their entirety: ```powershell -dotnet test .\src\Playwright.sln +dotnet test ./src/Playwright.sln ``` You can also specify a single test to run: ```powershell -dotnet test .\src\Playwright.sln --filter Playwright.Tests.TapTests +dotnet test ./src/Playwright.sln --filter Playwright.Tests.TapTests ``` Additionally, you can use the Test Explorer if you're using Visual Studio. -### Generating the API & rolling the driver (upstream) +### Generating the APIs & rolling the driver (upstream) -We use the [generator](https://github.com/microsoft/playwright/blob/master/utils/doclint/generateDotnetApi.js), located upstream, to generate the interfaces from the "single source of truth". To help us keep track of versions, this repository has a [submodule dependency](https://github.blog/2016-02-01-working-with-submodules/) to upstream. +We use [this](https://github.com/microsoft/playwright/blob/master/utils/doclint/generateDotnetApi.js) generator for the API and [that](https://github.com/microsoft/playwright/blob/master/utils/generate_dotnet_channels.js) for generating the transport channels. Both are located upstream. -> Note: to simplify, this assumes you have PowerShell on your system. You can perform each of these steps manually, however. - -To generate the API, identify the commit sha of the point in time you wish to roll to, and run +To generate the API, identify the upstream driver version from the GitHub Actions logs of the point in time you wish to roll to, and run: ```powershell -.\build.ps1 roll commitsha +./build.ps1 roll ``` -This will essentially run the following: - -```powershell -cd playwright -git checkout commitsha -cd .. -node "playwright/utils/doclint/generateDotnetApi.js" "src/Playwright" -dotnet run --project ./src/tools/Playwright.Tooling/Playwright.Tooling.csproj -- download-drivers --basepath . -``` \ No newline at end of file +This will re-generate the neccessary files for the new driver version. diff --git a/README.md b/README.md index b7ebf11c..820674b2 100644 --- a/README.md +++ b/README.md @@ -3,9 +3,9 @@ | | Linux | macOS | Windows | | :--- | :---: | :---: | :---: | -| Chromium 94.0.4595.0 | ✅ | ✅ | ✅ | -| WebKit 15.0 | ✅ | ✅ | ✅ | -| Firefox 91.0 | ✅ | ✅ | ✅ | +| Chromium 98.0.4695.0 | ✅ | ✅ | ✅ | +| WebKit 15.4 | ✅ | ✅ | ✅ | +| Firefox 94.0.1 | ✅ | ✅ | ✅ | 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**. diff --git a/ROLLING.md b/ROLLING.md index bbf5d693..19d894ac 100644 --- a/ROLLING.md +++ b/ROLLING.md @@ -1,17 +1,19 @@ # Rolling Playwright-dotnet to the latest Playwright driver ## Pre-requisites -* remove old gen files: `find src/Playwright | grep Generated | xargs rm` -* install dotnet with installer: https://dotnet.microsoft.com/download/dotnet/5.0 -* install dotnet format tool: `dotnet tool install -g dotnet-format` + +* install .NET SDK 5 with installer: https://dotnet.microsoft.com/download/dotnet/5.0 * install [PowerShell](https://github.com/PowerShell/PowerShell) ## Rolling -* obtain the commit hash (long form) to where we're rolling to -* in the repo folder, run - ```powershell - .\Build.ps1 roll - ``` +1. Checkout the upstream main/release branch of the `playwright` repository. +1. Checkout the main/release branch of the `playwright-dotnet` repository. +1. Pick the latest driver from GitHub Action where you want to roll to. For releases, it should be `v1.X.Y`. For main branch, it should be something like `v1.X.Y-`. +1. By default it will pick `playwright` from `../playwright`. You can override it by setting the `PW_SRC_DIR` environment variable. -This will complete the entire process including replacing the version number and downloading drivers. \ No newline at end of file +```powershell +./build.ps1 roll +``` + +This will complete the entire process (downnload and set the new driver, re-generate API and transport channels, update the README). diff --git a/build.ps1 b/build.ps1 index fef5d548..4b53e163 100755 --- a/build.ps1 +++ b/build.ps1 @@ -3,46 +3,33 @@ [CmdletBinding(PositionalBinding = $false)] Param( [Parameter(ValueFromRemainingArguments = $true)][String[]]$verbs, - [Switch]$reset, [Switch]$prereqs ) +$upstream_repo_path = Join-Path -Path ".." -ChildPath "playwright" +if ($env:PW_SRC_DIR -ne $null) { + $upstream_repo_path = $env:PW_SRC_DIR +} +Write-Host "Upstream repo path: $upstream_repo_path" + function Get-Help() { - Write-Host "Actions (defaults to help):" + Write-Host "Commands:" Write-Host " init Performs the initalization of the repository, and installs/downloads" - Write-Host " all the required artifacts (i.e. driver), and initializes the submodule." - Write-Host " -reset Forces the submodule to be updated." + Write-Host " all the required artifacts (i.e. driver)." Write-Host " -prereqs Installs all the required prerequisites and dev certificates." Write-Host "" - Write-Host " roll [commit sha] Moves the submodule to the commit specified, generates the API, and downloads" - Write-Host " downloads the new driver." + Write-Host " roll Updates the API version, downloads driver, generates the API, and transport interfaces." Write-Host " driver Downloads the driver." Write-Host " help Prints this message." Write-Host " wwwroot Copies over the wwwroot." } function Invoke-Init() { - Invoke-InitializeSubmodule if ($prereqs) { Invoke-InstallRequirements } Invoke-DownloadDriver Invoke-WWWRoot } -function Get-SubmoduleStatus() { - $smStatus = git submodule status - return $smStatus -} - -function Invoke-InitializeSubmodule($enableReset = $true) { - # Check the status of the submodule, if not initialized, let's do that - if ((Get-SubmoduleStatus).StartsWith("-") -or ($enableReset -and $reset)) { - Write-Host "🔨 Initializing git submodule..." -NoNewline - git submodule update --init >$null 2>&1 - if ((Get-SubmoduleStatus).StartsWith("-")) { throw 'Could not initialize git submodule' } - Write-Host "`r✅ Finished initializing git submodule." - } -} - function Invoke-InstallRequirements() { Write-Host "🔨 Installing requirements..." -NoNewline dotnet tool install --global dotnet-format >$null 2>&1 @@ -51,58 +38,37 @@ function Invoke-InstallRequirements() { } function Invoke-DownloadDriver() { - # We need the submodule to be initialized for this, so we're forcing the check - Invoke-InitializeSubmodule $false if ($prereqs) { Invoke-InstallRequirements } Write-Host "🚀 Downloading drivers..." -NoNewline dotnet run --project ./src/tools/Playwright.Tooling/Playwright.Tooling.csproj -- download-drivers --basepath . } -function Invoke-WWWRoot() { +function Invoke-UpdateWWWRoot() { Write-Host "🌐 Synchronizing wwwroot folder..." - Remove-Item -Path .\src\Playwright.Tests.TestServer\wwwroot\ -Recurse -Force - Copy-Item -Path .\playwright\tests\assets -Destination .\src\Playwright.Tests.TestServer\wwwroot\ -Recurse + $dotnet_wwwroot_path = "./src/Playwright.Tests.TestServer/wwwroot" + Remove-Item -Path "$dotnet_wwwroot_path" -Recurse -Force + Copy-Item -Path "$upstream_repo_path/tests/assets" -Destination $dotnet_wwwroot_path -Recurse } function Invoke-Roll() { - if ($verbs.Length -eq 2) { - if ((Get-SubmoduleStatus).StartsWith("+")) { - $decision = $Host.UI.PromptForChoice("Update Submodule", - "The Submodule is already at a different commit, do you want to still use the new sha?", - @('&Yes, update', "E&xit"), - 0) - if ($decision -eq 1) { - Write-Host "⚠ Stopping roll." - return; - } - } - else { - Invoke-InitializeSubmodule - } + $new_driver_version = $verbs[1]; + $package = Get-Content "$upstream_repo_path/package.json" | ConvertFrom-Json + $upstream_package_version = $package.version - Push-Location "playwright" - Write-Host "🚀 Moving submodule to" $verbs[1] - git fetch - git checkout $verbs[1] - $rev = (git show -s --format=%ct HEAD) + '000' - Pop-Location + Write-Host "🚀 Rolling .NET to driver $new_driver_version and upstream version $upstream_package_version" - $package = Get-Content "playwright/package.json" | ConvertFrom-Json - - # Let's update the project file - [xml]$version = Get-Content ".\src\Common\Version.props" - $version.Project.PropertyGroup.DriverVersion = $package.version + "-" + $rev - $version.Project.PropertyGroup.AssemblyVersion = $package.version.Split("-")[0] - "Updating to " + $package.version + "-" + $rev - $version.Save([IO.Path]::Combine($pwd, 'src', 'Common', 'Version.props')) - } else { - Invoke-InitializeSubmodule - } + # Let's update the project file + [xml]$version = Get-Content "./src/Common/Version.props" + $version.Project.PropertyGroup.DriverVersion = $new_driver_version + $version.Save([IO.Path]::Combine($pwd, 'src', 'Common', 'Version.props')) Write-Host "🚀 Generating API..." - node "playwright/utils/doclint/generateDotnetApi.js" "src/Playwright" + node "$upstream_repo_path/utils/doclint/generateDotnetApi.js" "src/Playwright" + Write-Host "🚀 Generating transport channels..." + Remove-Item -Path "src/Playwright/Transport/Protocol/Generated/" -Recurse -Force + node "$upstream_repo_path/utils/generate_dotnet_channels.js" "src/Playwright" Invoke-DownloadDriver - Invoke-WWWRoot + Invoke-UpdateWWWRoot } if ($verbs.Length -eq 0) { @@ -115,5 +81,5 @@ switch ($verbs[0]) { "help" { Get-Help } "roll" { Invoke-Roll } "driver" { Invoke-DownloadDriver } - "wwwroot" { Invoke-WWWRoot } + "wwwroot" { Invoke-UpdateWWWRoot } } \ No newline at end of file diff --git a/playwright b/playwright deleted file mode 160000 index 7af0dc17..00000000 --- a/playwright +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 7af0dc178b8ddc212df18f4c423a3cdb60e94b0e diff --git a/src/Common/Version.props b/src/Common/Version.props index 70594fd9..4186ff78 100644 --- a/src/Common/Version.props +++ b/src/Common/Version.props @@ -1,8 +1,8 @@ - 1.17.0 + 1.17.1 $(AssemblyVersion)-next-1 - 1.17.0-1637048540000 + 1.17.1 $(AssemblyVersion) $(AssemblyVersion) true diff --git a/src/Playwright.Tests/TapTests.cs b/src/Playwright.Tests/TapTests.cs index 34d79b60..7da1fcb3 100644 --- a/src/Playwright.Tests/TapTests.cs +++ b/src/Playwright.Tests/TapTests.cs @@ -72,10 +72,7 @@ namespace Microsoft.Playwright.Tests await Page.TapAsync("#b", new() { Trial = true }); string[] result = await handle.JsonValueAsync(); - Assert.AreEqual(result, new string[] { - "pointerover", "pointerenter", - "pointerout", "pointerleave", - }); + Assert.AreEqual(result, new string[] { }); } [PlaywrightTest("tap.spec.ts", "should not send mouse events touchstart is canceled")] diff --git a/src/Playwright/API/Generated/IElementHandle.cs b/src/Playwright/API/Generated/IElementHandle.cs index 304f3e39..03acb15d 100644 --- a/src/Playwright/API/Generated/IElementHandle.cs +++ b/src/Playwright/API/Generated/IElementHandle.cs @@ -86,10 +86,8 @@ namespace Microsoft.Playwright /// /// Inherits from /// - /// In most cases, you would want to use the object instead. - /// You should only use if you want to retain a handle - /// to a particular DOM Node that you intend to pass into - /// as an argument. + /// The use of ElementHandle is discouraged, use objects and + /// web-first assertions instead. /// /// public partial interface IElementHandle : IJSHandle diff --git a/src/Playwright/API/Generated/IFrame.cs b/src/Playwright/API/Generated/IFrame.cs index a7ba5c6d..30f004d9 100644 --- a/src/Playwright/API/Generated/IFrame.cs +++ b/src/Playwright/API/Generated/IFrame.cs @@ -316,6 +316,13 @@ namespace Microsoft.Playwright /// var html = await frame.EvalOnSelectorAsync(".main-container", "(e, suffix) => e.outerHTML + suffix", "hello"); /// /// + /// + /// + /// This method does not wait for the element to pass actionability checks and therefore + /// can lead to the flaky tests. Use , other helper methods or web-first assertions instead. + /// + /// /// /// A selector to query for. See working with selectors /// for more details. @@ -343,6 +350,12 @@ namespace Microsoft.Playwright /// Examples: /// var divsCount = await frame.EvalOnSelectorAllAsync<bool>("div", "(divs, min) => divs.length >= min", 10); /// + /// + /// + /// In most cases, , other + /// helper methods and web-first assertions do a better job. + /// + /// /// /// A selector to query for. See working with selectors /// for more details. @@ -379,7 +392,7 @@ namespace Microsoft.Playwright /// cref="IFrame.EvaluateAsync"/>: /// /// - /// var bodyHandle = await frame.QuerySelectorAsync("body");
+ /// var bodyHandle = await frame.EvaluateAsync("document.body");
/// var html = await frame.EvaluateAsync<string>("([body, suffix]) => body.innerHTML + suffix", new object [] { bodyHandle, "hello" });
/// await bodyHandle.DisposeAsync(); ///
@@ -776,6 +789,12 @@ namespace Microsoft.Playwright /// match the selector, returns null. /// /// + /// + /// + /// The use of is discouraged, use + /// objects and web-first assertions instead. + /// + /// /// /// A selector to query for. See working with selectors /// for more details. @@ -791,6 +810,12 @@ namespace Microsoft.Playwright /// elements match the selector, returns empty array. /// /// + /// + /// + /// The use of is discouraged, use + /// objects instead. + /// + /// /// /// A selector to query for. See working with selectors /// for more details. @@ -1449,6 +1474,12 @@ namespace Microsoft.Playwright /// } /// /// + /// + /// + /// Playwright automatically waits for element to be ready before performing an action. + /// Using objects and web-first assertions make the code wait-for-selector-free. + /// + /// /// /// A selector to query for. See working with selectors /// for more details. diff --git a/src/Playwright/API/Generated/IPage.cs b/src/Playwright/API/Generated/IPage.cs index 7bff52cc..b05a52fe 100644 --- a/src/Playwright/API/Generated/IPage.cs +++ b/src/Playwright/API/Generated/IPage.cs @@ -590,6 +590,13 @@ namespace Microsoft.Playwright /// /// Shortcut for main frame's . /// + /// + /// + /// This method does not wait for the element to pass actionability checks and therefore + /// can lead to the flaky tests. Use , other helper methods or web-first assertions instead. + /// + /// /// /// A selector to query for. See working with selectors /// for more details. @@ -616,6 +623,12 @@ namespace Microsoft.Playwright /// Examples: /// var divsCount = await page.EvalOnSelectorAllAsync<bool>("div", "(divs, min) => divs.length >= min", 10); /// + /// + /// + /// In most cases, , other + /// helper methods and web-first assertions do a better job. + /// + /// /// /// A selector to query for. See working with selectors /// for more details. @@ -653,7 +666,7 @@ namespace Microsoft.Playwright /// cref="IPage.EvaluateAsync"/>: /// /// - /// var bodyHandle = await page.QuerySelectorAsync("body");
+ /// var bodyHandle = await page.EvaluateAsync("document.body");
/// var html = await page.EvaluateAsync<string>("([body, suffix]) => body.innerHTML + suffix", new object [] { bodyHandle, "hello" });
/// await bodyHandle.DisposeAsync(); ///
@@ -1304,10 +1317,16 @@ namespace Microsoft.Playwright /// /// The method finds an element matching the specified selector within the page. If /// no elements match the selector, the return value resolves to null. To wait - /// for an element on the page, use . + /// for an element on the page, use . /// /// Shortcut for main frame's . /// + /// + /// + /// The use of is discouraged, use + /// objects and web-first assertions instead. + /// + /// /// /// A selector to query for. See working with selectors /// for more details. @@ -1322,6 +1341,12 @@ namespace Microsoft.Playwright /// /// Shortcut for main frame's . /// + /// + /// + /// The use of is discouraged, use + /// objects and web-first assertions instead. + /// + /// /// /// A selector to query for. See working with selectors /// for more details. @@ -2781,6 +2806,12 @@ namespace Microsoft.Playwright /// } /// /// + /// + /// + /// Playwright automatically waits for element to be ready before performing an action. + /// Using objects and web-first assertions make the code wait-for-selector-free. + /// + /// /// /// A selector to query for. See working with selectors /// for more details. diff --git a/src/Playwright/API/Generated/ISelectors.cs b/src/Playwright/API/Generated/ISelectors.cs index 32f804bd..69779c98 100644 --- a/src/Playwright/API/Generated/ISelectors.cs +++ b/src/Playwright/API/Generated/ISelectors.cs @@ -67,11 +67,11 @@ namespace Microsoft.Playwright /// var page = await browser.NewPageAsync();
/// await page.SetContentAsync("<div><button>Click me</button></div>");
/// // Use the selector prefixed with its name.
- /// var button = await page.QuerySelectorAsync("tag=button");
+ /// var button = page.Locator("tag=button");
/// // Combine it with other selector engines.
/// await page.ClickAsync("tag=div >> text=\"Click me\"");
/// // Can use it in any methods supporting selectors.
- /// int buttonCount = await page.EvalOnSelectorAllAsync<int>("tag=button", "buttons => buttons.length"); + /// int buttonCount = await page.Locator("tag=button").CountAsync(); /// /// /// diff --git a/src/Playwright/Transport/Protocol/Generated/SocksSocketInitializer.cs b/src/Playwright/Transport/Protocol/Generated/APIRequestContextInitializer.cs similarity index 88% rename from src/Playwright/Transport/Protocol/Generated/SocksSocketInitializer.cs rename to src/Playwright/Transport/Protocol/Generated/APIRequestContextInitializer.cs index b86c1388..ee65c12f 100644 --- a/src/Playwright/Transport/Protocol/Generated/SocksSocketInitializer.cs +++ b/src/Playwright/Transport/Protocol/Generated/APIRequestContextInitializer.cs @@ -23,14 +23,10 @@ */ using System.Collections.Generic; -using Microsoft.Playwright.Core; namespace Microsoft.Playwright.Transport.Protocol { - internal class SocksSocketInitializer + internal class APIRequestContextInitializer { - public string DstAddr { get; set; } - - public int DstPort { get; set; } } } diff --git a/src/Playwright/Transport/Protocol/Generated/AndroidDeviceInitializer.cs b/src/Playwright/Transport/Protocol/Generated/AndroidDeviceInitializer.cs index 8db86029..c1597093 100644 --- a/src/Playwright/Transport/Protocol/Generated/AndroidDeviceInitializer.cs +++ b/src/Playwright/Transport/Protocol/Generated/AndroidDeviceInitializer.cs @@ -23,11 +23,10 @@ */ using System.Collections.Generic; -using Microsoft.Playwright.Core; namespace Microsoft.Playwright.Transport.Protocol { - internal class AndroidDeviceInitializer + internal class AndroidDeviceInitializer : EventTargetInitializer { public string Model { get; set; } diff --git a/src/Playwright/Transport/Protocol/Generated/AndroidInitializer.cs b/src/Playwright/Transport/Protocol/Generated/AndroidInitializer.cs index de129d2e..00a0d100 100644 --- a/src/Playwright/Transport/Protocol/Generated/AndroidInitializer.cs +++ b/src/Playwright/Transport/Protocol/Generated/AndroidInitializer.cs @@ -23,7 +23,6 @@ */ using System.Collections.Generic; -using Microsoft.Playwright.Core; namespace Microsoft.Playwright.Transport.Protocol { diff --git a/src/Playwright/Transport/Protocol/Generated/AndroidSocketInitializer.cs b/src/Playwright/Transport/Protocol/Generated/AndroidSocketInitializer.cs index 519bc280..19a553c8 100644 --- a/src/Playwright/Transport/Protocol/Generated/AndroidSocketInitializer.cs +++ b/src/Playwright/Transport/Protocol/Generated/AndroidSocketInitializer.cs @@ -23,7 +23,6 @@ */ using System.Collections.Generic; -using Microsoft.Playwright.Core; namespace Microsoft.Playwright.Transport.Protocol { diff --git a/src/Playwright/Transport/Protocol/Generated/ArtifactInitializer.cs b/src/Playwright/Transport/Protocol/Generated/ArtifactInitializer.cs index 53cd23af..d8d874f4 100644 --- a/src/Playwright/Transport/Protocol/Generated/ArtifactInitializer.cs +++ b/src/Playwright/Transport/Protocol/Generated/ArtifactInitializer.cs @@ -23,7 +23,6 @@ */ using System.Collections.Generic; -using Microsoft.Playwright.Core; namespace Microsoft.Playwright.Transport.Protocol { diff --git a/src/Playwright/Transport/Protocol/Generated/BindingCallInitializer.cs b/src/Playwright/Transport/Protocol/Generated/BindingCallInitializer.cs index 4ceaa3b5..acef3244 100644 --- a/src/Playwright/Transport/Protocol/Generated/BindingCallInitializer.cs +++ b/src/Playwright/Transport/Protocol/Generated/BindingCallInitializer.cs @@ -23,18 +23,17 @@ */ using System.Collections.Generic; -using Microsoft.Playwright.Core; namespace Microsoft.Playwright.Transport.Protocol { internal class BindingCallInitializer { - public Frame Frame { get; set; } + public Core.Frame Frame { get; set; } public string Name { get; set; } public List Args { get; set; } - public JSHandle Handle { get; set; } + public Core.JSHandle Handle { get; set; } } } diff --git a/src/Playwright/Transport/Protocol/Generated/BrowserContextInitializer.cs b/src/Playwright/Transport/Protocol/Generated/BrowserContextInitializer.cs index 4a5ec228..0d831e0d 100644 --- a/src/Playwright/Transport/Protocol/Generated/BrowserContextInitializer.cs +++ b/src/Playwright/Transport/Protocol/Generated/BrowserContextInitializer.cs @@ -23,12 +23,13 @@ */ using System.Collections.Generic; -using Microsoft.Playwright.Core; namespace Microsoft.Playwright.Transport.Protocol { - internal class BrowserContextInitializer + internal class BrowserContextInitializer : EventTargetInitializer { public bool IsChromium { get; set; } + + // public Core.APIRequestContext APIRequestContext { get; set; } } } diff --git a/src/Playwright/Transport/Protocol/Generated/BrowserInitializer.cs b/src/Playwright/Transport/Protocol/Generated/BrowserInitializer.cs index 5848b9a1..ded93f20 100644 --- a/src/Playwright/Transport/Protocol/Generated/BrowserInitializer.cs +++ b/src/Playwright/Transport/Protocol/Generated/BrowserInitializer.cs @@ -23,7 +23,6 @@ */ using System.Collections.Generic; -using Microsoft.Playwright.Core; namespace Microsoft.Playwright.Transport.Protocol { diff --git a/src/Playwright/Transport/Protocol/Generated/BrowserTypeInitializer.cs b/src/Playwright/Transport/Protocol/Generated/BrowserTypeInitializer.cs index 8e5611d6..80ea1fa5 100644 --- a/src/Playwright/Transport/Protocol/Generated/BrowserTypeInitializer.cs +++ b/src/Playwright/Transport/Protocol/Generated/BrowserTypeInitializer.cs @@ -23,7 +23,6 @@ */ using System.Collections.Generic; -using Microsoft.Playwright.Core; namespace Microsoft.Playwright.Transport.Protocol { diff --git a/src/Playwright/Transport/Protocol/Generated/CDPSessionInitializer.cs b/src/Playwright/Transport/Protocol/Generated/CDPSessionInitializer.cs index 39c669d7..c87a61ac 100644 --- a/src/Playwright/Transport/Protocol/Generated/CDPSessionInitializer.cs +++ b/src/Playwright/Transport/Protocol/Generated/CDPSessionInitializer.cs @@ -23,7 +23,6 @@ */ using System.Collections.Generic; -using Microsoft.Playwright.Core; namespace Microsoft.Playwright.Transport.Protocol { diff --git a/src/Playwright/Transport/Protocol/Generated/ConsoleMessageInitializer.cs b/src/Playwright/Transport/Protocol/Generated/ConsoleMessageInitializer.cs index a6739baf..34197d6c 100644 --- a/src/Playwright/Transport/Protocol/Generated/ConsoleMessageInitializer.cs +++ b/src/Playwright/Transport/Protocol/Generated/ConsoleMessageInitializer.cs @@ -23,7 +23,6 @@ */ using System.Collections.Generic; -using Microsoft.Playwright.Core; namespace Microsoft.Playwright.Transport.Protocol { @@ -33,7 +32,7 @@ namespace Microsoft.Playwright.Transport.Protocol public string Text { get; set; } - public List Args { get; set; } + public List Args { get; set; } public ConsoleMessageLocation Location { get; set; } } diff --git a/src/Playwright/Transport/Protocol/Generated/DialogInitializer.cs b/src/Playwright/Transport/Protocol/Generated/DialogInitializer.cs index 68b9bee7..7a984774 100644 --- a/src/Playwright/Transport/Protocol/Generated/DialogInitializer.cs +++ b/src/Playwright/Transport/Protocol/Generated/DialogInitializer.cs @@ -23,7 +23,6 @@ */ using System.Collections.Generic; -using Microsoft.Playwright.Core; namespace Microsoft.Playwright.Transport.Protocol { diff --git a/src/Playwright/Transport/Protocol/Generated/ElectronApplicationInitializer.cs b/src/Playwright/Transport/Protocol/Generated/ElectronApplicationInitializer.cs index 86a524d4..74ab71a2 100644 --- a/src/Playwright/Transport/Protocol/Generated/ElectronApplicationInitializer.cs +++ b/src/Playwright/Transport/Protocol/Generated/ElectronApplicationInitializer.cs @@ -23,12 +23,11 @@ */ using System.Collections.Generic; -using Microsoft.Playwright.Core; namespace Microsoft.Playwright.Transport.Protocol { - internal class ElectronApplicationInitializer + internal class ElectronApplicationInitializer : EventTargetInitializer { - public BrowserContext Context { get; set; } + public Core.BrowserContext Context { get; set; } } } diff --git a/src/Playwright/Transport/Protocol/Generated/ElectronInitializer.cs b/src/Playwright/Transport/Protocol/Generated/ElectronInitializer.cs index 6e4fa54f..9ce6861b 100644 --- a/src/Playwright/Transport/Protocol/Generated/ElectronInitializer.cs +++ b/src/Playwright/Transport/Protocol/Generated/ElectronInitializer.cs @@ -23,7 +23,6 @@ */ using System.Collections.Generic; -using Microsoft.Playwright.Core; namespace Microsoft.Playwright.Transport.Protocol { diff --git a/src/Playwright/Transport/Protocol/Generated/ElementHandleInitializer.cs b/src/Playwright/Transport/Protocol/Generated/ElementHandleInitializer.cs index 1cc1b8b8..777a4d9e 100644 --- a/src/Playwright/Transport/Protocol/Generated/ElementHandleInitializer.cs +++ b/src/Playwright/Transport/Protocol/Generated/ElementHandleInitializer.cs @@ -23,7 +23,6 @@ */ using System.Collections.Generic; -using Microsoft.Playwright.Core; namespace Microsoft.Playwright.Transport.Protocol { diff --git a/src/Playwright/Transport/Protocol/Generated/EventTargetInitializer.cs b/src/Playwright/Transport/Protocol/Generated/EventTargetInitializer.cs new file mode 100644 index 00000000..51ecf588 --- /dev/null +++ b/src/Playwright/Transport/Protocol/Generated/EventTargetInitializer.cs @@ -0,0 +1,32 @@ +/* + * MIT License + * + * Copyright (c) Microsoft Corporation. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and / or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +using System.Collections.Generic; + +namespace Microsoft.Playwright.Transport.Protocol +{ + internal class EventTargetInitializer + { + } +} diff --git a/src/Playwright/Transport/Protocol/Generated/FrameInitializer.cs b/src/Playwright/Transport/Protocol/Generated/FrameInitializer.cs index 01b9b77b..34081999 100644 --- a/src/Playwright/Transport/Protocol/Generated/FrameInitializer.cs +++ b/src/Playwright/Transport/Protocol/Generated/FrameInitializer.cs @@ -23,7 +23,6 @@ */ using System.Collections.Generic; -using Microsoft.Playwright.Core; namespace Microsoft.Playwright.Transport.Protocol { @@ -33,7 +32,7 @@ namespace Microsoft.Playwright.Transport.Protocol public string Name { get; set; } - public Frame ParentFrame { get; set; } + public Core.Frame ParentFrame { get; set; } public List LoadStates { get; set; } } diff --git a/src/Playwright/Transport/Protocol/Generated/JSHandleInitializer.cs b/src/Playwright/Transport/Protocol/Generated/JSHandleInitializer.cs index d1611f14..4a3b5922 100644 --- a/src/Playwright/Transport/Protocol/Generated/JSHandleInitializer.cs +++ b/src/Playwright/Transport/Protocol/Generated/JSHandleInitializer.cs @@ -23,7 +23,6 @@ */ using System.Collections.Generic; -using Microsoft.Playwright.Core; namespace Microsoft.Playwright.Transport.Protocol { diff --git a/src/Playwright/Transport/Protocol/Generated/JsonPipeInitializer.cs b/src/Playwright/Transport/Protocol/Generated/JsonPipeInitializer.cs new file mode 100644 index 00000000..3a35b5b2 --- /dev/null +++ b/src/Playwright/Transport/Protocol/Generated/JsonPipeInitializer.cs @@ -0,0 +1,32 @@ +/* + * MIT License + * + * Copyright (c) Microsoft Corporation. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and / or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +using System.Collections.Generic; + +namespace Microsoft.Playwright.Transport.Protocol +{ + internal class JsonPipeInitializer + { + } +} diff --git a/src/Playwright/Transport/Protocol/Generated/PageInitializer.cs b/src/Playwright/Transport/Protocol/Generated/PageInitializer.cs index e88f115a..d8c6726e 100644 --- a/src/Playwright/Transport/Protocol/Generated/PageInitializer.cs +++ b/src/Playwright/Transport/Protocol/Generated/PageInitializer.cs @@ -23,18 +23,17 @@ */ using System.Collections.Generic; -using Microsoft.Playwright.Core; namespace Microsoft.Playwright.Transport.Protocol { - internal class PageInitializer + internal class PageInitializer : EventTargetInitializer { - public Frame MainFrame { get; set; } + public Core.Frame MainFrame { get; set; } public ViewportSize ViewportSize { get; set; } public bool IsClosed { get; set; } - public Page Opener { get; set; } + public Core.Page Opener { get; set; } } } diff --git a/src/Playwright/Transport/Protocol/Generated/RequestInitializer.cs b/src/Playwright/Transport/Protocol/Generated/RequestInitializer.cs index 811e0dee..b9cc91c7 100644 --- a/src/Playwright/Transport/Protocol/Generated/RequestInitializer.cs +++ b/src/Playwright/Transport/Protocol/Generated/RequestInitializer.cs @@ -23,13 +23,12 @@ */ using System.Collections.Generic; -using Microsoft.Playwright.Core; namespace Microsoft.Playwright.Transport.Protocol { internal class RequestInitializer { - public Frame Frame { get; set; } + public Core.Frame Frame { get; set; } public string Url { get; set; } @@ -43,6 +42,6 @@ namespace Microsoft.Playwright.Transport.Protocol public bool IsNavigationRequest { get; set; } - public Request RedirectedFrom { get; set; } + public Core.Request RedirectedFrom { get; set; } } } diff --git a/src/Playwright/Transport/Protocol/Generated/ResponseInitializer.cs b/src/Playwright/Transport/Protocol/Generated/ResponseInitializer.cs index f08723c5..f094e616 100644 --- a/src/Playwright/Transport/Protocol/Generated/ResponseInitializer.cs +++ b/src/Playwright/Transport/Protocol/Generated/ResponseInitializer.cs @@ -23,13 +23,12 @@ */ using System.Collections.Generic; -using Microsoft.Playwright.Core; namespace Microsoft.Playwright.Transport.Protocol { internal class ResponseInitializer { - public Request Request { get; set; } + public Core.Request Request { get; set; } public string Url { get; set; } @@ -37,8 +36,6 @@ namespace Microsoft.Playwright.Transport.Protocol public string StatusText { get; set; } - public List RequestHeaders { get; set; } - public List Headers { get; set; } public RequestTimingResult Timing { get; set; } diff --git a/src/Playwright/Transport/Protocol/Generated/RootInitializer.cs b/src/Playwright/Transport/Protocol/Generated/RootInitializer.cs new file mode 100644 index 00000000..ef4b25ff --- /dev/null +++ b/src/Playwright/Transport/Protocol/Generated/RootInitializer.cs @@ -0,0 +1,32 @@ +/* + * MIT License + * + * Copyright (c) Microsoft Corporation. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and / or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +using System.Collections.Generic; + +namespace Microsoft.Playwright.Transport.Protocol +{ + internal class RootInitializer + { + } +} diff --git a/src/Playwright/Transport/Protocol/Generated/RouteInitializer.cs b/src/Playwright/Transport/Protocol/Generated/RouteInitializer.cs index b26624c2..5f31f1ca 100644 --- a/src/Playwright/Transport/Protocol/Generated/RouteInitializer.cs +++ b/src/Playwright/Transport/Protocol/Generated/RouteInitializer.cs @@ -23,12 +23,11 @@ */ using System.Collections.Generic; -using Microsoft.Playwright.Core; namespace Microsoft.Playwright.Transport.Protocol { internal class RouteInitializer { - public Request Request { get; set; } + public Core.Request Request { get; set; } } } diff --git a/src/Playwright/Transport/Protocol/Generated/SelectorsInitializer.cs b/src/Playwright/Transport/Protocol/Generated/SelectorsInitializer.cs index c8b48226..1d319e24 100644 --- a/src/Playwright/Transport/Protocol/Generated/SelectorsInitializer.cs +++ b/src/Playwright/Transport/Protocol/Generated/SelectorsInitializer.cs @@ -23,7 +23,6 @@ */ using System.Collections.Generic; -using Microsoft.Playwright.Core; namespace Microsoft.Playwright.Transport.Protocol { diff --git a/src/Playwright/Transport/Protocol/Generated/StreamInitializer.cs b/src/Playwright/Transport/Protocol/Generated/StreamInitializer.cs index 0323ee13..44f4f9ff 100644 --- a/src/Playwright/Transport/Protocol/Generated/StreamInitializer.cs +++ b/src/Playwright/Transport/Protocol/Generated/StreamInitializer.cs @@ -23,7 +23,6 @@ */ using System.Collections.Generic; -using Microsoft.Playwright.Core; namespace Microsoft.Playwright.Transport.Protocol { diff --git a/src/Playwright/Transport/Protocol/Generated/WebSocketInitializer.cs b/src/Playwright/Transport/Protocol/Generated/WebSocketInitializer.cs index 35ab8c92..302ef1e9 100644 --- a/src/Playwright/Transport/Protocol/Generated/WebSocketInitializer.cs +++ b/src/Playwright/Transport/Protocol/Generated/WebSocketInitializer.cs @@ -23,11 +23,10 @@ */ using System.Collections.Generic; -using Microsoft.Playwright.Core; namespace Microsoft.Playwright.Transport.Protocol { - internal class WebSocketInitializer + internal class WebSocketInitializer : EventTargetInitializer { public string Url { get; set; } } diff --git a/src/Playwright/Transport/Protocol/Generated/WorkerInitializer.cs b/src/Playwright/Transport/Protocol/Generated/WorkerInitializer.cs index f383df13..91f24a82 100644 --- a/src/Playwright/Transport/Protocol/Generated/WorkerInitializer.cs +++ b/src/Playwright/Transport/Protocol/Generated/WorkerInitializer.cs @@ -23,7 +23,6 @@ */ using System.Collections.Generic; -using Microsoft.Playwright.Core; namespace Microsoft.Playwright.Transport.Protocol { diff --git a/src/tools/Playwright.Tooling/DriverDownloader.cs b/src/tools/Playwright.Tooling/DriverDownloader.cs index 2723f1c6..a2ea23de 100644 --- a/src/tools/Playwright.Tooling/DriverDownloader.cs +++ b/src/tools/Playwright.Tooling/DriverDownloader.cs @@ -73,24 +73,8 @@ namespace Playwright.Tooling var regex = new Regex("(.*?)", RegexOptions.Compiled); - // get commit hash - var gitInfo = new ProcessStartInfo - { - UseShellExecute = false, - RedirectStandardOutput = true, - FileName = "git", - CreateNoWindow = true, - WorkingDirectory = Path.Combine(BasePath, "playwright"), - Arguments = "rev-parse HEAD", - }; - - var gitProcess = Process.Start(gitInfo); - gitProcess.WaitForExit(); - var hash = (await gitProcess.StandardOutput.ReadToEndAsync().ConfigureAwait(false))?.Trim(); - var client = new HttpClient(); - string readmeUrl = $"https://github.com/microsoft/playwright/blob/{hash}/README.md"; - var readme = await client.GetStringAsync(readmeUrl).ConfigureAwait(false); - + var basePlaywrightDir = Environment.GetEnvironmentVariable("PW_SRC_DIR") ?? Path.Combine(Environment.CurrentDirectory, "..", "playwright"); + var readme = File.ReadAllText(Path.Combine(basePlaywrightDir, "README.md")); static string ReplaceBrowserVersion(string content, MatchCollection browserMatches) { foreach (Match match in browserMatches) @@ -118,7 +102,15 @@ namespace Playwright.Tooling private async Task DownloadDriverAsync(DirectoryInfo destinationDirectory, string driverVersion, string platform) { Console.WriteLine("Downloading driver for " + platform); - string cdn = "https://playwright.azureedge.net/builds/driver/next"; + string cdn = "https://playwright.azureedge.net/builds/driver"; + if ( + driverVersion.Contains("-alpha") + || driverVersion.Contains("-beta") + || driverVersion.Contains("-next") + ) + { + cdn += "/next"; + } using var client = new HttpClient(); string url = $"{cdn}/playwright-{driverVersion}-{platform}.zip";