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

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

@TestScenario(name = "UFO OPS teller must be able to find client by RC")
public class LookupClientByRcUfoOps {

    @TestCase(name = "UFO OPS teller is able to login and lookup client by RC", environments = {TST1, PPE, EDU})
    @JiraTestCase(id = "TEA-T29")
    void lookupClientByRcUfoOpsSmokeTest(Harness harness, @Key(Keys.ufo.banka.banker) Credentials credentials) {
        String rcOfExistingClient = harness.getConfig("channels.branch.rc-of-existing-client");
        OperationsTasks operationsTasks = harness.tasks().ufo().operations();

        harness.withUfo()
                .openLoginPage()
                .then(operationsTasks.login().withCredentials(credentials))
                .clickRcRadio()
                .fillSearchInput(rcOfExistingClient)
                .clickSearchClientWithHover()
                .onClientDetailsPage()
                .checkClientRc(rcOfExistingClient);
    }
}
