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 = "Dealers")
public class DealersTest {

    @JiraTestCase(id = "LAMD-T1028")
    @TestCase(name = "Go to New Dealers page and check elements")
    public void tcCheckNewDealers(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.dealers().goToNewDealersPage());
    }

    @JiraTestCase(id = "LAMD-T1029")
    @TestCase(name = "Go to Dealers page and check elements")
    public void tcCheckDealers(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.dealers().goToDealersPage());
    }

    @JiraTestCase(id = "LAMD-T1030")
    @TestCase(name = "Go to Dealers Detail page and check elements")
    public void tcCheckDealersDetail(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.dealers().goToDealersPage())
                .clickFirstDealer()
                .then(smartAutoSetmanTasks.verification().checkDealersDetailPage());
    }
}