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

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

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

    @TestCase(name = "UFO OPS on Tomcat teller is able to login and lookup client by RC", environments = {TST1, PPE, EDU})
    void lookupClientByRcUfoOpsTomcatSmokeTest(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)
                .clickSearchClient()
                .onClientDetailsPage()
                .checkClientRc(rcOfExistingClient);
    }
}
