-
Notifications
You must be signed in to change notification settings - Fork 61
Expand file tree
/
Copy pathAcceptanceTestDrivenAutomationTest.java
More file actions
37 lines (33 loc) · 1.25 KB
/
AcceptanceTestDrivenAutomationTest.java
File metadata and controls
37 lines (33 loc) · 1.25 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
package atda;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
@RunWith(Parameterized.class)
public class AcceptanceTestDrivenAutomationTest extends BaseTest {
@Test
public void shouldLogin() {
LoginPage loginPage = new LoginPage(driver);
loginPage.open();
//I used to do this, now I learned it's not necessary
//assertTrue("Login page should load successfully", loginPage.isLoaded());
loginPage.login("standard_user", "secret_sauce");
assertTrue("Products page should open when we login", new ProductsPage(driver).isLoaded());
}
@Test
public void shouldAddOneItemToCart() {
ProductsPage productsPage = new ProductsPage(driver);
productsPage.open();
productsPage.addItemToCart();
assertEquals("1", productsPage.getCountOfItemsInCart());
}
@Test
public void shouldAddTwoItemsToCart() {
ProductsPage productsPage = new ProductsPage(driver);
productsPage.open();
productsPage.addItemToCart();
productsPage.addItemToCart();
assertEquals("2", productsPage.getCountOfItemsInCart());
}
}