Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Playwright 🎭 🛠️ #45682

Merged
merged 43 commits into from
Feb 14, 2023
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
5f9b076
Version Bumps
TanayParikh Dec 19, 2022
ceda987
Run with `Test: Windows Server x64`
TanayParikh Dec 19, 2022
68a2f8e
Install Playwright in CI
TanayParikh Dec 19, 2022
31cd474
Add running playwright locally instructions
TanayParikh Dec 19, 2022
5d86d72
Test Cleanup
TanayParikh Dec 19, 2022
02461a8
Remove Selenium
TanayParikh Dec 19, 2022
0de963b
Prebuild for Playwright install
TanayParikh Dec 19, 2022
c803709
Update default-build.yml
TanayParikh Dec 19, 2022
e21e339
Update default-build.yml
TanayParikh Dec 19, 2022
c39f272
Update default-build.yml
TanayParikh Dec 20, 2022
a75e4b8
Update default-build.yml
TanayParikh Dec 20, 2022
89b5876
Update default-build.yml
TanayParikh Dec 20, 2022
6ca74c2
Playwright install in test
TanayParikh Dec 20, 2022
ccbb4d4
New template test pipeline
TanayParikh Dec 20, 2022
599363d
Update components-e2e-tests.yml
TanayParikh Dec 20, 2022
3b5e7e3
Update components-template-tests.yml
TanayParikh Dec 21, 2022
7c6e078
Update components-e2e-tests.yml
TanayParikh Dec 21, 2022
c3a796a
Update components-e2e-tests.yml
TanayParikh Dec 21, 2022
90da3c8
Update components-e2e-tests.yml
TanayParikh Dec 21, 2022
80232fe
Update components-template-tests.yml
TanayParikh Dec 21, 2022
06577b1
Update components-e2e-tests.yml
TanayParikh Dec 21, 2022
2483583
Update components-e2e-tests.yml
TanayParikh Dec 21, 2022
52cf64c
Update components-e2e-tests.yml
TanayParikh Dec 21, 2022
61ae061
Revert new pipeline changes
TanayParikh Dec 21, 2022
9ed27ed
RestoreAdditionalProjectSources
TanayParikh Dec 21, 2022
245485b
Update Templates.Blazor.Tests.csproj
TanayParikh Dec 21, 2022
4b43b23
PR Feedback
TanayParikh Dec 21, 2022
80250d0
RunBlazorPlaywrightTemplateTests
TanayParikh Dec 21, 2022
3580dcb
Socket logic
TanayParikh Dec 22, 2022
f5e5826
Fixed socket wait logic
TanayParikh Dec 22, 2022
6cfd3ee
Remove redundant process wait for exit
TanayParikh Dec 23, 2022
bc4f85d
Update BlazorWasmTemplateTest.cs
TanayParikh Dec 23, 2022
eeeeefe
Update Templates.Blazor.Tests.csproj
TanayParikh Jan 4, 2023
5a0e3b6
Revert App.Ref, add src in props
TanayParikh Jan 5, 2023
322e093
Config updates
TanayParikh Jan 5, 2023
a0bdfe8
Update RequiresDelayedBuildProjects.props
TanayParikh Jan 23, 2023
2e06f58
Update Templates.Blazor.Tests.csproj
TanayParikh Jan 23, 2023
09e9cb2
Merge branch 'main' into taparik/playwright
TanayParikh Jan 23, 2023
20ebf88
Skip failing tests
TanayParikh Feb 1, 2023
c2d7a88
Add https://github.com/dotnet/aspnetcore/issues/46430
TanayParikh Feb 3, 2023
a33acf3
Update Templates.Blazor.Tests.csproj
wtgodbe Feb 13, 2023
f60b141
Update BlazorWasmTemplateTest.cs
wtgodbe Feb 13, 2023
704a4e1
Update BlazorWasmTemplateTest.cs
wtgodbe Feb 14, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .azure/pipelines/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -697,7 +697,7 @@ stages:
# Just uploading artifacts/logs/ files can take 15 minutes. Doubling the cancel timeout for this job.
cancelTimeoutInMinutes: 30
buildArgs: -all -pack -test -binaryLog /p:SkipHelixReadyTests=true /p:SkipIISNewHandlerTests=true /p:SkipIISTests=true
/p:SkipIISExpressTests=true /p:SkipIISNewShimTests=true /p:RunTemplateTests=false
/p:SkipIISExpressTests=true /p:SkipIISNewShimTests=true
$(_InternalRuntimeDownloadArgs)
beforeBuild:
- powershell: "& ./src/Servers/IIS/tools/UpdateIISExpressCertificate.ps1; & ./src/Servers/IIS/tools/update_schema.ps1"
Expand Down
2 changes: 1 addition & 1 deletion eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@
<NewtonsoftJsonVersion>13.0.1</NewtonsoftJsonVersion>
<NSwagApiDescriptionClientVersion>13.0.4</NSwagApiDescriptionClientVersion>
<PhotinoNETVersion>1.1.6</PhotinoNETVersion>
<MicrosoftPlaywrightVersion>1.17.3</MicrosoftPlaywrightVersion>
<MicrosoftPlaywrightVersion>1.28.0</MicrosoftPlaywrightVersion>
<PollyExtensionsHttpVersion>3.0.0</PollyExtensionsHttpVersion>
<PollyVersion>7.2.3</PollyVersion>
<SeleniumSupportVersion>4.7.0</SeleniumSupportVersion>
Expand Down
8 changes: 8 additions & 0 deletions src/ProjectTemplates/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,14 @@ Then, use one of:
previous step, it is NOT advised that you install templates created on your local machine using just
`dotnet new -i [nupkgPath]`.

