Initial OpenECOMP SDC commit
[sdc.git] / ui-ci / src / main / java / org / openecomp / sdc / ci / tests / utilities / AdminWorkspaceUIUtilies.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * SDC
4  * ================================================================================
5  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6  * ================================================================================
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  * 
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  * 
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  * ============LICENSE_END=========================================================
19  */
20
21 package org.openecomp.sdc.ci.tests.utilities;
22
23 import org.junit.rules.TestName;
24 import org.openqa.selenium.WebDriver;
25 import org.openqa.selenium.support.ui.Select;
26
27 public class AdminWorkspaceUIUtilies {
28
29         public AdminWorkspaceUIUtilies(TestName name, String className) {
30                 super();
31                 // TODO Auto-generated constructor stub
32         }
33
34         protected static WebDriver driver;
35
36         public static void deleteuser(String userId) throws Exception {
37                 typeToSearchBox(userId);
38                 if (GeneralUIUtils.getWebElements("tdRow") != null) {
39                         GeneralUIUtils.getWebElementWaitForVisible("delete" + userId + "").click();
40                         GeneralUIUtils.clickOkButton();
41                 }
42         }
43
44         public static String defineNewUserId(String userId) {
45                 GeneralUIUtils.getWebElementWaitForVisible("newUserId").clear();
46                 GeneralUIUtils.getWebElementWaitForVisible("newUserId").sendKeys(userId);
47                 ;
48                 return userId;
49         }
50
51         public static String defineNewMacUid(String MacUid) {
52                 GeneralUIUtils.getWebElementWaitForVisible("newUserId").clear();
53                 GeneralUIUtils.getWebElementWaitForVisible("newUserId").sendKeys(MacUid);
54                 ;
55                 return MacUid;
56         }
57
58         public static String selectUserRole(String Role) {
59                 Select selectrole = new Select(GeneralUIUtils.getWebElementWaitForVisible("selectrole"));
60                 selectrole.deselectByVisibleText(Role);
61                 selectrole.selectByVisibleText(Role);
62                 return Role;
63         }
64
65         public static void typeToSearchBox(String Text) throws Exception {
66                 GeneralUIUtils.getWebElementWaitForVisible("searchbox").clear();
67                 GeneralUIUtils.getWebElementWaitForVisible("searchbox").sendKeys(Text);
68                 Thread.sleep(1000);
69         }
70
71 }