-
Notifications
You must be signed in to change notification settings - Fork 6
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
OSOE-46: Use WebApplicationFactory directly instead of running the tested app with the dotnet CLI #186
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- BehaviorVueTests.RecipeDataShouldBeDisplayedCorrectly(browser: Chrome) - EmailTests.SendingTestEmailShouldWork(browser: Chrome)
- Lombiq.Tests.UI.Samples.Tests.ErrorHandlingTests.ErrorDuringSetupShouldHaltTest(browser: Chrome)
Migration guide
Updating docs
Great migration docs, BTW! |
sarahelsaig
requested changes
Sep 28, 2022
Lombiq.Tests.UI/Extensions/VisualVerificationUITestContextExtensions.cs
Outdated
Show resolved
Hide resolved
Lombiq.Tests.UI/Services/OrchardCoreHosting/OrchardApplicationFactory.cs
Outdated
Show resolved
Hide resolved
Co-authored-by: Dávid El-Saig <david.el-saig@lombiq.com>
Co-authored-by: Dávid El-Saig <david.el-saig@lombiq.com>
Co-authored-by: Dávid El-Saig <david.el-saig@lombiq.com>
Co-authored-by: Dávid El-Saig <david.el-saig@lombiq.com>
Co-authored-by: Dávid El-Saig <david.el-saig@lombiq.com>
Co-authored-by: Dávid El-Saig <david.el-saig@lombiq.com>
Co-authored-by: Dávid El-Saig <david.el-saig@lombiq.com>
Adding comments Adding InstanceCommandLineArgumentsBuilder.Add with Obsolate attribute
sarahelsaig
reviewed
Oct 14, 2022
sarahelsaig
reviewed
Oct 14, 2022
Lombiq.Tests.UI/Services/OrchardCoreHosting/OrchardApplicationFactory.cs
Outdated
Show resolved
Hide resolved
9 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes GH-101
OSOE-46
Migrating from v3.*
Preparing WebApplication
Lombiq.Tests.UI.AppExtensions
project reference or NuGet package from the web app.Microsoft.Extensions.Configuration.ConfigurationManager
instance directly toWebApplicationBuilder.Services
.Preparing UI test project
</ItemGroup> <ItemGroup> + <ProjectReference Include="..\..\src\Lombiq.OSOCE.Web\Lombiq.OSOCE.Web.csproj" /> <ProjectReference Include="..\..\src\Modules\Lombiq.ChartJs\Lombiq.ChartJs.Tests.UI\Lombiq.ChartJs.Tests.UI.csproj" /> <ProjectReference Include="..\..\src\Modules\Lombiq.DataTables\Lombiq.DataTables\Tests\Lombiq.DataTables.Tests.UI\Lombiq.DataTables.Tests.UI.csproj" /> <ProjectReference Include="..\..\src\Modules\Lombiq.HelpfulExtensions\Lombiq.HelpfulExtensions.Tests.UI\Lombiq.HelpfulExtensions.Tests.UI.csproj" />
OrchardCoreUITestBase
implementation like below.AppAssemblyPath
is not required anymore.Breaking changes
There is a breaking change in adding command line arguments to the WebApplication.
Non breaking changes
Lombiq.Tests.UI.Extensions.ShortcutsUITestContextExtensions
The following extension methods behave largely the same and their signatures didn't change. Using
WebApplicationFactory
made it possible to use OC services directly instead of using controller actions invoked via browser navigation.This means that calling the extension methods below don't cause browser navigation any more.
SetUserRegistrationTypeAsync
CreateUserAsync
AddUserToRoleAsync
AddPermissionToRoleAsync
EnableFeatureDirectlyAsync
DisableFeatureDirectlyAsync
ExecuteRecipeDirectlyAsync
SelectThemeAsync
GenerateHttpEventUrlAsync
Here is a sample for better understanding:
The original code with the new behavior failed a test, because the browser pointed to the Home page before
await context.EnablePrivacyConsentBannerFeatureAsync()(=> context.EnableFeatureDirectlyAsync({featureId})
. So thecontext.EnableFeatureDirectlyAsync
doesn't navigate away, theawait context.GoToHomePageAsync()
call does nothing, and the consent banner doesn't come up.The solution, in this case, is to call
await context.GoToHomePageAsync(onlyIfNotAlreadyThere: false)
, this result a reload, and the consent banner come up.