package cz.moneta.test.regression.internal.forte;

import cz.moneta.test.dsl.Harness;
import cz.moneta.test.dsl.forte.components.ForteRoles;
import cz.moneta.test.dsl.util.DateUtils;
import cz.moneta.test.harness.annotations.Environment;
import cz.moneta.test.harness.annotations.TestCase;
import cz.moneta.test.harness.annotations.TestScenarioWithOrder;
import org.junit.jupiter.api.Order;

import java.time.LocalDate;

@TestScenarioWithOrder(name = "Kontroly_OM")
public class BrnControlsTest {

    @Order(1)
    @TestCase(name = "Kontroly_OM", environments = {Environment.TST1})
    public void newBrnControlsParam(Harness harness) {
        String transactionDate = DateUtils.getDateWithFormat(LocalDate.now().minusMonths(3), "yyyy-MM-dd");
        harness.withForte()
                .openForteHomePage()
                .clickControlsOM()
                .selectRoleMenu(ForteRoles.RSZP)
                .clickControlsOnOM()
                .clickCurrentQuarterFilterButton()
                .clickFirstControlDetail()
                .clickAddTransactionControl()
                .selectControlType(1)
                .fillTransactionDate(transactionDate)
                .fillAccountNumber("123456/0100")
                .fillTransactionNumber("1234")
                .selectTransactionType(21)
                .selectControlResult(1)
                .fillBankerSSO("212623428")
                .clickSubmit()
                .checkFirstTransactionDate(transactionDate);
    }

    @Order(2)
    @TestCase(name = "Branches controls - check menu", environments = {Environment.TST1})
    public void openBrnControlsParam(Harness harness) {
        harness.withForte()
                .openForteHomePage()
                .clickControlsOM()
                .selectRoleMenu(ForteRoles.ADMINISTRATOR)
                .clickControlsEnumsTotalResult()
                .clickControlsEnumsErrorTypes()
                .clickControlsEnumsTransactionForms()
                .clientControlsEnumsTransactionTypes()
                .clickControlsEnumsTrendControl()
                .clickControlsEnumsControlTypes()
                .clickControlsEnumsProductTypes()
                .clickControlsEnumsControlResults()
                .clickSecurityEnumsControlsTypes()
                .clickSecurityEnumsControlResults();
    }

    @Order(3)
    @TestCase(name = "Branches controls - check reports filter", environments = {Environment.TST1})
    public void reportBrnControlsParam(Harness harness) {
        harness.withForte()
                .openForteHomePage()
                .clickControlsOM()
                .selectRoleMenu(ForteRoles.ADMINISTRATOR)
                .clickReportsControlsOnOM()
                .selectQuarterByIndex(2)
                .clickSearch()
                .checkResultTablePresence();
    }
}
