package cz.moneta.test.regression.internal.forte;

import cz.moneta.test.dsl.Harness;
import cz.moneta.test.dsl.forte.components.ForteRoles;
import cz.moneta.test.harness.annotations.Environment;
import cz.moneta.test.harness.annotations.TestCase;
import cz.moneta.test.harness.annotations.TestScenarioWithOrder;
import org.junit.jupiter.api.Order;

@TestScenarioWithOrder(name = "Open MMB branch search and upload photo")
public class BranchesTest {

    @Order(1)
    @TestCase(name = "Searching MMB branch", environments = {Environment.TST1})
    public void findMmbBranches(Harness harness) { // TODO: hotovo
           harness.withForte()
                .openForteHomePage()
                .clickBranches()
                .selectRoleMenu(ForteRoles.USER_MODE)
                .clickMmbFindBranches()
                .fillBranchName("Brno")
                .clickSearch()
                .checkFoundBranchesTitle()
                .checkFoundBranchesElements("Brno");
    }

    @Order(2)
    @TestCase(name = "Upload MMB branch photo", environments = {Environment.TST1, Environment.DEV})
    public void uploadBranchPhoto(Harness harness) {
        String doc_path = "regression/forte/pobocka.jpg";

        harness.withForte()
                .openForteHomePage()
                .clickBranches()
                .selectRoleMenu(ForteRoles.ADMIN_RETAIL)
                .clickMmbBranchesList()
                .clickExportToExcel()
                .fillAddressFilter("Brno")
                .clickSubmitFilter()
                .clickFirstBranchDetail()
                .clickShowOnMap()
                .clickMmbBranchesList()
                .fillAddressFilter("Brno")
                .clickSubmitFilter()
                .clickFirstBranchDetail()
                .clickPhotoAdministration()
                .clickAddNewPhotoDocument()
                .fillRecordName("Testovací dokument")
                .uploadDocument(doc_path)
                .clickAddButton()
                .checkDocumentPresence("Testovací dokument")
                .clickRemoveLastDocument()
                .clickYes();
    }
}