package cz.moneta.test.regression.commercial.cb.archive;

import cz.moneta.test.dsl.Harness;
import cz.moneta.test.dsl.util.TestUtils;
import cz.moneta.test.dsl.util.task.ufo.cb.CommercialTasks;
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 org.junit.jupiter.api.Disabled;

import static cz.moneta.test.dsl.util.task.ufo.cb.CommercialTasks.JIRA_COMMENT_STORE_KEY;

@Disabled
@TestScenario(name = "Test saves note in documents page")
public class SaveNotesToDocument {

    @TestCase(name = "Check flow and loads in documents page", environments = {Environment.TST1, Environment.PPE})
    @JiraTestCase(id = "SC-T380")
    public void checkFlowAndLoadsDocument(Harness harness) {
        String ico = harness.getConfig("commercial.cb.ico");
        String note = "\n" + "Dne " + TestUtils.getTodayDate() + "  proběhl automatický test";
        CommercialTasks tasks = harness.tasks().ufo().cb();
        harness.store(JIRA_COMMENT_STORE_KEY, String.format("ICO: %s <br>", ico));
        harness.withUfo()
                .openLoginPage()
                .then(tasks.loginAsCbReader())
                .clickDocumentsLink()
                .checkOtherDocuments()
                .checkIC()
                .typeDetailForDocument(ico)
                .clickSearchDocuments()
                .checkDocument()
                .clickDocumentDetail()
                .checkElementNotes()
                .typeDocumentNotes(note)
                .clickSaveNotes();
    }
}
