package cz.moneta.test.regression.backoffice.ufooperations.regressionsbbo;

import cz.moneta.test.dsl.Harness;
import cz.moneta.test.dsl.ufo.operations.search.SearchBy;
import cz.moneta.test.dsl.util.credentials.Keys;
import cz.moneta.test.dsl.util.task.ufo.operations.OperationsTasks;
import cz.moneta.test.harness.annotations.*;
import cz.moneta.test.harness.support.auth.Credentials;
import cz.moneta.test.harness.support.auth.Key;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Disabled;

import static cz.moneta.test.dsl.util.task.ufo.cb.CommercialTasks.JIRA_COMMENT_STORE_KEY;
import static cz.moneta.test.harness.annotations.Environment.PPE;

@TestScenario(name = "Transfer orders")
public class TransferOrders {
    String accountNumber = "236354729";

    @TestCase(name = "Incorrect transfer order", environments = {PPE})
    @JiraTestCase(id = "BOC-T8480")
    public void incorrectTransferOrder(Harness harness, @Key(Keys.ufo.banka.banker) Credentials credentials) {
        OperationsTasks operationsTasksTasks = harness.tasks().ufo().operations();

        harness.withUfo()
                .openLoginPage()
                .then(operationsTasksTasks.login().withCredentialsAndSelectFirstOM(credentials))
                .fillSearchInput(accountNumber)
                .searchBy(SearchBy.ACCOUNT_NUMBER)
                .onClientDetailsPage()
                .clickAccountList()
                .clickTransactions()
                .clickTransactionOrder()
                .clickPaymentsZaklad()
                .selectOrderType("Poplatky")
                .fillAmount("a")
                .clickSendAndAcceptAlert();
    }

    @AfterEach
    protected void teardown(Harness harness) {
        harness.store(JIRA_COMMENT_STORE_KEY,
                "\nUFO Session ID: " + harness.get("reports.tmfj.execution.commentufosessionid", true) +
                        "\nČíslo účtu: " + accountNumber);
    }
}