package cz.moneta.test.dsl.newib;

import cz.moneta.test.harness.context.StoreAccessor;
import cz.moneta.test.harness.endpoints.WebEndpoint;
import cz.moneta.test.harness.endpoints.ib.NewIbEndpoint;
import cz.moneta.test.harness.support.web.CustomAction;
import cz.moneta.test.harness.support.web.WebFlow;

import static org.junit.Assert.assertTrue;

public interface NewIbPageFlow<A extends WebFlow<A>> extends WebFlow<A>, StoreAccessor {

    default void beforePageLoad(WebEndpoint webEndpoint) {
        //TO DO add page loader elements
    }

    @CustomAction
    default A checkUrl(String urlExpected) {
        NewIbEndpoint newIbEndpoint = getEndpoint(NewIbEndpoint.class);
        String actualUrl = newIbEndpoint.getCurrentUrl();
        assertTrue(actualUrl.contains(urlExpected));
        return null;
    }
}
