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

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.Order;

@TestScenarioWithOrder(name = "Smoke test")
public class NewIbSmokeTest {
    Credentials clientCredentials;

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

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

    @Order(1)
    @TestCase(name = "Vertical menu items test", environments = {Environment.TST1, Environment.PPE})
    @JiraTestCase(id = "SB-T9244")
    public void verticalMenuItems(Harness harness) {
        NewIbTasks newIbTasks = harness.tasks().newIb();

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

    @Order(2)
    @TestCase(name = "Horizontal menu items test", environments = {Environment.TST1, Environment.PPE})
    @JiraTestCase(id = "SB-T9245")
    public void horizontalMenuItems(Harness harness) {
        NewIbTasks newIbTasks = harness.tasks().newIb();

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