forked from saucelabs-training/demo-java
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSauceConnectTest.java
34 lines (29 loc) · 1.13 KB
/
SauceConnectTest.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
package com.saucedemo;
import com.saucelabs.saucebindings.SauceOptions;
import com.saucelabs.saucebindings.SauceSession;
import org.junit.After;
import org.junit.Test;
import org.openqa.selenium.WebDriver;
import static org.junit.Assert.assertEquals;
public class SauceConnectTest {
protected WebDriver driver;
private SauceSession session;
@Test
public void shouldOpen() {
SauceOptions options = new SauceOptions();
// When we start a tunnel, we provide a tunnedIdentifier using the '-i' flag
// And we can reference that tunnel here
options.setTunnelIdentifier("NikolaysTunnel");
options.setName("sauceConnectTest");
session = new SauceSession(options);
driver = session.start();
// This is an example of an application that Sauce Labs cannot get to because it's in your internal network
// In order for Sauce to be able to Securely access your application, we use Sauce Connect
driver.get("http://localhost:3000");
assertEquals("React App", driver.getTitle());
}
@After
public void teardown() {
session.stop(true);
}
}