-
Notifications
You must be signed in to change notification settings - Fork 63
Expand file tree
/
Copy pathBaseTest.java
More file actions
54 lines (43 loc) · 1.35 KB
/
BaseTest.java
File metadata and controls
54 lines (43 loc) · 1.35 KB
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
package tests;
import org.openqa.selenium.Proxy;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.firefox.FirefoxOptions;
import org.testng.ITestContext;
import org.testng.ITestResult;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.BeforeSuite;
import pages.HomePage;
import utils.logs.Log;
public class BaseTest {
private WebDriver driver;
public HomePage homePage;
public WebDriver getDriver() {
return driver;
}
@BeforeSuite
public void setupProxy(ITestContext iTestContext) {
}
@BeforeClass
public void classLevelSetup(ITestContext iTestContext) {
Log.info("Tests is starting!");
FirefoxOptions firefoxOptions = new FirefoxOptions();
Proxy proxy = new Proxy();
proxy.setAutodetect(false);
proxy.setNoProxy("no_proxy-var");
firefoxOptions.setCapability("proxy", proxy);
driver = new FirefoxDriver(firefoxOptions);
iTestContext.setAttribute("WebDriver", driver);
}
@BeforeMethod
public void methodLevelSetup() {
homePage = new HomePage(driver);
}
@AfterClass
public void teardown() {
Log.info("Tests are ending!");
driver.quit();
}
}