package cz.moneta.test.regression.channels.digital.ib.newib.settings;

import cz.moneta.test.dsl.Harness;
import cz.moneta.test.dsl.newib.tasks.NewIbTasks;
import cz.moneta.test.harness.annotations.Environment;
import cz.moneta.test.harness.annotations.JiraTestCase;
import cz.moneta.test.harness.annotations.TestCase;
import cz.moneta.test.harness.annotations.TestScenarioWithOrder;
import cz.moneta.test.harness.support.auth.Credentials;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Order;

@TestScenarioWithOrder(name = "About the smart banka")
public class AboutTheSmartBanka {
    Credentials clientCredentials;

    @BeforeAll
    public void getCredentials(Harness harness) {
        String clientBirthNumber = harness.getConfig("nib.rc.aboutTheSmartBanka");

        clientCredentials = harness.tasks()
                .udebs()
                .findCredentialsByRC(clientBirthNumber);
    }

    @Disabled
    @Order(1)
    @TestCase(name = "About the smart banka - settings", environments = {Environment.TST1, Environment.PPE})
    @JiraTestCase(id = "NIB-T1836")
    public void aboutTheSmartBankaSettings(Harness harness) {
        NewIbTasks newIbTasks = harness.tasks().newIb();

        harness.withNewIb()
                .openLoginPage()
                .then(newIbTasks.loginWithUsernamePasswordAndDefaultMobKey(clientCredentials.getUsername(), clientCredentials.getPassword()))
                .then(newIbTasks.checkAboutTheSmartBanka());
    }

    @Disabled
    @Order(2)
    @TestCase(name = "About the smart banka - authorization", environments = {Environment.TST1, Environment.PPE})
    @JiraTestCase(id = "NIB-T1840")
    public void aboutTheSmartBankaAuthorization(Harness harness) {
        NewIbTasks newIbTasks = harness.tasks().newIb();

        harness.withNewIb()
                .openLoginPage()
                .then(newIbTasks.loginWithUsernamePasswordAndDefaultMobKey(clientCredentials.getUsername(), clientCredentials.getPassword()))
                .then(newIbTasks.checkAboutTheSmartBankaAuthorization());
    }
}
