<repo_name>tanjum88/Project1<file_sep>/src/script/ValidLogin.java
package script;

import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
import org.testng.Assert;
import org.testng.annotations.Test;

import generic.BaseTest;
import generic.FWUtility;
import page.EnterTimeTractPage;
import page.LoginPage;

public class ValidLogin extends BaseTest{
@Test(priority=1)

public void testValidLogin() throws InterruptedException {
String un=FWUtility.getXlData(XL_PATH, "ValidLogin", 1, 0);
String pw= FWUtility.getXlData(XL_PATH, "ValidLogin", 1, 1);
String title=FWUtility.getXlData(XL_PATH, "ValidLogin", 1, 2);

//Enter Valid Username
LoginPage l= new LoginPage(driver);
l.setUserName(un);
//enter password
l.setPassword(pw);
//click on login button
l.clickLogin();
//verify homepage is displayed
EnterTimeTractPage e=new EnterTimeTractPage(driver);
e.verifyHomePageIsDisplayed(driver, ETO, title);
}

}
<file_sep>/src/generic/FWUtility.java
package generic;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import org.apache.commons.io.FileUtils;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.ss.usermodel.WorkbookFactory;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.OutputType;
import org.openqa.selenium.TakesScreenshot;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;

public class FWUtility {
	public static String getXlData(String path, String sheet, int r, int c) {
		String v="";
		try {
			Workbook wb= WorkbookFactory.create(new FileInputStream(path));
			v=wb.getSheet(sheet).getRow(r).getCell(c).toString();
		}
		catch(Exception e) {
			//e.printStackTrace();
		}
		return v;	
	}
	public static int getXlRowCount(String path, String sheet) {
		int count= 0;
		try {
			Workbook wb= WorkbookFactory.create(new FileInputStream(path));
			count=wb.getSheet(sheet).getLastRowNum();
		}catch(Exception e) {
			e.printStackTrace();
		}
		return count;
	}

	public static void writeDataToXL(String path,String sheet,int r, int c,int v) {
		try {
			Workbook wb= WorkbookFactory.create(new FileInputStream(path));
			wb.getSheet(sheet).getRow(r).getCell(c).setCellValue(v);
			wb.write(new FileOutputStream(path) {
			});
		}catch(Exception e) {
			e.printStackTrace();
		}
	}
	public static void getPhoto(WebDriver driver, String path) {

		try {
			TakesScreenshot t= (TakesScreenshot)driver;
			File srcFile = t.getScreenshotAs(OutputType.FILE);
			File destFile=new File(path);
			FileUtils.copyFile(srcFile, destFile);
		}catch(Exception e) {
			e.printStackTrace();
		}
	}
	
	public static void scroll(WebElement element,WebElement eleHead, WebDriver driver) {
		int x=element.getLocation().getX();
		int y=element.getLocation().getY();
		int height=eleHead.getSize().getHeight();
		y=y-height;
		//Now Type-cast
		JavascriptExecutor js=(JavascriptExecutor)driver;
		js.executeScript("window.scrollTo("+x+","+y+")");
	}
	
}
<file_sep>/src/script/CheckProductEdition.java
package script;

import org.testng.annotations.Test;

import generic.BaseTest;
import generic.FWUtility;
import page.EnterTimeTractPage;
import page.LicensePage;
import page.LoginPage;

public class CheckProductEdition extends BaseTest {
	
	@Test(priority=4)
	
	public void testCheckProductEdition() throws Exception{
		String un = FWUtility.getXlData(XL_PATH, "CheckProductEdition", 1, 0);
		String pw = FWUtility.getXlData(XL_PATH, "CheckProductEdition", 1, 1);
		String productEdition = FWUtility.getXlData(XL_PATH, "CheckProductEdition", 1, 2);
		
	//Enter valid UserName
		LoginPage l=new LoginPage(driver);
		l.setUserName(un);
	//Enter Valid Password
		l.setPassword(pw);
	//ClickLogin 
		l.clickLogin();
		Thread.sleep(2000);
	//clickSettings
	EnterTimeTractPage e= new EnterTimeTractPage(driver);
	e.clickSettings();
	e.clickLicenses();
	
	//verify Issue Date
	LicensePage c= new LicensePage(driver);
	c.verifyProductEdition(productEdition);
	
	//click Logout
	c.clickLogout();
	
	}

}
<file_sep>/test-output/old/Suite/methods.html
<h2>Methods run, sorted chronologically</h2><h3>&gt;&gt; means before, &lt;&lt; means after</h3><p/><br/><em>Suite</em><p/><small><i>(Hover the method name to see the test class name)</i></small><p/>
<table border="1">
<tr><th>Time</th><th>Delta (ms)</th><th>Suite<br>configuration</th><th>Test<br>configuration</th><th>Class<br>configuration</th><th>Groups<br>configuration</th><th>Method<br>configuration</th><th>Test<br>method</th><th>Thread</th><th>Instances</th></tr>
<tr bgcolor="d2dae5">  <td>18/12/06 20:00:11</td>   <td>0</td> <td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td title="&gt;&gt;BaseTest.openBrowser()[pri:0, instance:script.ValidLogin@52feb982]">&gt;&gt;openBrowser</td> 
<td>&nbsp;</td>  <td>main@1630521067</td>   <td></td> </tr>
<tr bgcolor="ba7b69">  <td>18/12/06 20:00:16</td>   <td>5356</td> <td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td title="ValidLogin.testValidLogin()[pri:1, instance:script.ValidLogin@52feb982]">testValidLogin</td> 
  <td>main@1630521067</td>   <td></td> </tr>
