|
|
@@ -1,11 +1,29 @@
|
|
1
|
1
|
package se.citerus.dddsample.acceptance.pages;
|
|
2
|
2
|
|
|
|
3
|
+import org.openqa.selenium.By;
|
|
3
|
4
|
import org.openqa.selenium.WebDriver;
|
|
|
5
|
+import org.openqa.selenium.WebElement;
|
|
4
|
6
|
|
|
5
|
7
|
import static org.junit.Assert.assertEquals;
|
|
|
8
|
+import static org.junit.Assert.assertTrue;
|
|
6
|
9
|
|
|
7
|
10
|
public class CustomerPage {
|
|
|
11
|
+ private final WebDriver driver;
|
|
|
12
|
+
|
|
8
|
13
|
public CustomerPage(WebDriver driver) {
|
|
|
14
|
+ this.driver = driver;
|
|
9
|
15
|
assertEquals("Tracking cargo", driver.getTitle());
|
|
10
|
16
|
}
|
|
|
17
|
+
|
|
|
18
|
+ public void trackCargoWithIdOf(String trackingId) {
|
|
|
19
|
+ WebElement element = driver.findElement(By.id("idInput"));
|
|
|
20
|
+ element.sendKeys(trackingId);
|
|
|
21
|
+ element.submit();
|
|
|
22
|
+
|
|
|
23
|
+ }
|
|
|
24
|
+
|
|
|
25
|
+ public void expectCargoLocation(String expectedLocation) {
|
|
|
26
|
+ WebElement cargoSummary = driver.findElement(By.cssSelector("#result h2"));
|
|
|
27
|
+ assertTrue(cargoSummary.getText().endsWith(expectedLocation));
|
|
|
28
|
+ }
|
|
11
|
29
|
}
|