diff --git a/com.att/src/main/java/attInternetpage/AttInternetPage.java b/com.att/src/main/java/attInternetpage/AttInternetPage.java index 79f3c4a..8545f69 100644 --- a/com.att/src/main/java/attInternetpage/AttInternetPage.java +++ b/com.att/src/main/java/attInternetpage/AttInternetPage.java @@ -212,11 +212,11 @@ public void navigateToAccountDropDown(){ public int calculateItemsInsideOfDrop(){ WebElement ul_element = driver.findElement(By.xpath("//*[@id=\"profile-unauth\"]/div[2]/ul")); List li_All = ul_element.findElements(By.className("cta wcgn-account-dropdown")); - int AccountNUMlinks = li_All.size(); + int accountNUMlinks = li_All.size(); for (int i = 0; i < li_All.size(); i++) { System.out.println(li_All.get(i).getText()); } - return AccountNUMlinks; + return accountNUMlinks; } /** * Test case:9 diff --git a/com.ebay/src/main/java/sell/SellPage.java b/com.ebay/src/main/java/sell/SellPage.java index 2c2d037..84c3de2 100644 --- a/com.ebay/src/main/java/sell/SellPage.java +++ b/com.ebay/src/main/java/sell/SellPage.java @@ -1,10 +1,13 @@ package sell; import common.BaseAPI; +import org.openqa.selenium.By; import org.openqa.selenium.WebElement; import org.openqa.selenium.support.FindBy; import org.openqa.selenium.support.PageFactory; +import java.util.List; + import static sell.SellPageLocators.*; @@ -18,10 +21,52 @@ public SellPage(){ WebElement listAnItem; @FindBy(xpath= WebElementSearchBar) WebElement searchBar; + @FindBy(xpath=WebElementSellCategories) + WebElement sellCategories; + @FindBy(xpath=WebElementLearnMoreSell) + WebElement learnMore; + @FindBy(xpath=WebElementLearnMoreSellPicture) + WebElement picture; + @FindBy(xpath=WebElementSeller) + WebElement seller; + @FindBy(xpath=WebElementSellStories) + WebElement sellStories; + @FindBy(xpath=WebElementSellerStoryText) + WebElement sellerStoryText; public void sellItem(){ mouseHoverElement(listAnItem); sendKeysToElement(searchBar,"Samsung"); } + + public int numOfCategories(){ + scrollToElementJScript(sellCategories); + clickOnTheElement(sellCategories); + WebElement ul_element = driver.findElement(By.xpath("//*[@id=\"profile-unauth\"]/div[2]/ul")); + List li_All = ul_element.findElements(By.className("cta wcgn-account-dropdown")); + int accountCategories = li_All.size(); + for (int i = 0; i < li_All.size(); i++) { + System.out.println(li_All.get(i).getText()); + } + return accountCategories; + } + + public void clickLearnMore(){ + learnMore.click(); + } + + public boolean isPicDisplayed(){ + picture.isDisplayed(); + return true; + } + + public void sellerStory(){ + clickOnTheElement(learnMore); + clickOnTheElement(sellStories); + clickOnTheElement(seller); + String theSellerStory= sellerStoryText.getText(); + System.out.println(theSellerStory); + } } + diff --git a/com.ebay/src/main/java/sell/SellPageLocators.java b/com.ebay/src/main/java/sell/SellPageLocators.java index dfd8844..8b20e59 100644 --- a/com.ebay/src/main/java/sell/SellPageLocators.java +++ b/com.ebay/src/main/java/sell/SellPageLocators.java @@ -1,6 +1,12 @@ package sell; public class SellPageLocators { -public static final String WebElementListAnItem="//*[@id=\"TOPINVITATION\"]/div/div/div[2]"; -public static final String WebElementSearchBar="//*[@id=\"s0-0-0-30-13-keyword-box-input-textbox\"]"; -} + public static final String WebElementListAnItem = "//*[@id=\"TOPINVITATION\"]/div/div/div[2]"; + public static final String WebElementSearchBar = "//*[@id=\"s0-0-0-30-13-keyword-box-input-textbox\"]"; + public static final String WebElementSellCategories = "//*[@id=\"LANDINGPAGES\"]/div"; + public static final String WebElementLearnMoreSell = "//*[@id=\"BUSINESS\"]/div/div/div[1]/a"; + public static final String WebElementLearnMoreSellPicture = "//*[@id=\"mainContent\"]/div/section[1]/img"; + public static final String WebElementSellStories = "/html/body/div[2]/div[1]/div/div/div[2]/ul/li[3]/a"; + public static final String WebElementSeller = "//*[@id=\"s0-0-0-26-10-3-list\"]/li[3]/div"; + public static final String WebElementSellerStoryText = "//*[@id=\"SELLER-STORIES\"]/div[2]/div/div[2]/div[3]/div/div[1]}"; +} \ No newline at end of file diff --git a/com.ebay/src/main/resources/secret.properties b/com.ebay/src/main/resources/secret.properties index 2c921ac..518a70c 100644 --- a/com.ebay/src/main/resources/secret.properties +++ b/com.ebay/src/main/resources/secret.properties @@ -1 +1 @@ -URL="https://www.ebay.com/sl/prelist/suggest" \ No newline at end of file +URL="https://www.ebay.com/sl/sell" \ No newline at end of file diff --git a/com.ebay/src/test/java/sellPageTest/SellPageTest.java b/com.ebay/src/test/java/sellPageTest/SellPageTest.java index de5c5c3..6e02439 100644 --- a/com.ebay/src/test/java/sellPageTest/SellPageTest.java +++ b/com.ebay/src/test/java/sellPageTest/SellPageTest.java @@ -2,13 +2,34 @@ import common.BaseAPI; import ebayhomegarden.EbayHomeGardenPage; +import org.testng.Assert; import org.testng.annotations.Test; public class SellPageTest extends BaseAPI { EbayHomeGardenPage ebayHomeGardenPage; - @Test - public void testSellItems(){ - ebayHomeGardenPage=new EbayHomeGardenPage(); + + @Test(enabled = false) + public void testSellItems() { + ebayHomeGardenPage = new EbayHomeGardenPage(); ebayHomeGardenPage.navigateToSellPage().sellItem(); } -} + + @Test(enabled = false) + public void testValidateCategories() { + ebayHomeGardenPage = new EbayHomeGardenPage(); + int actualNumber = ebayHomeGardenPage.navigateToSellPage().numOfCategories(); + Assert.assertEquals(actualNumber, "39"); + } + @Test(enabled = false) + public void testValidatePicIsThere(){ + ebayHomeGardenPage = new EbayHomeGardenPage(); + ebayHomeGardenPage.navigateToSellPage().clickLearnMore(); + boolean isPicThere=ebayHomeGardenPage.navigateToSellPage().isPicDisplayed(); + Assert.assertTrue(isPicThere,"picture is not visible"); + } + @Test + public void testTheSellerStory(){ + ebayHomeGardenPage = new EbayHomeGardenPage(); + ebayHomeGardenPage.navigateToSellPage().sellerStory(); + } +} \ No newline at end of file