[MGNLTEST-39] Introduce row absence check API to the Grid page object Created: 05/Mar/20  Updated: 08/Jul/20  Resolved: 05/Jun/20

Status: Closed
Project: Magnolia Test Framework
Component/s: None
Affects Version/s: None
Fix Version/s: 1.0

Type: Task Priority: Neutral
Reporter: Sang Ngo Huu Assignee: Rishab Dhar
Resolution: Fixed Votes: 0
Labels: QA&Testing, hardening-fwk
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Template:
Acceptance criteria:
Empty
Task DoR:
Empty
Epic Link: core-TF-features-bugs-improvements
Story Points: 5

 Description   

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)));
    }

Generated at Mon Feb 12 07:44:58 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.