package cz.moneta.test.regression.ufoframework;

import cz.moneta.test.dsl.Harness;
import cz.moneta.test.dsl.ufo.ufoframework.tasks.FunctionalTestsTasks;
import cz.moneta.test.dsl.util.credentials.Keys;
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.TestScenario;
import cz.moneta.test.harness.support.auth.Credentials;
import cz.moneta.test.harness.support.auth.Key;
import cz.moneta.test.regression.commercial.smallbusiness.digital.TearDown;
import org.junit.jupiter.api.AfterEach;

@TestScenario(name = "Generate Session")
public class GenerateSession {

    @TestCase(name = "Generate Session", environments = {Environment.TST1, Environment.PPE, Environment.DEV,})
    @JiraTestCase(id = "UFO-T513")
    public void generateSessions(Harness harness, @Key(Keys.ufo.banka.banker) Credentials credentials) {

        FunctionalTestsTasks functionalTestsTasks = harness.tasks().ufo().functionalTests();
        harness.withUfo()
                .openLoginPage()
                .then(functionalTestsTasks.login().withCredentials(credentials))
                .clickOtherErika()
                .fillStepCount("90000")
                .clickGenerateSession()
                .waitForGeneratingSessions();
    }

    @AfterEach
    protected void tearDown(Harness harness) {
        TearDown.storeBirthNumberFullNameCifSessionId(harness);
    }
}
