-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathBaseTest.java
59 lines (46 loc) · 1.43 KB
/
BaseTest.java
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
package TestCases;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.testng.Assert;
import org.testng.annotations.AfterClass;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeMethod;
import Global.ObjectRepo;
public class BaseTest {
public WebDriver driver;
@BeforeClass
public void beforeClass(){
String baseDIRPath = System.getProperty("user.dir");
String FirefoxServerPath = baseDIRPath + "\\lib\\chromedriver.exe";
System.setProperty("webdriver.chrome.driver", FirefoxServerPath);
driver = new ChromeDriver();
driver.manage().window().maximize();
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
}
@BeforeMethod
public void beforeMethod(){
//driver.get(ObjectRepo.spotifyLandigUrl);
//driver.get(ObjectRepo.youTubeUrl);
driver.get(ObjectRepo.spotifyLoginUrl);
System.out.println(driver.getCurrentUrl());
driver.getTitle();
//Sign In page validation
String URL = driver.getCurrentUrl();
Assert.assertEquals(URL, ObjectRepo.spotifyLoginUrl, "This is login page!" );
}
@AfterMethod
public void afterTest(){
System.out.println("Method is passing");
}
@AfterClass
public void afterClass(){
driver.quit();
}
public static void sleepTest(long sleeptime){
try{Thread.sleep(sleeptime);
}catch (Exception e){
}
}
}