-
Notifications
You must be signed in to change notification settings - Fork 125
/
Copy pathDesktopTests.java
40 lines (34 loc) · 1.12 KB
/
DesktopTests.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
package com.saucedemo.tests;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import com.saucedemo.pages.LoginPage;
import com.saucedemo.pages.ProductsPage;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.openqa.selenium.TimeoutException;
/** Desktop Tests. */
@RunWith(Parameterized.class)
public class DesktopTests extends BaseTest {
@Test()
public void loginWorks() {
LoginPage loginPage = new LoginPage(driver);
loginPage.visit();
loginPage.login("standard_user");
assertTrue(new ProductsPage(driver).isDisplayed());
}
@Test(expected = TimeoutException.class)
public void lockedOutUser() {
LoginPage loginPage = new LoginPage(driver);
loginPage.visit();
loginPage.login("locked_out_user");
assertFalse(new ProductsPage(driver).isDisplayed());
}
@Test(expected = TimeoutException.class)
public void invalidCredentials() {
LoginPage loginPage = new LoginPage(driver);
loginPage.visit();
loginPage.login("foo_bar_user");
assertFalse(new ProductsPage(driver).isDisplayed());
}
}