Question T10853
Visible to All Users

Failing tests after upgrade to 1.9.52

created 2 years ago

Hi,

After upgrade to 1.9.52 some of my unit tests started to fail.

The problem lies in
TypeError: Cannot read properties of undefined (reading 'replace')
at clearNewLines (/Users/pkk82/project/node_modules/survey-creator-core/webpack:/SurveyCreatorCore/src/utils/utils.ts:232:15)
at StringEditorViewModelBase…/src/components/string-editor.ts.StringEditorViewModelBase.onBlur (/Users/pkk82/node_modules/survey-creator-core/webpack:/SurveyCreatorCore/src/components/string-editor.ts:170:48)
at SurveyLocStringEditor._this.onBlur (/Users/pkk82/project/node_modules/survey-creator-react/webpack:/SurveyCreator/src/StringEditor.tsx:72:20)

Can you look at it and advise how to circumvent it?

Thanks,
Piotr

Answers approved by surveyjs Support

created 2 years ago

Hello Piotr,
The only way to make sure it doesn't happen again, is to add your scenarios into our Unit tests.
If you describe your scenarios, we will take a look and see what we can do.

Thank you,
Andrew
SurveyJS Team

    Other Answers

    created 2 years ago

    Hi,

    I have three scenarios:

    • trying to find appropriate 'Delete icon' wheras there are many on the page (page one, panel one, question one)
      in order to find appropriate one from many I am selecting given component based on its content and making a click on it, click selects given part so I can restrict fining based on CSS class name. Error occurs when trying to perform the code:
      const questionTitlePrefix = screen.getByText(/1./);
      await user.click(questionTitlePrefix);
      with configuration
      userEvent.setup({ pointerEventsCheck: PointerEventsCheckLevel.Never })

    • the same occurs when trying just to find button by the order
      const deleteButton = screen.getAllByTitle('Delete')[2];
      await user.click(deleteButton);

    • trying to click a toolbox item
      screen.findByLabelText(Single input toolbox item, { selector: 'div' });

    Thanks,
    Piotr

      Comments (2)

        Aha,
        We are talking about e2e tests and not unit tests.
        In this case, you are probably need to use css selectors, because we can add/remove some UI elements or their orders.

        Thank you,
        Andrew
        SurveyJS Team

          By the way, you may want to review our e2e tests. I believe we are testing all your 3 scenarios.
          Tests for designer tab you can find here.

          Thank you,
          Andrew
          SurveyJS Team