-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBuildTest.java
More file actions
122 lines (86 loc) · 3.44 KB
/
BuildTest.java
File metadata and controls
122 lines (86 loc) · 3.44 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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
package com.build.qa.build.selenium.tests;
import org.junit.Test;
import com.build.qa.build.selenium.framework.BaseFramework;
import com.build.qa.build.selenium.pageobjects.homepage.HomePage;
public class BuildTest extends BaseFramework {
Cart cart;
/**
* Extremely basic test that outlines some basic
* functionality and page objects as well as assertJ
* Testing upload to Git
*/
@Test
public void navigateToHomePage() {
driver.get(getConfiguration("HOMEPAGE"));
HomePage homePage = new HomePage(driver, wait);
softly.assertThat(homePage.onBuildTheme())
.as("The website should load up with the Build.com desktop theme.")
.isTrue();
}
/**
* Search for the Quoizel MY1613 from the search bar
* @assert: That the product page we land on is what is expected by checking the product title
*/
@Test
public void searchForProductLandsOnCorrectProduct() {
// TODO: Implement this test
driver.get(getConfiguration("SEARCHBAR"));
SearchBar search = new SearchBar(driver, wait);
softly.asserThat(search.searchFor("Quoizel MY1613").getTitle())
.as("Quoizel MY1613ML Malaga Monterey Mosaic 3 Light 16" Wide Flush Mount Ceiling Fixture with Pen Shell Mosaic Shade")
.isEqual();
}
/**
* Go to the Bathroom Sinks category directly (https://www.build.com/bathroom-sinks/c108504)
* and add the second product on the search results (Category Drop) page to the cart.
* @assert: the product that is added to the cart is what is expected
*/
@Test
public void addProductToCartFromCategoryDrop() {
// TODO: Implement this test
driver.get("https://www.build.com/bathroom-sinks/c108504");
SearchResults results = new SearchResults(driver, wait);
Product prod = results.getProductByIndex(1);
Cart cart = new Cart(driver, wait);
cart.addProduct(prod);
softly.asserThat(cart.getProduct(prodc))
.as("Second Product name")
.isTrue();
}
/**
* Add a product to the cart and email the cart to yourself, also to my email address: chanelnalani@gmail.com
* Include this message in the "message field" of the email form: "This is {yourName}, sending you a cart from my automation!"
* @assert that the "Cart Sent" success message is displayed after emailing the cart
*/
@Test
public void addProductToCartAndEmailIt() {
// TODO: Implement this test
addProductToCartSteps();
Email email = new Email();
email.setTo("myemail@gmail.com");
email.setCC("chanelnalani@gmail.com");
email.setSubject("Cart details");
email.setMessage("This is Umar, sending you a cart from my automation!")
cart.sendEmail(email);
softly.asserThat(cart.getEmailMessageStatus)
.as("Cart Sent")
.isEqual();
}
/**
* Go to a category drop page (such as Bathroom Faucets) and narrow by
* at least two filters (facets), e.g: Finish=Chromes and Theme=Modern
* @assert that the correct filters are being narrowed, and the result count
* is correct, such that each facet selection is narrowing the product count.
*/
@Test
public void facetNarrowBysResultInCorrectProductCounts() {
// TODO: Implement this test
}
private void addProductToCartSteps(){
driver.get("https://www.build.com/bathroom-sinks/c108504");
SearchResults results = new SearchResults(driver, wait);
Product prod = results.getProductByIndex(1);
cart = new Cart(driver, wait);
cart.addProduct(prod);
}
}