package cz.moneta.test.regression.feeincome.insurance;

import cz.moneta.test.dsl.Harness;
import cz.moneta.test.dsl.ufo.banka.tasks.BankaTasks;
import cz.moneta.test.harness.annotations.JiraTestCase;
import cz.moneta.test.harness.annotations.TestCase;
import cz.moneta.test.harness.annotations.TestScenario;
import cz.moneta.test.harness.support.auth.Credentials;
import cz.moneta.test.harness.support.auth.Key;

import static cz.moneta.test.harness.annotations.Environment.PPE;
import static cz.moneta.test.harness.annotations.Environment.TST1;

@TestScenario(name = " Komex aditionall Insurance TestSuite basic tests cases")
public class KomexAdditionalInsurance {

    @TestCase(name = "Komex Expres Business in UFO Bank", environments = {TST1, PPE})
    @JiraTestCase(id = "INS-T346")
    public void checkKomexInsuranceBank(Harness harness, @Key("ufo-banka-banker") Credentials credentials) {
        BankaTasks bankaTasks = harness.tasks().ufo().banka();
        String ico = harness.getConfig("ico.komexInsuranceBank");
        String expresAccount = harness.getConfig("expres.komexInsuranceBank");

        harness.withUfo()
                .openLoginPage()
                .then(bankaTasks.login().withCredentialsAndTurnOffSignpad(credentials))
                .then(bankaTasks.search().findByIco(ico))
                .clickExpresKomexDetail(expresAccount)
                .clickEditInsuranceKomex()
                .clickAddKomexButton()
                .clickInvalidCheckButton()
                .clickConfirmChangeKomex()
                .clickConfirmSignedButton()
                .clickInsChangeVictoryButton()
                .clickEditInsuranceKomex()
                .clickKomexTerminationButton()
                .clickConfirmChangeCancelKomex()
                .clickInsChangeVictoryCancelButton();
    }
}