aboutsummaryrefslogtreecommitdiffstats
path: root/vid-automation/src/main/java/vid/automation/test/sections/LoginExternalPage.java
blob: 7a13e4d1b48ce5ce1bdf51c37347a4b102fcf059 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package vid.automation.test.sections;

import org.onap.sdc.ci.tests.datatypes.UserCredentials;
import org.onap.sdc.ci.tests.utilities.GeneralUIUtils;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import static org.junit.Assert.*;


public class LoginExternalPage {


    static private final String SUCCESSFUL_LOGIN_STRING_SEARCH = "Welcome to VID";

    static void sendUserAndPasswordKeys(UserCredentials userCredentials) {
        WebElement loginIdInputElem = GeneralUIUtils.getWebElementBy(By.name("loginId"));
        loginIdInputElem.sendKeys(userCredentials.getUserId());
        WebElement passwordInputElem = GeneralUIUtils.getWebElementBy(By.name("password"));
        passwordInputElem.sendKeys(userCredentials.getPassword());
    }

    static public void performLoginExternal(UserCredentials userCredentials) {
        sendUserAndPasswordKeys(userCredentials);
        WebElement loginButton = GeneralUIUtils.getWebElementBy(By.id("loginBtn"), 30);
        loginButton.click();
        boolean isLoginSuccess = GeneralUIUtils.findAndWaitByText(SUCCESSFUL_LOGIN_STRING_SEARCH, 30);
        assertTrue(isLoginSuccess);
    }
}