// Path: src/test/java/se/citerus/dddsample/acceptance/pages/AdminPage.java
// public class AdminPage {
//     private final WebDriver driver;
// 
//     public AdminPage(WebDriver driver) {
//         this.driver = driver;
//         driver.get("http://localhost:8080/dddsample/admin/list");
//         assertEquals("Cargo Administration", driver.getTitle());
//     }
// 
//     public void listAllCargo() {
//         driver.findElement(By.linkText("List all cargos")).click();
//         assertEquals("Cargo Administration", driver.getTitle());
//     }
// 
//     public CargoBookingPage bookNewCargo() {
//         driver.findElement(By.linkText("Book new cargo")).click();
// 
//         return new CargoBookingPage(driver);
//     }
// 
//     public boolean listedCargoContains(String expectedTrackingId) {
//         List<WebElement> cargoList = driver.findElements(By.cssSelector("#body table tbody tr td a"));
//         Optional<WebElement> matchingCargo = cargoList.stream().filter(cargo -> cargo.getText().equals(expectedTrackingId)).findFirst();
//         return matchingCargo.isPresent();
//     }
// 
//     public CargoDetailsPage showDetailsFor(String cargoTrackingId) {
//         driver.findElement(By.linkText(cargoTrackingId)).click();
// 
//         return new CargoDetailsPage(driver);
//     }
// }
// 
// Path: src/test/java/se/citerus/dddsample/acceptance/pages/CargoBookingPage.java
// public class CargoBookingPage {
// 
//     private final WebDriver driver;
// 
//     public CargoBookingPage(WebDriver driver) {
//         this.driver = driver;
// 
//         WebElement newCargoTableCaption = driver.findElement(By.cssSelector("table caption"));
// 
//         assertEquals("Book new cargo", newCargoTableCaption.getText());
//     }
// 
//     public void selectOrigin(String origin) {
//         Select select = new Select(driver.findElement(By.name("originUnlocode")));
//         select.selectByVisibleText(origin);
//     }
// 
//     public void selectDestination(String destination) {
//         Select select = new Select(driver.findElement(By.name("destinationUnlocode")));
//         select.selectByVisibleText(destination);
//     }
// 
//     public CargoDetailsPage book() {
//         driver.findElement(By.name("originUnlocode")).submit();
// 
//         return new CargoDetailsPage(driver);
//     }
// 
//     public void selectArrivalDeadline(LocalDate arrivalDeadline) {
//         WebElement datePicker = driver.findElement(By.id("arrivalDeadline"));
//         datePicker.clear();
//         datePicker.sendKeys(arrivalDeadline.format(DateTimeFormatter.ofPattern("dd/MM/yyyy")));
//     }
// }
// 
// Path: src/test/java/se/citerus/dddsample/acceptance/pages/CargoDestinationPage.java
// public class CargoDestinationPage {
//     private final WebDriver driver;
// 
//     public CargoDestinationPage(WebDriver driver) {
//         this.driver = driver;
//         WebElement cargoDestinationHeader = driver.findElement(By.cssSelector("table caption"));
// 
//         assertTrue(cargoDestinationHeader.getText().startsWith("Change destination for cargo "));
//     }
// 
//     public CargoDetailsPage selectDestinationTo(String destination) {
//         WebElement destinationPicker = driver.findElement(By.name("unlocode"));
//         Select select = new Select(destinationPicker);
//         select.selectByVisibleText(destination);
// 
//         destinationPicker.submit();
// 
//         return new CargoDetailsPage(driver);
//     }
// }
// 
// Path: src/test/java/se/citerus/dddsample/acceptance/pages/CargoDetailsPage.java
// public class CargoDetailsPage {
//     public static final String TRACKING_ID_HEADER = "Details for cargo ";
//     private final WebDriver driver;
//     private String trackingId;
// 
//     public CargoDetailsPage(WebDriver driver) {
//         this.driver = driver;
// 
//         WebElement newCargoTableCaption = driver.findElement(By.cssSelector("table caption"));
// 
//         assertTrue(newCargoTableCaption.getText().startsWith(TRACKING_ID_HEADER));
//         trackingId = newCargoTableCaption.getText().replaceFirst(TRACKING_ID_HEADER, "");
//     }
// 
//     public String getTrackingId() {
//         return trackingId;
//     }
// 
//     public AdminPage listAllCargo() {
//         driver.findElement(By.linkText("List all cargos")).click();
// 
//         return new AdminPage(driver);
//     }
// 
//     public void expectOriginOf(String expectedOrigin) {
//         String actualOrigin = driver.findElement(By.xpath("//div[@id='container']/table/tbody/tr[1]/td[2]")).getText();
// 
//         assertEquals(expectedOrigin, actualOrigin);
//     }
// 
//     public void expectDestinationOf(String expectedDestination) {
//         String actualDestination = driver.findElement(By.xpath("//div[@id='container']/table/tbody/tr[2]/td[2]")).getText();
// 
//         assertEquals(expectedDestination, actualDestination);
//     }
// 
//     public CargoDestinationPage changeDestination() {
//         driver.findElement(By.linkText("Change destination")).click();
// 
//         return new CargoDestinationPage(driver);
//     }
// 
//     public void expectArrivalDeadlineOf(LocalDate expectedArrivalDeadline) {
//         String actualArrivalDeadline = driver.findElement(By.xpath("//div[@id='container']/table/tbody/tr[4]/td[2]")).getText();
// 
//         assertEquals(expectedArrivalDeadline.format(DateTimeFormatter.ofPattern("dd/MM/yyyy")), actualArrivalDeadline);
//     }
// }


