Uploaded image for project: 'Magnolia UI'
  1. Magnolia UI
  2. MGNLUI-5893

Fix intermittently failing tests for converted RichTextField

    XMLWordPrintable

Details

    • Task
    • Resolution: Unresolved
    • Neutral
    • None
    • None
    • None
    • None

    Description

      info.magnolia.ui.dialog.FieldsConversionTest#testConvertedRichTextField
      src/test/java/info/magnolia/ui/dialog/DefaultValuesConversionTest.java:68

      Both tests could fail in two similar situation which are reproducible:

      • in IntelliJ when these particular tests are run in debug mode (single test run) or in batch mode when test is first in a row (or single in batch),
      • with maven if one ignore or comment out all other tests in class (random order of tests is probably cause of random fails on jenkins?).

      Both tests fail on NPE because VaadinService call in (RichTextFieldFactory.java:127) that should be set by:

      VaadinRequest vaadinRequest = mock(VaadinRequest.class);
      doReturn("path").when(vaadinRequest).getContextPath();
      VaadinResponse vaadinResponse = mock(VaadinResponse.class);
      VaadinService.getCurrent().setCurrentInstances(vaadinRequest, vaadinResponse);

      in CompatibilityLayerJcrFormEnvironment::setUp, but under specified conditions VaadinService.getCurrentRequest() returns null here.

      Tests could be probably fixed (at least fails not reproducible by provided steps for maven anymore) by setting #setCurrentInstances() inside the test method instead of super.setUp(). Note that this VaadinRequest setup is only needed in case of RichTextField.

      Checklists

        Acceptance criteria

        Attachments

          Activity

            People

              Unassigned Unassigned
              asiska Adam Siska
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:

                Checklists

                  Task DoR