Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • May 08 17:08
    egil synchronize #391
  • May 08 17:08
    egil edited #391
  • May 08 17:08
    egil edited #391
  • May 08 17:08
    egil edited #391
  • May 08 17:08
    egil edited #391
  • May 08 17:08
    egil edited #391
  • May 08 17:08
    egil edited #391
  • May 08 17:07
    egil edited #391
  • May 08 17:07
    egil edited #391
  • May 08 17:07
    egil edited #391
  • May 08 17:07
    egil opened #391
  • May 08 17:02
    egil edited #388
  • May 08 17:01
    egil edited #388
  • May 07 11:33
    egil commented #388
  • May 07 08:29
    mrpmorris commented #388
  • May 06 19:34
    egil commented #388
  • May 06 18:48
    mrpmorris commented #388
  • May 06 12:19
    egil edited #388
  • May 05 20:15
    KristofferStrube commented #388
  • May 05 20:07
    egil commented #388
Egil Hansen
@egil
@demonsweatlive thats fair. Just to recap, this is the basis of what you are seeing:
  1. Render component Foo which has subcomponent Bar.
  2. Do something to cause component Bar to rerender and have changes in its markup
  3. Be able to view the markup changes of component Bar through parent component Foo.Markup AND NOT be able to see the changes in Bar.Markup.
Does that sum it up?
If so, I am very curious to hear what learn what you are doing in step 2.
Marc Chu
@demonsweatlive
image.png
@egil The entire page is a component, with subcomponents of grid and form. If I edit something on the form, then click on different grid item, I'm prompted by a modal as to whether I want to discard the changes, save the changes, or cancel switching to the new user.
My test is doing that, choosing to "Discard" the changes, then clicking on another grid item (which does a server fetch), and then back to the original grid item (another fetch) in order to make sure that nothing was modified.
Marc Chu
@demonsweatlive
And yes, you describe it correctly. The Page component gives every indication that everything is as expected.
However, I'm asserting on the Form sub-component, and there, the values are different. There items that I entered previously that should have been discarded. As though nothing in that sub-component changes after some point.
This happens whether I have a reference to the rendered Form saved from the beginning of the test, which works everywhere else and for every test; or whether I FindComponent<Form>() from the rendered Page at assert time.
It's as though something is internally caching that form and giving me an older state
Marc Chu
@demonsweatlive
I should also note that this is using v 1.0.0.0-beta-10. I saw that there is a beta 11 now, but after I changed all the ClickAsync() calls to Click(), I had many, many, MANY more breaking tests. So I backed that right out, because I just don't have the energy for that.
Egil Hansen
@egil
@demonsweatlive I removed ClickAsync since it didnt really make a difference if you awaited it or not. So you should be able to do a search and replace.
Marc Chu
@demonsweatlive
@egil Not worried about the API change, easy enough. I mean that after the code changes, many of the tests were now failing.
Egil Hansen
@egil

It's as though something is internally caching that form and giving me an older state

There is a single RenderTree that is updated when a component renders. But what can happen is that your changes are happening asynchronously... put differently, the blazor renderer that is updating the render tree is updating it in a different thread than the one the test is running in, so the changes might be coming, but might not be there yet. The problem you are seeing might be due to beta-10 though. There was some changes to have the render tree updates would update the markup in the components, and you might be seeing a corner case I believe is fixed now.

@egil Not worried about the API change, easy enough. I mean that after the code changes, many of the tests were now failing.

OK. That surprises me. Are you saying tests that use something like await cut.Find("button").ClickAsync() now fails with cut.Find("button").Click()?

