package cz.moneta.test.regression.channels.digital.ib.oldib.payment;

import cz.moneta.test.dsl.Harness;
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 org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.MethodOrderer;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.TestMethodOrder;
import org.junit.jupiter.api.parallel.Execution;
import org.junit.jupiter.api.parallel.ExecutionMode;

@Execution(ExecutionMode.SAME_THREAD)
@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
@TestScenario(name = "Creating a standard payment waiting for signature and than its signing.")
public class PaymentsWaitingForSignature {

    @Disabled
    @Order(1)
    @TestCase(name = "Go to current account and make standard payment waiting for signature")
    @JiraTestCase(id = "IB-T8258")
    void userWithCurrentAccount_shouldCreateNewStandardPaymentWaitingForSignature(Harness harness, @Key("ib.client") Credentials credentials) {
        harness.withIB()
                .openLoginPage()
                .then(harness.tasks().ib().loginWithDefaultMobileKeyAnd(credentials))
                .clickAccountsAndTransactions()
                .clickNewDomesticPaymentOrder()
                .clickFromAccountSelect()
                .fillToAccountNumber("123")
                .fillToAccountBank("0600")
                .fillAmount("1")
                .fillVariableSymbol("1")
                .fillConstantSymbol("308")
                .fillNoteForRecipient("My standard payment for You")
                .clickStandardPayment()
                .fillNote("My standard payment")
                .clickCategorySelect()
                .clickContinueButton()
                .clickSaveToSign();
    }

    @Disabled
    @Order(2)
    @TestCase(name = "Go to current account and make standard payment waiting for signature")
    @JiraTestCase(id = "IB-T8388")
    void userWithCurrentAccount_shouldSignAllPaymentsWaitingForSignatuere(Harness harness, @Key("ib.client") Credentials credentials) {
        harness.withIB()
                .openLoginPage()
                .then(harness.tasks().ib().loginWithDefaultMobileKeyAnd(credentials))
                .clickAccountsAndTransactions()
                .clickPaymentsWaitingForSignature()
                .clicSelectAll()
                .clicSignSelected()
                .clickSign()
                .typeSmsCode("12341234")
                .clickSignSms()
                .clickPaymentsWaitingForSignature();
    }
}
