-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathSampleTest.java
More file actions
32 lines (31 loc) · 1.06 KB
/
SampleTest.java
File metadata and controls
32 lines (31 loc) · 1.06 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
import com.google.gson.JsonObject;
import com.microsoft.playwright.Locator;
import com.microsoft.playwright.Page;
import com.tngtech.java.junit.dataprovider.DataProviderRunner;
import com.tngtech.java.junit.dataprovider.UseDataProvider;
import org.junit.Test;
import org.junit.runner.RunWith;
@RunWith(DataProviderRunner.class)
public class SampleTest extends BaseTest{
@Test
@UseDataProvider(value = "getDefaultTestCapability",location = LTCapability.class)
public void sampleTest1(JsonObject capability) {
Driver driver;
Page page = null;
try {
driver = super.createConnection(capability);
page = driver.getPage();
page.navigate("http://whatsmyuseragent.org/");
page.waitForTimeout(5000);
if(page.title().equalsIgnoreCase("Whatsmyuseragent.org")){
super.setTestStatus("passed","Title matched",page);
} else {
super.setTestStatus("failed","Title not matched",page);
}
super.closeConnection(driver);
} catch (Exception e) {
e.printStackTrace();
super.setTestStatus("failed",e.getMessage(),page);
}
}
}