2 * ============LICENSE_START=======================================================
\r
4 * ================================================================================
\r
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
\r
6 * ================================================================================
\r
7 * Licensed under the Apache License, Version 2.0 (the "License");
\r
8 * you may not use this file except in compliance with the License.
\r
9 * You may obtain a copy of the License at
\r
11 * http://www.apache.org/licenses/LICENSE-2.0
\r
13 * Unless required by applicable law or agreed to in writing, software
\r
14 * distributed under the License is distributed on an "AS IS" BASIS,
\r
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
16 * See the License for the specific language governing permissions and
\r
17 * limitations under the License.
\r
18 * ============LICENSE_END=========================================================
\r
21 package org.openecomp.ecomp.vid.selenium;
\r
23 import java.io.FileInputStream;
\r
24 import java.io.IOException;
\r
25 import java.io.InputStream;
\r
26 import java.util.List;
\r
27 import java.util.Properties;
\r
28 import java.util.concurrent.TimeUnit;
\r
30 import org.apache.log4j.Logger;
\r
31 import org.openqa.selenium.By;
\r
32 import org.openqa.selenium.WebDriver;
\r
33 import org.openqa.selenium.WebElement;
\r
34 import org.openqa.selenium.firefox.FirefoxDriver;
\r
35 import org.openqa.selenium.support.ui.Select;
\r
36 import org.testng.Assert;
\r
37 import org.testng.annotations.BeforeTest;
\r
38 import org.testng.annotations.Test;
\r
41 * The Class LogOutLeftPane.
\r
43 @Test(enabled=false)
\r
44 public class LogOutLeftPane {
\r
46 /** The login button. */
\r
47 WebElement loginButton;
\r
58 /** The errormessage. */
\r
59 WebElement errormessage;
\r
62 WebDriver driver=new FirefoxDriver();
\r
65 /** The config prop. */
\r
66 private final Properties configProp = new Properties();
\r
70 * Instantiates a new log out left pane.
\r
72 private LogOutLeftPane() {
\r
73 // TODO Auto-generated constructor stub
\r
76 // InputStream input =this.getClass().getClassLoader().getResourceAsStream("objectmap.properties");
\r
77 //FileInputStream input1 = new FileInputStream("objectmap.properties");
\r
79 InputStream input =new FileInputStream("objectconfig.properties");
\r
80 System.out.println("Read all properties from file");
\r
81 configProp.load(input);
\r
82 System.out.println("Read all properties from file completed");
\r
84 catch(IOException e) {
\r
86 e.printStackTrace();
\r
96 // TODO Auto-generated method stub
\r
98 public void doBeforeTest()
\r
100 //WebDriver driver=new FirefoxDriver();
\r
102 log = Logger.getLogger(LogOutLeftPane.class.getName());
\r
107 driver.get("http://vid.onap.org:9080/vid/login_external.htm");
\r
108 driver.manage().window().maximize();
\r
111 login = driver.findElement(By.xpath("//input[@class='fn-ebz-text ng-pristine ng-valid']"));
\r
112 pwd = driver.findElement(By.xpath("//input[@class='span3 ng-pristine ng-valid']"));
\r
113 loginButton = driver.findElement(By.id("loginBtn"));
\r
118 * Expand collapse panel.
\r
120 * @throws InterruptedException the interrupted exception
\r
123 public void expandCollapsePanel() throws InterruptedException
\r
129 login.sendKeys("su");
\r
131 pwd.sendKeys("fusion");
\r
132 //driver.findElement(By.partialLinkText("Click here to login")).click();
\r
133 //driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
\r
135 loginButton.click();
\r
136 driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
\r
139 log.info("Clicking Profile link from left pane");
\r
140 Thread.sleep(3000);
\r
141 System.out.println("properties file details --->"+configProp.getProperty("profilelink"));
\r
142 driver.findElement(By.xpath(configProp.getProperty("profilelink"))).click();
\r
143 Thread.sleep(3000);
\r
145 //Verify whether the sub panel is displayed
\r
146 //To verify the following :Search import from webphone and Self
\r
147 driver.findElement(By.xpath(".//*[@id='panel4']")).isDisplayed();
\r
148 log.info("Expand and collapse passed for Profile link");
\r
151 //Verify expand and collapse working for ADMIN
\r
152 log.info("Clicking Admin link from left pane");
\r
153 driver.findElement(By.xpath("html/body/div[1]/div[1]/div/div/div[2]/div/div/div[1]/div/div/accordion/div/div[6]/a/span")).click();
\r
154 //To verify the following: Roles, Roles Functions, Usages
\r
155 driver.findElement(By.xpath(".//*[@id='panel5']")).isDisplayed();
\r
158 log.info("Expand and collapse passed for ADMIN link");
\r
160 log.info("VID-11 TC-3 PASSED");
\r
168 * @throws InterruptedException the interrupted exception
\r
171 public void dropDownList() throws InterruptedException
\r
174 log.info("VID-12 TC-3");
\r
175 //driver.findElement(By.xpath(".//*[@id='mContent']/div/div/table/tbody/tr[1]/td[2]/div/select"));
\r
177 //driver.findElement(By.xpath(".//*[@id='mContent']/div/div/table/tbody/tr[2]/td[2]/div/select"));
\r
178 Thread.sleep(5000);
\r
180 //Infrastructure Subscriber Name
\r
181 Select oSelect = new Select(driver.findElement(By.xpath(".//*[@id='mContent']/div/div/table/tbody/tr[1]/td[2]/div/select")));
\r
182 Select iSelect = new Select(driver.findElement(By.xpath(".//*[@id='mContent']/div/div/table/tbody/tr[2]/td[2]/div/select")));
\r
184 List <WebElement> elementCount = oSelect.getOptions();
\r
185 log.info("Subscriber Name Drop Down");
\r
186 System.out.println(elementCount.size());
\r
187 oSelect.selectByIndex(1);
\r
188 log.info("Subscriber name selected");
\r
189 //String selectedOption = new Select(driver.findElement(By.xpath(".//*[@id='mContent']/div/div/table/tbody/tr[1]/td[2]/div/select"))).getFirstSelectedOption().getText();
\r
192 List <WebElement> count = iSelect.getOptions();
\r
193 log.info("Subscriber type drop down");
\r
194 System.out.println(count.size());
\r
195 oSelect.selectByIndex(1);
\r
196 log.info("Subscriber type selected");
\r
200 //Submit button is clicked
\r
201 driver.findElement(By.xpath(".//*[@id='mContent']/div/div/table/tbody/tr[3]/td/div/button")).click();
\r
204 //Verify whether the page header is displayed "Selected Subscriber's Service Instance Details:"
\r
205 driver.findElement(By.xpath(".//*[@id='mContent']/div/div/div/h1")).isDisplayed();
\r
206 log.info("VID-12 TC-3 PASSED");
\r
213 * Logout left pane.
\r
216 public void logoutLeftPane()
\r
218 //To Verify if the logout link redirects to Login page when clicked.
\r
221 /*log.info("----------------VID-11 TC-4----------------");
\r
223 login.sendKeys("testuser");
\r
225 pwd.sendKeys("abc123");
\r
226 //driver.findElement(By.partialLinkText("Click here to login")).click();
\r
227 //driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
\r
229 loginButton.click();
\r
230 driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);*/
\r
231 log.info("----------------VID-11 TC-4----------------");
\r
232 driver.findElement(By.xpath("html/body/div[1]/div[1]/div/div/div[2]/div/div/div[1]/div/div/accordion/div/div[7]/a")).click();
\r
233 //Validate that the user has logged out of VID. Displays "Portal"
\r
234 Assert.assertTrue(driver.getPageSource().contains("Portal"));
\r
236 log.info("VID 11 TC-4 PASSED");
\r