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

import cz.moneta.test.dsl.Harness;
import cz.moneta.test.harness.annotations.TestCase;
import cz.moneta.test.harness.annotations.TestScenario;
import cz.moneta.test.harness.support.auth.Credentials;
import org.junit.jupiter.api.BeforeEach;
import cz.moneta.test.harness.annotations.JiraTestCase;
import org.junit.jupiter.api.Disabled;

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

@TestScenario(name = "Verify Insurance of property, cards and internet risks")
public class InsuranceOfPropertyCardsAndInternetRisksTest {

    private String birthNumber;

    @BeforeEach
    void cancelInsurance(Harness harness) {
        birthNumber = harness.getConfig("IB.rc.property-cards-internetrisks-insurance");
        harness.tasks()
                .insuranceTasks()
                .setInsuranceStatusTask()
                .cancelInsurance(birthNumber);
    }

    @Disabled
    @TestCase(name = "Go to insurance page and create insurance of property, cards and internet risks", environments = {TST1, PPE})
    @JiraTestCase(id = "IB-T8232")
    void userWithCurrentAccount_shouldCreateInsuranceOfThingsCardsAndInternetRisks(Harness harness) {
        Credentials udebsCredentials = harness.tasks().udebs().findCredentialsByRC(birthNumber);

        harness.withIB()
                .openLoginPage()
                .then(harness.tasks().ib().loginWithDefaultMobileKeyAnd(udebsCredentials))
                .clickInsurance()
                .clickCreateInsuranceOfPropertyCardsAndInternetRisks()
                .clickAccountSelect()
                .clickLicenceAgreement()
                .clickInsuranceAgreement()
                .clickContinueButton()
                .typeSmsCode("12341234")
                .clickSend()
                .clickListInsurace();
    }
}
