#metabrainz

/

      • Maxr1998_ has quit
      • 2025-08-20 23236, 2025

      • Maxr1998 joined the channel
      • 2025-08-20 23202, 2025

      • bttf has quit
      • 2025-08-20 23217, 2025

      • bttf joined the channel
      • 2025-08-20 23253, 2025

      • holycow23[m]
        <lucifer[m]> "holycow23: wolf setup should..." <- Hey, thanks for the help. I think there was one more LB-DB PORT issue, have fixed that and its running well now
      • 2025-08-20 23238, 2025

      • Jigen has quit
      • 2025-08-20 23202, 2025

      • Jigen joined the channel
      • 2025-08-20 23202, 2025

      • dseomn has quit
      • 2025-08-20 23222, 2025

      • dseomn joined the channel
      • 2025-08-20 23229, 2025

      • Arsen has quit
      • 2025-08-20 23241, 2025

      • Arsen joined the channel
      • 2025-08-20 23237, 2025

      • SigHunter has quit
      • 2025-08-20 23221, 2025

      • SigHunter joined the channel
      • 2025-08-20 23242, 2025

      • SigHunter has quit
      • 2025-08-20 23235, 2025

      • SigHunter joined the channel
      • 2025-08-20 23249, 2025

      • holycow23[m]
        lucifer: the [PR](https://github.com/metabrainz/listenbrainz-se… for Artist-Evolution is failing due to a previous initialization of stat by the name `Artist-Evolution` instead of `Artist-Evolution-Activity`. Is there any way in which the same can be deleted from CouchDB?
      • 2025-08-20 23203, 2025

      • Psy-Q has left the channel
      • 2025-08-20 23206, 2025

      • SigHunter has quit
      • 2025-08-20 23219, 2025

      • Techman has quit
      • 2025-08-20 23240, 2025

      • Techman joined the channel
      • 2025-08-20 23213, 2025

      • d4rkie has quit
      • 2025-08-20 23206, 2025

      • d4rkie joined the channel
      • 2025-08-20 23245, 2025

      • __BrainzGit
        [listenbrainz-server] 14granth23 opened pull request #3347 (03master…UserGenreActivity): Stats API tests added for Genre Stats https://github.com/metabrainz/listenbrainz-server…
      • 2025-08-20 23230, 2025

      • lucifer[m]
        <holycow23[m]> "lucifer: the [PR](https://github..." <- failing on wolf?
      • 2025-08-20 23258, 2025

      • holycow23[m]
        lucifer[m]: Both wolf and the github tests
      • 2025-08-20 23218, 2025

      • holycow23[m]
        I have added the stats api tests for Genre and Era, ArtistEvolution is giving this one bug
      • 2025-08-20 23242, 2025

      • suvid[m]
        monkey: I tried implementing your recommendations
      • 2025-08-20 23242, 2025

      • suvid[m]
        But the tests still don't seem to pass 🤔
      • 2025-08-20 23202, 2025

      • suvid[m]
        I was searching for listeninghistory.zip but it says it found multiple
      • 2025-08-20 23215, 2025

      • suvid[m]
        then i used getAllByText
      • 2025-08-20 23215, 2025

      • suvid[m]
        it then says it can't find it
      • 2025-08-20 23222, 2025

      • suvid[m]
        I have pushed the latest code just now
      • 2025-08-20 23213, 2025

      • suvid[m]
        I am focused on the first test as of now
      • 2025-08-20 23214, 2025

      • monkey[m]
        Is this on LB#3317 ?
      • 2025-08-20 23214, 2025

      • suvid[m]
        I think that should be the easiest one for now
      • 2025-08-20 23214, 2025

      • BrainzBot
        feat. Create the frontend for the listens importer: https://github.com/metabrainz/listenbrainz-server…
      • 2025-08-20 23249, 2025

      • monkey[m]
        Totally fine to start with one test until you have everything sorted, usually setting up everything correctly is the hard part.
      • 2025-08-20 23258, 2025

      • suvid[m]
        monkey[m]: yes
      • 2025-08-20 23259, 2025

      • monkey[m]
        Well, regarding the "found multiple", I can see that both your imports in mockImports have the same file name, so you could start by changing one of them and ensure both are present on the page
      • 2025-08-20 23234, 2025

      • suvid[m]
        okay lemme change that
      • 2025-08-20 23252, 2025

      • suvid[m]
        but then when i used getallbytext
      • 2025-08-20 23252, 2025

      • suvid[m]
        it said it couldnt find it
      • 2025-08-20 23219, 2025

      • suvid[m]
        Still the same
      • 2025-08-20 23219, 2025

      • suvid[m]
        `TestingLibraryElementError: Unable to find an element with the text: listenbrainz.zip. This could be because the text is broken up by multiple elements. In this case, you can provide a function for your text matcher to make your matcher more flexible.`
      • 2025-08-20 23229, 2025

      • monkey[m]
        Here on lines 89-90, you can see that you await one of the getAllByText calls but not the other.
      • 2025-08-20 23229, 2025

      • monkey[m]
        You don't need to await getAllBy calls, I always get confused about which ones are async but alway go back to this cheatsheet page: https://testing-library.com/docs/react-testing-li…
      • 2025-08-20 23209, 2025

      • suvid[m]
        i am using getbytext now
      • 2025-08-20 23247, 2025

      • suvid[m]
        suvid[m]: this error on changing the name of the uploaded file to listenbrainz.zip
      • 2025-08-20 23256, 2025

      • suvid[m]
        though i am awaiting getbytext as well
      • 2025-08-20 23206, 2025

      • suvid[m] sent a js code block: https://matrix.chatbrainz.org/_matrix/media/v3/download/chatbrainz.org/eadatDXwqqTYpzKAfUGsilIj
      • 2025-08-20 23203, 2025

      • suvid[m]
        I removed the await
      • 2025-08-20 23204, 2025

      • suvid[m]
        but still the same
      • 2025-08-20 23207, 2025

      • monkey[m]
        suvid: To print out the component to the console, you can use `screen.debug(undefined, Infinity);`. When I do that, I can see that the elements in question are indeed not in the page markup, so that should be your first lead. The test is not passing because the component does not seem to currently render the imports.
      • 2025-08-20 23242, 2025

      • suvid[m]
        okay...
      • 2025-08-20 23242, 2025

      • suvid[m]
        Does my mockimports not get passed to the post req?
      • 2025-08-20 23221, 2025

      • suvid[m]
        cuz if it does then it should get rendered no?
      • 2025-08-20 23232, 2025

      • monkey[m]
        I think at the moment you do the test assertion, the loading indicator is rendered, so probably need to wait for everything to be rendered
      • 2025-08-20 23244, 2025

      • suvid[m]
        sorry not to the post req
      • 2025-08-20 23244, 2025

      • suvid[m]
        but the data received from post req that we want to display
      • 2025-08-20 23259, 2025

      • suvid[m]
        monkey[m]: so should i add a sleep somewhere?
      • 2025-08-20 23220, 2025

      • monkey[m]
        No, it would be an await mechanism, but let me try
      • 2025-08-20 23255, 2025

      • suvid[m]
        okay 👍️
      • 2025-08-20 23255, 2025

      • monkey[m]
      • 2025-08-20 23209, 2025

      • suvid[m]
        frontend testing is so weird 😩
      • 2025-08-20 23202, 2025

      • monkey[m]
        OK, so some progress: Indeed you need to wait for the component to call the API endpoint and render everything, which you can do like so: `await waitFor(() => { expect(screen.getByText("listeninghistory.zip")).toBeInTheDocument(); });`
      • 2025-08-20 23202, 2025

      • monkey[m]
        This assertion now passes for me, provided I change the filename so that only one element with that text is to be found.
      • 2025-08-20 23202, 2025

      • monkey[m]
        Now the next assertion is failing, but that means the assertion above passes.
      • 2025-08-20 23208, 2025

      • suvid[m]
        here:... (full message at <https://matrix.chatbrainz.org/_matrix/media/v3/download/chatbrainz.org/XxGsgXedhvZaBJYXwaouNNDc>)
      • 2025-08-20 23218, 2025

      • suvid[m]
        so i tried searching for spotify.zip
      • 2025-08-20 23218, 2025

      • suvid[m]
        but it couldnt find that as well
      • 2025-08-20 23210, 2025

      • monkey[m]
        suvid[m]: I don't understand this. I don't see spotify.zip defined anywhere as a file name
      • 2025-08-20 23228, 2025

      • suvid[m]
        i changed the name for spotify import in progress to spotify.zip
      • 2025-08-20 23236, 2025

      • suvid[m]
        and the completed listenbrainz one to listenbrainz.zip
      • 2025-08-20 23241, 2025

      • suvid[m]
        apologies for the confusion
      • 2025-08-20 23252, 2025

      • monkey[m]
        Ah OK.
      • 2025-08-20 23251, 2025

      • suvid[m]
        okay so now it matches spotify.zip 🥳
      • 2025-08-20 23257, 2025

      • suvid[m]
        its not matching the date now lol
      • 2025-08-20 23258, 2025

      • monkey[m]
        I think you are confusing your endpoints though. For initial render, the /list endpoint is called, not the one to get a specific import details
      • 2025-08-20 23253, 2025

      • monkey[m]
        suvid[m]: Yes, the assertion seems incorrect, but that is all part of what testing is about: write incorrect expectation, check that it does fail (that way you know there will be no false positives), then fix the test assertion and ensure it passes.
      • 2025-08-20 23224, 2025

      • monkey[m]
        In this case, you have the screen.debug line to allow you to print out the component, and check what is actually rendered.
      • 2025-08-20 23241, 2025

      • monkey[m]
        And on and on we go with each assertion and each test.
      • 2025-08-20 23248, 2025

      • monkey[m]
        If you want to run tests in isolation (which I recommend while you are writing the tests), you can change it("some test description", ... to it.only("some test description", ... with the extra .only
      • 2025-08-20 23200, 2025

      • monkey[m]
        Be sure to remove it after you are done with that test, though.
      • 2025-08-20 23238, 2025

      • suvid[m]
        monkey[m]: yes that is helping a lot
      • 2025-08-20 23201, 2025

      • suvid[m]
        monkey[m]: okay so the .only runs only that test in the file? 😮
      • 2025-08-20 23208, 2025

      • monkey[m]
        Yes indeed.
      • 2025-08-20 23243, 2025

      • monkey[m]
        I mean, if you have multiple .only I suppose it will run multiple tests, but it's meant so you can isolate tests
      • 2025-08-20 23246, 2025

      • SigHunter joined the channel
      • 2025-08-20 23211, 2025

      • Jigen
        monkey[m]: I'm here.
      • 2025-08-20 23239, 2025

      • monkey[m]
        OK, I'm finishing lunchtime, be there in 15
      • 2025-08-20 23225, 2025

      • Jigen
        👍
      • 2025-08-20 23227, 2025

      • Jigen
        no rush