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

Introduce row absence check API to the Grid page object

XMLWordPrintable

      Please see code in info.magnolia.functionaltests.PagesCoreFunctionalTests#publishDeletionSinglePage for more detail

          @Test
          @Fixture(fixtureFile = "website.lorem-ipsum.yaml", repository = "website")
          @Cleanup("website:/lorem-ipsum")
          @ImplicitWaitTimeout(seconds = 30)
          void publishDeletionSinglePage(PageObjects expect) {
              loginAndOpenPagesApp(expect, Personas.PETER);
              // TODO: remove this method once MGNLCE-214 is resolved
              pagesApp.selectRowByPath("/lorem-ipsum")
                      .hitAction("Publish");
              // This assert to make sure it is availabe on public instance
              assertNotEquals(HttpStatus.SC_NOT_FOUND, getStatusOfDirectPublicPage("lorem-ipsum"));
      
              pagesApp.clickRow("Lorem ipsum")
                      .hitAction("Delete page");
              expect.alert().confirm();
              pagesApp.selectRowByPath("/lorem-ipsum")
                      .hitAction("Publish deletion");
      
              assertFalse(pagesApp.hasRow("lorem-ipsum"));// Will be failed this step
              assertEquals(HttpStatus.SC_NOT_FOUND, getStatusOfDirectPublicPage("lorem-ipsum"));
          }
      

      As a matter of fact, hasRow(...) returns even faster than the implicit wait timeout because internally it temporarily drops it to 500ms. The goal behind this was to respond faster when it is valid that an element is not there, instead of waiting for the whole timeout.
      In this case, however, publishing usually requiring a few seconds to complete, this clearly doesn't work.


      Here we can't rely on increasing implicit wait time until we catch ElementNotFoundException, rather we could use an ExpectedCondition and rely on explicit wait time, for instance we could have a method

      boolean notHasRow(String itemCaption, ViewType viewType) {
             return newWebDriverWait(driver).until(ExpectedConditions.invisibilityOfElementLocated(byGridRowItem(itemCaption, viewType)));
          }
      

        Acceptance criteria

              rdhar Rishab Dhar
              sang.ngo Sang Ngo Huu
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved:

                  Task DoR