package cz.moneta.test.regression.channels.branch;

import cz.moneta.test.dsl.Harness;
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.dsl.util.credentials.Keys.ufo;
import static cz.moneta.test.harness.annotations.Environment.EDU;
import static cz.moneta.test.harness.annotations.Environment.PPE;
import static cz.moneta.test.harness.annotations.Environment.TST1;

@TestScenario(name = "Teller must be able to edit a CIF")
public class CifEditing {

    @TestCase(name = "Bank teller is able to login and edit a CIF", environments = {TST1, PPE, EDU})
    @JiraTestCase(id = "POB-T19520")
    public void tc_bank_teller_is_able_to_edit_CIF(Harness harness, @Key(ufo.banka.banker) Credentials credentials) {
        String RCofExistingClient = harness.getConfig("branch.squad.rc.client");

        harness.withUfo()
                .openLoginPage()
                .then(harness.tasks().ufo().banka().login().withCredentialsAndTurnOffSignpad(credentials))
                .then(harness.tasks().ufo().banka().search().findByRC(RCofExistingClient))
                .clickEdit()
                .onChangeDataFO()
                .clickSend()
                .onPrintInstructionPage()
                .clickLeftButton()
                .onMainClientPage()
                .verifyThatCifIsValid();
    }
}
