package cz.moneta.test.sanity.transactional.cards.ib;

import cz.moneta.test.dsl.Harness;
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 static cz.moneta.test.harness.annotations.Environment.*;


@TestScenario(name = "IB clickLogin type variations test")
public class CustomerLogin {

    @TestCase(name = "Login into IB as retail customer using Mobile Key", environments = {TST1, TST3, FVE, PPE})
    @JiraTestCase(id = "FVP-T1893")
    void retailCustomer_shouldLoginWithMobileKey(Harness harness, @Key("ib.client") Credentials client) {
        harness.withIB()
                .openLoginPage()
                .typeUsername(client.getUsername())
                .typePassword(client.getPassword())
                .clickLogin()
                .onAuthMobileKeyPage()
                .fillMobileKey("12341234")
                .clickLogin()
                .onWelcomePage()
                .checkWelcomePageImageIsPresent();
    }

    @TestCase(name = "Login into IB as commercial customer using Mobile Key", environments = {TST3, FVE, PPE})
    @JiraTestCase(id = "FVP-T1894")
    void commercialCustomer_shouldLoginWithMobileKey(Harness harness, @Key("ib.commercial.client") Credentials client) {
        harness.withIB()
                .openLoginPage()
                .typeUsername(client.getUsername())
                .typePassword(client.getPassword())
                .clickLogin()
                .onAuthMobileKeyPage()
                .fillMobileKey("12341234")
                .clickLogin()
                .onWelcomePage()
                .checkWelcomePageImageIsPresent();
    }
}