import org.junit.Test;
import se.citerus.dddsample.acceptance.pages.AdminPage;
import se.citerus.dddsample.acceptance.pages.CargoBookingPage;
import se.citerus.dddsample.acceptance.pages.CargoDestinationPage;
import se.citerus.dddsample.acceptance.pages.CargoDetailsPage;
import java.time.LocalDate;
import java.time.temporal.ChronoUnit;
import static junit.framework.TestCase.assertTrue;
package se.citerus.dddsample.acceptance;




public class AdminAcceptanceTest extends AbstractAcceptanceTest {

    @Test
    public void adminSiteCargoListContainsCannedCargo() {
// Path: src/test/java/se/citerus/dddsample/acceptance/pages/AdminPage.java
// public class AdminPage {
//     private final WebDriver driver;
// 
//     public AdminPage(WebDriver driver) {
//         this.driver = driver;
//         driver.get("http://localhost:8080/dddsample/admin/list");
//         assertEquals("Cargo Administration", driver.getTitle());
//     }
// 
//     public void listAllCargo() {
//         driver.findElement(By.linkText("List all cargos")).click();
//         assertEquals("Cargo Administration", driver.getTitle());
//     }
// 
//     public CargoBookingPage bookNewCargo() {
//         driver.findElement(By.linkText("Book new cargo")).click();
// 
//         return new CargoBookingPage(driver);
//     }
// 
//     public boolean listedCargoContains(String expectedTrackingId) {
//         List<WebElement> cargoList = driver.findElements(By.cssSelector("#body table tbody tr td a"));
//         Optional<WebElement> matchingCargo = cargoList.stream().filter(cargo -> cargo.getText().equals(expectedTrackingId)).findFirst();
//         return matchingCargo.isPresent();
//     }
// 
//     public CargoDetailsPage showDetailsFor(String cargoTrackingId) {
//         driver.findElement(By.linkText(cargoTrackingId)).click();
// 
//         return new CargoDetailsPage(driver);
//     }
// }
// 
// Path: src/test/java/se/citerus/dddsample/acceptance/pages/CargoBookingPage.java
// public class CargoBookingPage {
// 
//     private final WebDriver driver;
// 
//     public CargoBookingPage(WebDriver driver) {
//         this.driver = driver;
// 
//         WebElement newCargoTableCaption = driver.findElement(By.cssSelector("table caption"));
// 
//         assertEquals("Book new cargo", newCargoTableCaption.getText());
//     }
// 
//     public void selectOrigin(String origin) {
//         Select select = new Select(driver.findElement(By.name("originUnlocode")));
//         select.selectByVisibleText(origin);
//     }
// 
//     public void selectDestination(String destination) {
//         Select select = new Select(driver.findElement(By.name("destinationUnlocode")));
//         select.selectByVisibleText(destination);
//     }
// 
//     public CargoDetailsPage book() {
//         driver.findElement(By.name("originUnlocode")).submit();
// 
//         return new CargoDetailsPage(driver);
//     }
// 
//     public void selectArrivalDeadline(LocalDate arrivalDeadline) {
//         WebElement datePicker = driver.findElement(By.id("arrivalDeadline"));
//         datePicker.clear();
//         datePicker.sendKeys(arrivalDeadline.format(DateTimeFormatter.ofPattern("dd/MM/yyyy")));
//     }
// }
// 
// Path: src/test/java/se/citerus/dddsample/acceptance/pages/CargoDestinationPage.java
// public class CargoDestinationPage {
//     private final WebDriver driver;
// 
//     public CargoDestinationPage(WebDriver driver) {
//         this.driver = driver;
//         WebElement cargoDestinationHeader = driver.findElement(By.cssSelector("table caption"));
// 
//         assertTrue(cargoDestinationHeader.getText().startsWith("Change destination for cargo "));
//     }
// 
//     public CargoDetailsPage selectDestinationTo(String destination) {
//         WebElement destinationPicker = driver.findElement(By.name("unlocode"));
//         Select select = new Select(destinationPicker);
//         select.selectByVisibleText(destination);
// 
//         destinationPicker.submit();
// 
//         return new CargoDetailsPage(driver);
//     }
// }
// 
// Path: src/test/java/se/citerus/dddsample/acceptance/pages/CargoDetailsPage.java
// public class CargoDetailsPage {
//     public static final String TRACKING_ID_HEADER = "Details for cargo ";
//     private final WebDriver driver;
//     private String trackingId;
// 
//     public CargoDetailsPage(WebDriver driver) {
//         this.driver = driver;
// 
//         WebElement newCargoTableCaption = driver.findElement(By.cssSelector("table caption"));
// 
//         assertTrue(newCargoTableCaption.getText().startsWith(TRACKING_ID_HEADER));
//         trackingId = newCargoTableCaption.getText().replaceFirst(TRACKING_ID_HEADER, "");
//     }
// 
//     public String getTrackingId() {
//         return trackingId;
//     }
// 
//     public AdminPage listAllCargo() {
//         driver.findElement(By.linkText("List all cargos")).click();
// 
//         return new AdminPage(driver);
//     }
// 
//     public void expectOriginOf(String expectedOrigin) {
//         String actualOrigin = driver.findElement(By.xpath("//div[@id='container']/table/tbody/tr[1]/td[2]")).getText();
// 
//         assertEquals(expectedOrigin, actualOrigin);
//     }
// 
//     public void expectDestinationOf(String expectedDestination) {
//         String actualDestination = driver.findElement(By.xpath("//div[@id='container']/table/tbody/tr[2]/td[2]")).getText();
// 
//         assertEquals(expectedDestination, actualDestination);
//     }
// 
//     public CargoDestinationPage changeDestination() {
//         driver.findElement(By.linkText("Change destination")).click();
// 
//         return new CargoDestinationPage(driver);
//     }
// 
//     public void expectArrivalDeadlineOf(LocalDate expectedArrivalDeadline) {
//         String actualArrivalDeadline = driver.findElement(By.xpath("//div[@id='container']/table/tbody/tr[4]/td[2]")).getText();
// 
//         assertEquals(expectedArrivalDeadline.format(DateTimeFormatter.ofPattern("dd/MM/yyyy")), actualArrivalDeadline);
//     }
// }


// Path: src/test/java/se/citerus/dddsample/acceptance/AdminAcceptanceTest.java
import org.junit.Test;
import se.citerus.dddsample.acceptance.pages.AdminPage;
import se.citerus.dddsample.acceptance.pages.CargoBookingPage;
import se.citerus.dddsample.acceptance.pages.CargoDestinationPage;
import se.citerus.dddsample.acceptance.pages.CargoDetailsPage;
import java.time.LocalDate;
import java.time.temporal.ChronoUnit;
import static junit.framework.TestCase.assertTrue;

package se.citerus.dddsample.acceptance;




public class AdminAcceptanceTest extends AbstractAcceptanceTest {

    @Test
    public void adminSiteCargoListContainsCannedCargo() {
        AdminPage page = new AdminPage(driver);