Marc Chu
@demonsweatlive
Yes. As I mentioned, I have several hundred tests now, so I don't know exactly what was failing, or why, or what code paths were traversed. Being so frustrated with this single test, I just couldn't bring myself to start digging as to what would cause dozens more to fail after making those changes, and immediately downgraded.
Egil Hansen
@egil
gah that sucks. Thats definitely not what I want people to feel when using bUnit.
Marc Chu
@demonsweatlive
Perhaps I'll dig into the source and see if I can debug it myself.
Egil Hansen
@egil
Do check out the changelog as well: https://github.com/egil/bUnit/blob/main/CHANGELOG.md
Marc Chu
@demonsweatlive
And it's not really a big deal. The frustration is more of a result of not knowing what I'm doing wrong, if anything, or if the problem is in any of myriads of 3rd party libraries.
Egil Hansen
@egil
The last point under "fixed" might giving you some problems if you are primarily testing at a page level, where there are many components involved.
Marc Chu
@demonsweatlive
Right, I'll check it out tomorrow. Time to head off and decompress.
Egil Hansen
@egil
ok. do report back if you discover anything I can help with. Good decompressing until then
!
Jochem de Kruijf
@jochem4207
Heey :)
Egil Hansen
@egil
Hey :)
Peter Morris
@mrpmorris
Egil Hansen
@egil
Thanks for the link @mrpmorris, ill check out it later.
Brett McDonald
@bfmsoft
Egil Hansen
@egil
hey @bfmsoft, cannot say that I have. We use Azure functions at work, but havent played with the preview yet.
Peter Morris
@mrpmorris
Why would net5 not be an Azure yet?
Peter Morris
@mrpmorris
On
Egil Hansen
@egil
They have historically been quite late to upgrade to latest versions
but I do not know the current state, but based on history, it makes sense they dont have official support for net5 yet.
Ivan Josipovic
@IvanJosipovic
azure is always behind on updates
radioprop
@radioprop
hi I am getting dependencies warnings about not able to resolve bunit.core betal 11
Egil Hansen
@egil
hi @radioprop, what exactly is your error message, and what does your test csproj look like?
radioprop
@radioprop
/home/nathan/git/GDALblazorwebTEST/GDALblazorwebTEST.csproj : warning NU1603: GDALblazorwebTEST depends on bunit.core (>= 1.0.0-beta-11-g43328f7f34) but bunit.core 1.0.0-beta-11-g43328f7f34 was not found. An approximate best match of bunit.core 1.0.0-beta-7 was resolved.
/home/nathan/git/GDALblazorwebTEST/GDALblazorwebTEST.csproj : warning NU1603: GDALblazorwebTEST depends on bunit.web (>= 1.0.0-beta-11-g43328f7f34) but bunit.web 1.0.0-beta-11-g43328f7f34 was not found. An approximate best match of bunit.web 1.0.0-beta-7 was resolved.
/home/nathan/git/GDALblazorwebTEST/GDALblazorwebTEST.csproj : warning NU1603: GDALblazorwebTEST depends on bunit.xunit (>= 1.0.0-beta-11-g43328f7f34) but bunit.xunit 1.0.0-beta-11-g43328f7f34 was not found. An approximate best match of bunit.xunit 1.0.0-beta-7 was resolve
it resolved its self
Egil Hansen
@egil
@radioprop, make sure your package references are for 1.0.0-beta-11 and not 1.0.0-beta-11-g43328f7f34
Denis Lochman
@denis.lochman_gitlab
Hello, I'm using Radzen component library and when I'm rendering a component that contains Radzen's dropdown I get this error Bunit.JSRuntimeUnhandledInvocationException : The invocation of 'Radzen.preventArrows' with the argument [Microsoft.AspNetCore.Components.ElementReference] was not expected. Not sure whether I should look for help here or at radzen's.
Egil Hansen
@egil
Hey @denis.lochman_gitlab
What version of bunit are you on?
Anyway, what's going on is that their component depends on javascript, which bUnit doesn't run. So you need to tell bUnit's JSInterop what to do about the call it is receiving from the component.
It could be a sinple as setting ctx.JSInterop.Mode to loose and see if it works
Egil Hansen
@egil
Ideally, the Radzen folks would do this: https://twitter.com/egilhansen/status/1343169295593963521?s=19
That you can probably suggest they do through an issue in their repo. Feel free to @egil in that issue.
Dave Lobban
@davelobban
Anyone coming here to get a resolution for @denis.lochman_gitlab 's exception " The invocation of 'Radzen.preventArrows' with the argument" like me: I had been using Radzen and MatBlazor and in this case I swopped the table from the Radzen one to the MatBlazor and using the Loose setting described in https://bunit.egilhansen.com/docs/test-doubles/emulating-ijsruntime.html let me add a bunit test. It looks like MatBlazor is going to win the battle of the tables in my app due to testability
Egil Hansen
@egil
Thanks for sharing @davelobban. Always good to know what libraries are more compatible with bUnit testing.