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

import cz.moneta.test.dsl.Harness;
import cz.moneta.test.harness.annotations.JiraTestCase;
import cz.moneta.test.harness.annotations.NonConcurrentTestScenario;
import cz.moneta.test.harness.annotations.TestCase;
import cz.moneta.test.harness.support.auth.Credentials;
import org.junit.jupiter.api.BeforeAll;

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

@NonConcurrentTestScenario(name = "Verify domestic payments in IB")
public class NewDomesticPaymentIb {
    private Credentials credentials;

    @BeforeAll
    public void clientData(Harness harness) {
        String clientBirthNumber = harness.getConfig("IB.rc.smokeuser-with-one-CZK-account");

        credentials = harness.tasks()
                .wso2()
                .idm()
                .getIbCredentialsByRC(clientBirthNumber);
    }

    @TestCase(name = "Go to current account and make domestic payment", environments = {TST1, PPE})
    @JiraTestCase(id = "TEA-T27")
    void createNewDomesticPaymentSmokeTest(Harness harness) {
        harness.withNewIb()
                .openLoginPage()
                .then(harness.tasks().newIb().loginWithUsernamePasswordAndDefaultMobKey(credentials.getUsername(), credentials.getPassword()))
                .goToNewPayment()
                .fillNumberOfAccount("0233949348")
                .fillBankCode("0600")
                .fillAmount("1")
                .fillVariableSymbol("1")
                .fillConstantSymbol("308")
                .fillRecipientMessage("My payment for You")
                .fillMyNote("My payment")
                .clickContinue()
                .clickContinue()
                .fillMobileKey("12341234")
                .clickContinueMobileKey();
    }
}