package cz.moneta.test.dsl.ib.messages;

import cz.moneta.test.dsl.ib.IbPageFlow;
import cz.moneta.test.dsl.ib.components.MainMenu;
import cz.moneta.test.dsl.ib.components.UserMenu;
import cz.moneta.test.harness.support.web.Click;
import cz.moneta.test.harness.support.web.Wait;

import static cz.moneta.test.dsl.ib.messages.IbSentMessagePage.SENT_HEADER_TEXT;
import static cz.moneta.test.dsl.ib.messages.IbSentMessagePage.WRITE_NEW_MAIL;

@Wait({SENT_HEADER_TEXT, WRITE_NEW_MAIL})
public interface IbSentMessagePage extends IbPageFlow<IbSentMessagePage>, MainMenu, UserMenu, IbMailsLeftMenu {
    String SENT_HEADER_TEXT = "//h3[text() = 'Odeslané zprávy']";
    String WRITE_NEW_MAIL = "//img[@alt = 'Napsat novou zprávu']";
    String MAIL_ROW = "//tr[contains(@class, 'readMessage')]";
    String SENT_MAIL = MAIL_ROW + "//td[@class = 'listItem' and contains(text(), '%s')]";

    @Wait(MAIL_ROW)
    @Click(value = SENT_MAIL, isStringDynamicXpath = true)
    IbMailDetailPage openMail(String mailTitle);

}
