Uploaded image for project: 'Magnolia Test Framework'
  1. Magnolia Test Framework
  2. MGNLTEST-164

RenderedPage not reachable (or too late)

XMLWordPrintable

      We have been using the RenderedPage for assertions in several tests in PagesCoreFunctionalTests (and PagesSpaFunctionalTests). While this worked fine for some time, this changed recently.

      It's possible that this is related to the fact that we had to change the version of ubuntu on AWS. The ubuntu version 18 we are using now has been reported to be significantly slower than previous versions.

      Tests have been "fixed" / adjusted by doing assertions with selenium-independent assertions using the MagnoliaHttpClient (instead of the the RenderedPage).

      Acceptance criteria

      • "Adjust" the test-fwk in a way that RenderedPage again can be used as a trustworthy way to make assertions.
      • Make sure there is a self-test checking that the RenderedPage works as expected.

      Example test, which worked "before" and now fails, but which should work again from PagesCoreFunctionalTests):

          @Test
          @Fixture(fixtureFile = "website.lorem-ipsum.yaml", repository = "website")
          @Cleanup("website:/lorem-ipsum")
          void addComponent(PageObjects expect, Navigator navigator) {
              loginAndOpenPagesApp(expect, Personas.ERIC);
      
              pagesApp.clickRow("lorem-ipsum")
                      .hitAction("Edit page");
      
              PageEditor pageEditor = expect.pageEditor("Lorem ipsum");
              // check whether the footer is still "empty"
              assertThrows(NoSuchElementException.class, () -> pageEditor.selectArea("Footer").selectComponent("Text and image"));
      
              pageEditor.hitAction("Add component");
              expect.form("Add component")
                      .setComboBoxOption("Type of component", "Text and image")
                      .clickButton("Next");
              expect.form("Text and image")
                      .setTextField("Headline (en)", "Do Re Mi")
                      .save();
      
              navigator.to(DIRECT_AUTHOR, "lorem-ipsum");
              assertTrue(expect.renderedPage("Lorem ipsum").hasText("Do Re Mi"));
          }
      

       

      Developers note

      The issue simply spoken seems to be a timing issue. 
      A fix may likely requires code which checks whether certain condition is already checked/true.
      Note that we already do this to a certain extent, not within RenderedPage itself, but on PageObjects#renderedPage(string)

      I wonder whether it would be "nicer" to have the conditional logic directly within RenderedPage ... but not yet sure whether that's easy doable.

      In case you need to add more "waiting" / "conditional waiting" - consider using the https://github.com/awaitility/awaitility framework.

      While it is legit to use the MagnoliaHttpClient to make assertions, RenderedPage must work.
      The former for instance is okay to check the content of a page from pages-app in PagesCoreFunctionalTests. But the client cannot used to check the content in the context of SPA. The http response body of a page done with SPA template(s) only contains a bit of JavaScript but not the content to check.

      Here's a possible reason why Ubuntu 18 is "slower" than previous versions:
      https://github.com/opencontainers/runc/pull/2921 (via Maxime).

       

       

        Acceptance criteria

              mhaderka Martin Haderka
              cmeier Christoph Meier
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved:

                  Bug DoR
                  Task DoD