package cz.moneta.test.regression.ufoframework;

import cz.moneta.test.dsl.Harness;
import cz.moneta.test.dsl.ufo.banka.tasks.BankaTasks;
import cz.moneta.test.dsl.util.credentials.Keys;
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 cz.moneta.test.regression.commercial.smallbusiness.digital.TearDown;
import org.junit.jupiter.api.AfterEach;

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

@TestScenario(name = "Ufo Banka Log Test")
public class UfoBankaLogTest {

    @TestCase(name = "Ufo Banka Log Test", environments = {TST1, PPE})
    @JiraTestCase(id = "UFO-T512")
    public void ufoBankaLogTest(Harness harness, @Key(Keys.ufo.banka.banker) Credentials credentials) {
        String clientCif = harness.getConfig("ufo_framework_team.ufo_banka.client.cif");
        BankaTasks bankaTasks = harness.tasks().ufo().banka();

        harness.withUfo()
                .openLoginPage()
                .then(bankaTasks.login().withCredentials(credentials))
                .then(bankaTasks.search().findByCif(clientCif))
                .clickLog()
                .verifyLogDataNotEmpty()
                .clickCopyLog();
    }

    @AfterEach
    protected void tearDown(Harness harness) {
        TearDown.storeBirthNumberFullNameCifSessionId(harness);
    }
}
