jQuery UI Widgets Forums React React Testing Library

Tagged: , , ,

This topic contains 4 replies, has 2 voices, and was last updated by  pratik.shah 5 years, 4 months ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
  • React Testing Library #105897

    mfearby
    Participant

    I’ve started writing a few unit tests of a component which wraps a JqxComboBox but, using the React Testing Library, it doesn’t appear that we can get a handle on the component itself. We have to do DOM testing or go back to Enzyme or something. It would be nice if I could get the component itself, then I can query the data adapter to find out how many records it got. But instead, it seems I’ll have to trigger a click on the drop-down and then count the DOM nodes in the drop-down that appears.

    Has anyone else used this particular testing library with jqwidgets? It seems very popular and looks like it would be great to use, except for the caveat of not being able to get the component itself.

    React Testing Library #105908

    mfearby
    Participant

    I tried doing an Enzyme test instead but it totally barfs trying to mount my component (which returns a <JqxComboBox> from the render method). I get these kind of exceptions now:

    console.error node_modules/jsdom/lib/jsdom/virtual-console.js:29
    Error: Uncaught [Error: Invalid Selector – #JqxComboBoxjqx52b72e9dda50! Please, check whether the used ID or CSS Class name is correct.]

    If I do an enzyme shallow() instead of mount() it doesn’t barf but the component is also next to useless, so unless I can mount it properly in a testing environment, I may as well limp along with React Testing Library.

    Is there any guidance on how to test React apps using jQWidgets?

    React Testing Library #105909

    mfearby
    Participant

    I started configuring an isolated/basic demo here but I can’t even get jqwidgets to work in a codesandbox for some reason. It keeps saying:

    ModuleNotFoundError
    Could not find module in path: 'jqwidgets-scripts/jqwidgets-react-tsx/jqxcombobox' relative to '/src/my-combo.tsx'

    I don’t know what I was thinking, trying to do automated testing. I’ve hit brick wall after brick wall with this. It’s no wonder that most developers just ignore it altogether, but I’m trying not to give up.

    React Testing Library #105911

    mfearby
    Participant

    I found an alternative to codesandbox which allows the jqxcombobox to work, but it doesn’t let me run unit tests 🙁

    https://stackblitz.com/edit/react-ts-qgefho

    React Testing Library #106635

    pratik.shah
    Participant

    Was anybody able to write test case for Jqxgrid?

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.