package cz.moneta.test.dsl.ufo.banka.pages.main;

import cz.moneta.test.harness.context.StoreAccessor;
import cz.moneta.test.harness.endpoints.ufo.UfoEndpoint;
import cz.moneta.test.harness.support.web.CustomAction;
import cz.moneta.test.harness.support.web.Wait;
import cz.moneta.test.harness.support.web.WebFlow;

@Wait(value = PSP012_S001_PrintPage.PAGE_LABEL_XPATH, waitSecondsForElement = 60)
@Wait(explicitWaitSeconds = 5) //Error message: javascript error: window.parent.document.PSP004_S001_D002.done is not a function
public interface PSP012_S001_PrintPage extends WebFlow<PSP012_S001_PrintPage>, StoreAccessor {
    String PAGE_LABEL_XPATH = "PSP012_S001_D002";

    @CustomAction
    default PSP012_S001_PrintTransitionPage closePrintWindow() {
        UfoEndpoint endpoint = getEndpoint(UfoEndpoint.class);
        endpoint.executeScript("window.parent.document.PSP012_S001_D002.done()");
        return null;
    }
}
