@Before public void setUp() { webDriver = new FirefoxDriver(); CommonSteps.login(webDriver, "test.twu", "Th0ughtW0rks@12"); CommonSteps.saveProfileInformation(webDriver, "Reader Feeder User"); }
@Test public void shouldDisplayBookNotFoundWhenBookIsNotPresent() { CommonSteps.goToURL(webDriver, "http://127.0.0.1:8080/twu/viewbook?bookId=1000"); assertOnBookTitle("Could not find book"); }
private void assertOnAuthor(String expectedAuthor) { WebElement authorElement = CommonSteps.locateElementByCss(webDriver, "h2.author"); assertThat(authorElement.getText(), containsString(expectedAuthor)); }
private void assertOnIsbn(String expectedIsbn) { WebElement isbnElement = CommonSteps.locateElementByCss(webDriver, "div.isbn"); assertThat(isbnElement.getText(), containsString(expectedIsbn)); }
private void assertOnBookDescription(String expectedDescription) { WebElement descriptionElement = CommonSteps.locateElementByCss(webDriver, "section.description"); assertThat(descriptionElement.getText(), containsString(expectedDescription)); }
private void assertOnBookCover(String expectedCover) { WebElement imageElement = CommonSteps.locateElementByCss(webDriver, "img.book-img"); assertThat(imageElement.getAttribute("src"), is(expectedCover)); }
private void assertOnBookTitle(String expectedTitle) { WebElement titleElement = CommonSteps.locateElementByCss(webDriver, "h1.title"); assertThat(titleElement.getText(), is(expectedTitle)); }