package cz.moneta.test.dsl.auto.smartauto;

import cz.moneta.test.harness.support.web.*;

import static cz.moneta.test.dsl.auto.smartauto.ChangePasswordPage.*;

@Wait({INPUT_OLD_PASSWORD, INPUT_NEW_PASSWORD, INPUT_NEW_PASSWORD_CONFIRM, BUTTON_CHANGE_PASSWORD})
public interface ChangePasswordPage extends SmartAutoFlow<ChangePasswordPage> {

    String INPUT_OLD_PASSWORD = "//input[@name='oldPassword']";
    String INPUT_NEW_PASSWORD = "//input[@name='newPassword']";
    String INPUT_NEW_PASSWORD_CONFIRM = "//input[@name='newPasswordConfirm']";
    String BUTTON_CHANGE_PASSWORD = "//button//span[contains(text(), 'ZMĚNIT HESLO')]";
    String SUCCESSFUL_CHANGED_PASSWORD_MESSAGE = "//div[contains(text(), 'Heslo bylo úspěšně změněno')]";

    @TypeInto(INPUT_OLD_PASSWORD)
    ChangePasswordPage typeOldPassword(String oldPassword);

    @TypeInto(INPUT_NEW_PASSWORD)
    ChangePasswordPage typeNewPassword(String newPassword);

    @TypeInto(INPUT_NEW_PASSWORD_CONFIRM)
    ChangePasswordPage typeNewPasswordConfirm(String newPasswordConfirm);

    @Click(BUTTON_CHANGE_PASSWORD)
    ChangePasswordPage clickChangePassword();

    @Wait(value = SUCCESSFUL_CHANGED_PASSWORD_MESSAGE, until = Until.VISIBLE)
    @CheckElementPresent(SUCCESSFUL_CHANGED_PASSWORD_MESSAGE)
    ChangePasswordPage checkSuccessfulChangedPasswordMessage();
}
