package cz.moneta.test.regression.channels.digital.ml.brokersportal;

import cz.moneta.test.dsl.Harness;
import cz.moneta.test.dsl.util.task.brokerportal.BrokerPortalTasks;
import cz.moneta.test.harness.annotations.JiraTestCase;
import cz.moneta.test.harness.annotations.TestCase;
import cz.moneta.test.harness.annotations.NonConcurrentTestScenario;
import cz.moneta.test.harness.support.auth.Credentials;
import cz.moneta.test.harness.support.auth.Key;

import static cz.moneta.test.dsl.util.credentials.Keys.brokerPortal;

@NonConcurrentTestScenario(name = "Full Application Page")
public class FullApplicationTest {

    @TestCase(name = "Process until sign full application")
    @JiraTestCase(id = "ML-T456")
    public void tcSignFullApplication(Harness harness, @Key(brokerPortal.broker) Credentials broker) {
        BrokerPortalTasks tasks = harness.tasks().brokerPortal();
        harness.withBrokerPortal()
                .openLoginPage()
                .then(tasks.loginTasks().loginWithCredentials(broker))
                .then(tasks.menuTasks().selectProductMortgage())
                .then(tasks.calculatorTasks().fillCalculator("1000001"))
                .then(tasks.calculatorTasks().calculateAndSaveCalculator())
                .clickToShortApplicationButton()
                .then(tasks.shortApplicationTasks().fillAndConfirmShortApplication())
                .then(tasks.shortApplicationTasks().checkShortApplicationSummary())
                .clickCreateApplicationButton()
                .then(tasks.shortApplicationTasks().signShortApplication())
                .clickToFullApplication()
                .then(tasks.fullApplicationTasks().fillAndSaveFullApplication())
                .then(tasks.fullApplicationTasks().signFullApplication());
    }
}