abpframework / abp

Open-source web application framework for ASP.NET Core! Offers an opinionated architecture to build enterprise software solutions with best practices on top of the .NET. Provides the fundamental infrastructure, cross-cutting-concern implementations, startup templates, application modules, UI themes, tooling and documentation.
https://abp.io
GNU Lesser General Public License v3.0
12.89k stars 3.44k forks source link

BlazorTest failed #17997

Closed zhaofenglee closed 12 months ago

zhaofenglee commented 1 year ago

Is there an existing issue for this?

Description

image

Bunit.JSRuntimeUnhandledInvocationException: bUnit's JSInterop has not been configured to handle the call:

Bunit.JSRuntimeUnhandledInvocationException bUnit's JSInterop has not been configured to handle the call:

InvokeAsync<IJSObjectReference>("import", "./_content/Blazorise/utilities.js?v=1.2.0.0")

Configure bUnit's JSInterop to handle the call with following:

SetupModule("./_content/Blazorise/utilities.js?v=1.2.0.0")

The setup methods are available on an instance of the BunitJSInterop or BunitJSModuleInterop type. The standard BunitJSInterop is available through the TestContext.JSInterop property, and a BunitJSModuleInterop instance is returned from calling SetupModule on a BunitJSInterop instance.

at Bunit.BunitJSInterop.TryHandlePlannedInvocation[TValue](JSRuntimeInvocation invocation) in //src/bunit.web/JSInterop/BunitJSInterop.cs:line 83 at Bunit.BunitJSInterop.HandleInvocation[TValue](JSRuntimeInvocation invocation) in //src/bunit.web/JSInterop/BunitJSInterop.cs:line 68 at Bunit.JSInterop.Implementation.JSRuntimeExtensions.HandleInvokeAsync[TValue](BunitJSInterop jSInterop, String identifier, Object[] args) in //src/bunit.web/JSInterop/Implementation/JSRuntimeExtensions.cs:line 9 at Bunit.JSInterop.BunitJSRuntime.InvokeAsync[TValue](String identifier, Object[] args) in //src/bunit.web/JSInterop/Implementation/BunitJSRuntime.cs:line 20 at Blazorise.Modules.BaseJSModule.GetModule() at Blazorise.Modules.BaseJSModule.getModule() at Blazorise.Modules.BaseJSModule.InvokeSafeVoidAsync(String identifier, Object[] args) at Blazorise.BaseComponent.OnAfterRenderAsync(Boolean firstRender) at Bunit.Rendering.TestRenderer.AssertNoUnhandledExceptions() in //src/bunit.core/Rendering/TestRenderer.cs:line 384 at Bunit.Rendering.TestRenderer.Render[TResult](RenderFragment renderFragment, Func`2 activator) in //src/bunit.core/Rendering/TestRenderer.cs:line 247 at Bunit.Rendering.TestRenderer.RenderFragment(RenderFragment renderFragment) in //src/bunit.core/Rendering/TestRenderer.cs:line 53 at Bunit.Extensions.TestContextBaseRenderExtensions.RenderInsideRenderTree(TestContextBase testContext, RenderFragment renderFragment) in //src/bunit.core/Extensions/TestContextBaseRenderExtensions.cs:line 43 at Bunit.Extensions.TestContextBaseRenderExtensions.RenderInsideRenderTree[TComponent](TestContextBase testContext, RenderFragment renderFragment) in //src/bunit.core/Extensions/TestContextBaseRenderExtensions.cs:line 23 at Bunit.TestContext.Render[TComponent](RenderFragment renderFragment) in //src/bunit.web/TestContext.cs:line 66 at Bunit.TestContext.RenderComponent[TComponent](ComponentParameter[] parameters) in //src/bunit.web/TestContext.cs:line 36 at BookStore.Blazor.Tests.Index_Tests.Index_Test() in H:\Github\abp-samples\BlazorPageUniTest\test\BookStore.Blazor.Tests\Index_Tests.cs:line 15 at System.RuntimeMethodHandle.InvokeMethod(Object target, Void* arguments, Signature sig, Boolean isConstructor) at System.Reflection.MethodInvoker.Invoke(Object obj, IntPtr args, BindingFlags invokeAttr)

Reproduction Steps

1.Clone the repository code.

https://github.com/abpframework/abp-samples/tree/master/BlazorPageUniTest

2.Run unit tests.

Expected behavior

No response

Actual behavior

No response

Regression?

No response

Known Workarounds

No response

Version

7.2.2

User Interface

Blazor

Database Provider

EF Core (Default)

Tiered or separate authentication server

None (Default)

Operation System

Windows (Default)

Other information

No response

maliming commented 12 months ago

hi

https://github.com/abpframework/abp-samples/commit/6901178aa52e3d1e282086c93112fb89b34b7713