package cz.moneta.test.smoke.itp.ieandmwf;

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.*;

@TestScenario(name = "Teller must be able to find client by RC")
public class LookupClientByRC {

    @TestCase(name = "Bank teller is able to login and lookup client by RC", environments = {TST1, TST3, PPE, EDU, FVE})
    @JiraTestCase(id = "TEA-T26")
    public void tc_bank_teller_is_able_to_find_client_by_RC(Harness harness, @Key(ufo.banka.banker) Credentials credentials) {

        String rcOfExistingClient = harness.getConfig("channels.branch.rc-of-existing-client");

        harness.withUfo()
                .openLoginPage()
                .then(harness.tasks().ufo().banka().login().withCredentials(credentials))
                .closeSearchedHistoryIfVisible()
                .fillSearchTerm(rcOfExistingClient)
                .clickSearchByRc()
                .onClientDetailPage()
                .verifyThatClientHasSomeActiveProducts();
    }
}