#### Running Playwright tests
TanayParikh marked this conversation as resolved.
Show resolved Hide resolved

1. From the root of the repo, build the templates: `.\eng\build.cmd -all -pack`
2. `cd .\src\ProjectTemplates\test\Templates.Blazor.Tests`
3. Install Playwright browsers: `.\bin\Debug\[TFM]\playwright.ps1 install`
- Note, replace `[TFM]` with the current target TFM (ex. `net8.0`).
4. `dotnet test .\Templates.Blazor.Tests.csproj` with optional `--filter` arg to run a specific test.

#### Conditional tests & skipping test platforms

Individual test methods can be decorated with attributes to configure them to not run ("skip running") on certain platforms. The `[ConditionalFact]` and `[ConditionalTheory]` attributes must be used on tests using the skip attributes in order for them to actually be skipped:
Expand Down
5 changes: 5 additions & 0 deletions src/ProjectTemplates/Shared/TemplatePackageInstaller.cs
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,11 @@ private static async Task InstallTemplatePackages(ITestOutputHelper output)
.Where(p => _templatePackages.Any(t => Path.GetFileName(p).StartsWith(t, StringComparison.OrdinalIgnoreCase)))
.ToArray();

if (builtPackages.Length == 0)
{
throw new InvalidOperationException($"Failed to find required templates in {packagesDir}. Please ensure the *Templates*.nupkg have been built.");
}

Assert.Equal(4, builtPackages.Length);

await VerifyCannotFindTemplateAsync(output, "web");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,8 @@ await BrowserManager.GetBrowserInstance(browserKind, BrowserContextInfo) :
}
}

public static IEnumerable<object[]> BlazorServerTemplateWorks_IndividualAuthData =>
BrowserManager.WithBrowsers(new[] { BrowserKind.Chromium }, true, false);

[InlineData(BrowserKind.Chromium)]
[Theory(Skip = "https://github.com/dotnet/aspnetcore/issues/30882")]
[MemberData(nameof(BlazorServerTemplateWorks_IndividualAuthData))]
[SkipOnHelix("https://github.com/dotnet/aspnetcore/issues/30825", Queues = "All.OSX")]
public async Task BlazorServerTemplateWorks_IndividualAuth(BrowserKind browserKind)
{
Expand Down Expand Up @@ -180,7 +177,7 @@ private async Task TestBasicNavigation(IPage page)
Assert.Equal(5, await page.Locator("p+table>tbody>tr").CountAsync());
}

[Theory(Skip = "https://github.com/dotnet/aspnetcore/issues/30882")]
[Theory]
[InlineData("IndividualB2C", null)]
[InlineData("IndividualB2C", new [] { "--called-api-url \"https://graph.microsoft.com\"", "--called-api-scopes user.readwrite" })]
[InlineData("SingleOrg", null)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public abstract class BlazorTemplateTest : BrowserTestBase
public BlazorTemplateTest(ProjectFactoryFixture projectFactory)
{
ProjectFactory = projectFactory;
Microsoft.Playwright.Program.Main(new[] { "install" });
}

public ProjectFactoryFixture ProjectFactory { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public BlazorWasmTemplateTest(ProjectFactoryFixture projectFactory)

public override string ProjectType { get; } = "blazorwasm";

[Theory(Skip = "https://github.com/dotnet/aspnetcore/issues/30882")]
[Theory]
[InlineData(BrowserKind.Chromium)]
public async Task BlazorWasmStandaloneTemplate_Works(BrowserKind browserKind)
{
Expand Down Expand Up @@ -59,7 +59,7 @@ private static async Task<IPage> NavigateToPage(IBrowserContext browser, string
return page;
}

[Theory(Skip = "https://github.com/dotnet/aspnetcore/issues/30882")]
[Theory]
[InlineData(BrowserKind.Chromium)]
public async Task BlazorWasmHostedTemplate_Works(BrowserKind browserKind)
{
Expand Down Expand Up @@ -107,7 +107,7 @@ private static async Task AssertCompressionFormat(AspNetProcess aspNetProcess, s
Assert.Equal(expectedEncoding, response.Content.Headers.ContentEncoding.Single());
}

[Theory(Skip = "https://github.com/dotnet/aspnetcore/issues/30882")]
[Theory]
[InlineData(BrowserKind.Chromium)]
public async Task BlazorWasmStandalonePwaTemplate_Works(BrowserKind browserKind)
{
Expand Down Expand Up @@ -220,7 +220,7 @@ public Task BlazorWasmHostedTemplate_IndividualAuth_Works_WithLocalDB(BrowserKin
=> BlazorWasmHostedTemplate_IndividualAuth_Works(browserKind, true);

// This test depends on BlazorWasmTemplate_CreateBuildPublish_IndividualAuthNoLocalDb running first
[Theory(Skip = "https://github.com/dotnet/aspnetcore/issues/30882")]
[Theory]
[InlineData(BrowserKind.Chromium)]
[SkipOnHelix("https://github.com/dotnet/aspnetcore/issues/30825", Queues = "All.OSX")]
public Task BlazorWasmHostedTemplate_IndividualAuth_Works_WithOutLocalDB(BrowserKind browserKind)
Expand Down
16 changes: 0 additions & 16 deletions src/ProjectTemplates/test/Templates.Blazor.Tests/package.json

This file was deleted.

Loading