Created
December 2, 2019 20:50
-
-
Save batmi02/6c87ed5531cd0035605c890730142331 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ------------------------------------------------------------------ | |
// Legacy code based testing | |
// ------------------------------------------------------------------ | |
@Test | |
public void productListTest() { | |
// ----- Check the 1st Item ----- | |
By firstItem = By.id("__item0-container-cart---category--productList-0-titleText-inner"); | |
waitForExistence(firstItem); | |
// ----- Assert the 1st Item's label in the list ----- | |
assertEquals("10\ Portable DVD Player", driver.findElement(firstItem).getText()); | |
// ----- Assert the 1st Item's Price ----- | |
assertEquals("449.99", driver.findElement(By.xpath( | |
"//div[@id='__item0-container-cart---category--productList-0-ObjectNumber']//span[@class='sapMObjectNumberText']")) | |
.getText()); | |
// ----- Assert the 1st Item's Availability ----- | |
assertEquals("Available", | |
driver.findElement(By.xpath("//span[@id='status0-container-cart---category--productList-0-text']")) | |
.getText()); | |
// ----- Assert if Availability is green in color (i.e. sapMObjStatusSuccess class) ----- | |
assertThat( | |
driver.findElement(By.id("__status0-container-cart---category-productList-0")).getAttribute("class"), | |
containsString("sapMObjStatusSuccess")); | |
// ----- Assert the 1st Item's currency (Euro) ----- | |
assertEquals("EUR", driver.findElement(By.xpath( | |
"//div[@id='__item0-container-cart---category--productList-o-ObjectNumber']//span[@class='sapMObjectNumberUnit']")) | |
.getText()); | |
// ----- Assert the 1st Item has the correct image ----- | |
assertThat( | |
driver.findElement(By.id("__item0-container-cart---category--productList-o-text")).getAttribute("src"), | |
containsString("HT-2001.jpg")); | |
// ----- Assert the 1st Item's has "Compare" link | |
assertEquals("Compare", | |
driver.findElement(By.id("__attribute1-container-cart---category--productList-0-text")).getText()); | |
// ----- Assert if the txt Titanium exists | |
assertEquals("Titanium", driver.findElement(By.id("__text20")).getText()); | |
// ----- Check the 2nd Item ----- | |
// TODO Repeat the above for the rest of the items | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment