org.onap migration
[vid.git] / vid-automation / src / main / java / vid / automation / test / sections / LoginExternalPage.java
1 package vid.automation.test.sections;
2
3 import org.openecomp.sdc.ci.tests.datatypes.UserCredentials;
4 import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
5 import org.openqa.selenium.By;
6 import org.openqa.selenium.WebElement;
7 import static org.junit.Assert.*;
8
9
10 public class LoginExternalPage {
11
12
13     static private final String SUCCESSFUL_LOGIN_STRING_SEARCH = "Welcome to VID";
14
15     static void sendUserAndPasswordKeys(UserCredentials userCredentials) {
16         WebElement loginIdInputElem = GeneralUIUtils.getWebElementBy(By.name("loginId"));
17         loginIdInputElem.sendKeys(userCredentials.getUserId());
18         WebElement passwordInputElem = GeneralUIUtils.getWebElementBy(By.name("password"));
19         passwordInputElem.sendKeys(userCredentials.getPassword());
20     }
21
22     static public void performLoginExternal(UserCredentials userCredentials) {
23         sendUserAndPasswordKeys(userCredentials);
24         WebElement loginButton = GeneralUIUtils.getWebElementBy(By.id("loginBtn"), 30);
25         loginButton.click();
26         boolean isLoginSuccess = GeneralUIUtils.findAndWaitByText(SUCCESSFUL_LOGIN_STRING_SEARCH, 30);
27         assertTrue(isLoginSuccess);
28     }
29 }