<tr bgcolor="d2dae5">  <td>18/12/06 20:00:18</td>   <td>7174</td> <td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td title="&lt;&lt;BaseTest.closeBrowser(org.testng.ITestResult)[pri:0, instance:script.ValidLogin@52feb982]">&lt;&lt;closeBrowser</td> 
<td>&nbsp;</td>  <td>main@1630521067</td>   <td></td> </tr>
<tr bgcolor="d2dae5">  <td>18/12/06 20:00:21</td>   <td>9523</td> <td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td title="&gt;&gt;BaseTest.openBrowser()[pri:0, instance:script.TestInvalidLogin@34c4973]">&gt;&gt;openBrowser</td> 
<td>&nbsp;</td>  <td>main@1630521067</td>   <td></td> </tr>
<tr bgcolor="81ad78">  <td>18/12/06 20:00:26</td>   <td>14516</td> <td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td title="TestInvalidLogin.testInvalidLogin()[pri:2, instance:script.TestInvalidLogin@34c4973]">testInvalidLogin</td> 
  <td>main@1630521067</td>   <td></td> </tr>
<tr bgcolor="d2dae5">  <td>18/12/06 20:00:28</td>   <td>17070</td> <td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td title="&lt;&lt;BaseTest.closeBrowser(org.testng.ITestResult)[pri:0, instance:script.TestInvalidLogin@34c4973]">&lt;&lt;closeBrowser</td> 
<td>&nbsp;</td>  <td>main@1630521067</td>   <td></td> </tr>
<tr bgcolor="d2dae5">  <td>18/12/06 20:00:31</td>   <td>19737</td> <td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td title="&gt;&gt;BaseTest.openBrowser()[pri:0, instance:script.CheckIssueDate@30a3107a]">&gt;&gt;openBrowser</td> 
<td>&nbsp;</td>  <td>main@1630521067</td>   <td></td> </tr>
<tr bgcolor="e69ade">  <td>18/12/06 20:00:36</td>   <td>25076</td> <td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td title="CheckIssueDate.testCheckIssueDate()[pri:3, instance:script.CheckIssueDate@30a3107a]">testCheckIssueDate</td> 
  <td>main@1630521067</td>   <td></td> </tr>
<tr bgcolor="d2dae5">  <td>18/12/06 20:00:49</td>   <td>37508</td> <td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td title="&lt;&lt;BaseTest.closeBrowser(org.testng.ITestResult)[pri:0, instance:script.CheckIssueDate@30a3107a]">&lt;&lt;closeBrowser</td> 
<td>&nbsp;</td>  <td>main@1630521067</td>   <td></td> </tr>
<tr bgcolor="d2dae5">  <td>18/12/06 20:00:51</td>   <td>39875</td> <td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td title="&gt;&gt;BaseTest.openBrowser()[pri:0, instance:script.CheckProductEdition@33c7e1bb]">&gt;&gt;openBrowser</td> 
<td>&nbsp;</td>  <td>main@1630521067</td>   <td></td> </tr>
<tr bgcolor="6694f1">  <td>18/12/06 20:00:56</td>   <td>44802</td> <td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td title="CheckProductEdition.testCheckProductEdition()[pri:4, instance:script.CheckProductEdition@33c7e1bb]">testCheckProductEdition</td> 
  <td>main@1630521067</td>   <td></td> </tr>
<tr bgcolor="d2dae5">  <td>18/12/06 20:01:00</td>   <td>48396</td> <td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td title="&lt;&lt;BaseTest.closeBrowser(org.testng.ITestResult)[pri:0, instance:script.CheckProductEdition@33c7e1bb]">&lt;&lt;closeBrowser</td> 
<td>&nbsp;</td>  <td>main@1630521067</td>   <td></td> </tr>
<tr bgcolor="d2dae5">  <td>18/12/06 20:01:02</td>   <td>50837</td> <td title="&lt;&lt;BaseTest.print()[pri:0, instance:script.CheckIssueDate@30a3107a]">&lt;&lt;print</td> 
<td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td>  <td>main@1630521067</td>   <td></td> </tr>
</table>
