Skip to content

Unhide server option in blazor web template #48838

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

Merged
merged 4 commits into from
Jun 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions src/ProjectTemplates/Shared/ArgConstants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,5 @@ internal static class ArgConstants
public const string UseLocalDb = "-uld";
public const string NoHttps = "--no-https";
public const string PublishNativeAot = "--aot";
public const string UseServer = "--use-server";
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@
"isHidden": true
},
"UseServer": {
"longName": "use-server",
"isHidden": true
"longName": "use-server"
},
"UseWebAssembly": {
"longName": "use-wasm",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"symbolInfo": [
{
"id": "UseServer",
"isVisible": false,
"isVisible": true,
"persistenceScope": "templateGroup"
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,24 +30,14 @@ public ITestOutputHelper Output

[ConditionalTheory]
[SkipOnHelix("Cert failure, https://github.com/dotnet/aspnetcore/issues/28090", Queues = "All.OSX;" + HelixConstants.Windows10Arm64 + HelixConstants.DebianArm64)]
[InlineData(true, false)]
[InlineData(true, true)]
[InlineData(false, false)]
[InlineData(false, true)]
public async Task BlazorWebTemplate_NoAuth(bool useProgramMain, bool noHttps)
[MemberData(nameof(ArgsData))]
public async Task BlazorWebTemplate_NoAuth(string[] args)
{
var project = await ProjectFactory.CreateProject(Output);

var args = useProgramMain
? noHttps
? new[] { ArgConstants.UseProgramMain, ArgConstants.NoHttps }
: new[] { ArgConstants.UseProgramMain }
: noHttps
? new[] { ArgConstants.NoHttps }
: null;
await project.RunDotNetNewAsync("blazor", args: args);

var expectedLaunchProfileNames = noHttps
var expectedLaunchProfileNames = args.Contains(ArgConstants.NoHttps)
? new[] { "http", "IIS Express" }
: new[] { "http", "https", "IIS Express" };
await project.VerifyLaunchSettings(expectedLaunchProfileNames);
Expand Down Expand Up @@ -79,6 +69,14 @@ public async Task BlazorWebTemplate_NoAuth(bool useProgramMain, bool noHttps)
}
};

if (args.Contains(ArgConstants.UseServer))
{
pages.Add(new Page
{
Url = BlazorTemplatePages.Counter,
});
}

using (var aspNetProcess = project.StartBuiltProjectAsync())
{
Assert.False(
Expand All @@ -98,6 +96,18 @@ public async Task BlazorWebTemplate_NoAuth(bool useProgramMain, bool noHttps)
}
}

public static TheoryData<string[]> ArgsData() => new TheoryData<string[]>
{
new string[0],
new[] { ArgConstants.UseProgramMain },
new[] { ArgConstants.NoHttps },
new[] { ArgConstants.UseProgramMain, ArgConstants.NoHttps },
new[] { ArgConstants.UseServer },
new[] { ArgConstants.UseServer, ArgConstants.UseProgramMain },
new[] { ArgConstants.UseServer, ArgConstants.NoHttps },
new[] { ArgConstants.UseServer, ArgConstants.UseProgramMain, ArgConstants.NoHttps }
};

private string ReadFile(string basePath, string path)
{
var fullPath = Path.Combine(basePath, path);
Expand All @@ -111,5 +121,6 @@ private class BlazorTemplatePages
{
internal static readonly string Index = "";
internal static readonly string FetchData = "showdata";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@surayya-MS Does this need to change to "weather"?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it does but in another PR

}
internal static readonly string Counter = "counter";
}
}