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 = "Change password")
public class ChangePasswordTest {

    @JiraTestCase(id = "LAMD-T1014")
    @TestCase(name = "Operator is able to successfully change password")
    public void tcSuccessfulChangePassword(Harness harness, @Key(smart.auto.general) Credentials credentials) {

        SmartAutoTasks smartAutoTasks = harness.tasks().auto().smartAuto();

        harness.withSmartAuto()
                .openLoginPage()
                .then(smartAutoTasks.login().loginWithCredentials(credentials))
                .clickOperatorOptions()
                .clickChangePassword()
                .typeOldPassword(credentials.getPassword())
                .typeNewPassword("Automobil1*")
                .typeNewPasswordConfirm("Automobil1*")
                .clickChangePassword()
                .checkSuccessfulChangedPasswordMessage()
                .typeOldPassword("Automobil1*")
                .typeNewPassword(credentials.getPassword())
                .typeNewPasswordConfirm(credentials.getPassword())
                .clickChangePassword()
                .checkSuccessfulChangedPasswordMessage();
    }
}