0

My goal

My intuition is that Fluentlenium untilPage(myPage).isAt() is used to assert if I have reached a page or not based on matching URL. Although it seems to return true regardless of the page has reached my page or not. I think I am just misunderstanding the purpose of this function.

From the Fluent Docs:

"If you want to wait until the page you want is the page that you are at, you can use"

My setup:

import org.fluentlenium.adapter.junit.FluentTest;
import org.fluentlenium.core.FluentPage;
import org.fluentlenium.core.annotation.Page;
import org.fluentlenium.core.annotation.PageUrl;
import org.junit.Test;

@PageUrl("http://www.google.com")
class GPage extends FluentPage {
}

@PageUrl("www.fakepage.com")
class FPage extends FluentPage{

}

public class Duh extends FluentTest {

    @Page
    GPage google;
    @Page
    FPage fakePage;


    @Test
    public void test() {
        goTo(google);
        await().atMost(1).untilPage(fakePage).isAt();
    }
}

This code does not throw any exceptions after completion. What is this function intended for? Is it just waiting on document.readyState, even though this functionality is already provided by isLoaded()?

Versions:
Fluentlenium/Selenium 3.0.0
Junit 4.12

PS: I am aware this is possible using Selenium. I am just inquiring to what the purpose of this specific function is.

Community
  • 1
  • 1
code_disciple1
  • 121
  • 1
  • 11

1 Answers1

0

@code_disciple1 isAt method is meant to be used for both simple and more complex assertions. Waiting for the document.readyState does not work for all the cases. Sometimes you want to check if you are at the proper page using more than one condition eg. waiting for a specific element, specific URL or any other check you want to run. Eg. in my current project we check if the current page has a specific URL.

Indeed you can write such a method using Selenium but FluentLenium offers the easy out of the box mechanism to assert such cases.

Also if you think there is a bug in this functionality please report that on our GitHub https://github.com/FluentLenium/FluentLenium/issues.

baadnews
  • 118
  • 1
  • 5