package cz.moneta.test.regression.commercial.auto.smartauto.setman;

import cz.moneta.test.dsl.Harness;
import cz.moneta.test.dsl.util.credentials.Keys.smart;
import cz.moneta.test.dsl.util.task.auto.smartauto.setman.SmartAutoSetmanTasks;
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;

@Disabled
@TestScenario(name = "Successful login to parametrization tool SETMAN.")
public class LoginTest {
    /**
     * Odhlášení po přihlášení kvůli Kerberosu
     */
    @JiraTestCase(id = "LAMD-T1031")
    @TestCase(name = "Successful login.")
    public void tcSuccessfulLogin(Harness harness, @Key(smart.auto.setman) Credentials credentials) {
        SmartAutoSetmanTasks smartAutoSetmanTasks = harness.tasks().auto().smartAutoSetman();
        harness.withSmartAutoSetman()
            .openLoginPage()
            .logoutIfNecessary(harness)
            .then(smartAutoSetmanTasks.login().loginWithCredentials(credentials))
            .then(smartAutoSetmanTasks.verification().checkMenu());
    }

    @JiraTestCase(id = "LAMD-T1032")
    @TestCase(name = "Failed login.")
    public void tcFailedLogin(Harness harness, @Key(smart.auto.setman) Credentials credentials) {
        harness.withSmartAutoSetman()
            .openLoginPage()
            .logoutIfNecessary(harness)
            .typeUsername("test")
            .typePassword("test")
            .clickLoginToFail()
            .checkUnauthorizedAccess();
    }
}