-
Notifications
You must be signed in to change notification settings - Fork 120
/
SauceBindingsTest.java
36 lines (30 loc) · 1.06 KB
/
SauceBindingsTest.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
package com.saucedemo.selenium.testng.demo;
import com.saucelabs.saucebindings.SauceSession;
import com.saucelabs.saucebindings.options.SauceOptions;
import org.openqa.selenium.remote.RemoteWebDriver;
import org.testng.Assert;
import org.testng.ITestResult;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import java.lang.reflect.Method;
/** Example Tests for running with Sauce Bindings directly without test runner jar. */
public class SauceBindingsTest {
protected SauceSession session;
protected RemoteWebDriver driver;
@BeforeMethod
public void setup(Method method) {
SauceOptions options = SauceOptions.chrome().setName(method.getName()).build();
session = new SauceSession(options);
driver = session.start();
}
@Test
public void correctTitle() {
driver.navigate().to("https://www.saucedemo.com");
Assert.assertEquals("Swag Labs", driver.getTitle());
}
@AfterMethod
public void teardown(ITestResult result) {
session.stop(result.isSuccess());
}
}