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

import cz.moneta.test.dsl.Harness;
import cz.moneta.test.dsl.util.credentials.Keys.smart;
import cz.moneta.test.dsl.util.task.auto.smartauto.SmartAutoTasks;
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 SMARTauto.")
public class LoginTest {

    @JiraTestCase(id = "LAMD-T1023")
    @TestCase(name = "Successful login.")
    public void tcSuccessfulLogin(Harness harness, @Key(smart.auto.general) Credentials credentials) {
        SmartAutoTasks smartAutoTasks = harness.tasks().auto().smartAuto();

        harness.withSmartAuto()
                .openLoginPage()
                .then(smartAutoTasks.login().loginWithCredentials(credentials))
                .then(smartAutoTasks.verification().checkMenu());
    }

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