Skip to content

Commit

Permalink
added some test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
= committed Apr 25, 2021
1 parent fc05d11 commit 943074b
Show file tree
Hide file tree
Showing 5 changed files with 82 additions and 10 deletions.
4 changes: 2 additions & 2 deletions com.att/src/main/java/attInternetpage/AttInternetPage.java
Original file line number Diff line number Diff line change
Expand Up @@ -212,11 +212,11 @@ public void navigateToAccountDropDown(){
public int calculateItemsInsideOfDrop(){
WebElement ul_element = driver.findElement(By.xpath("//*[@id=\"profile-unauth\"]/div[2]/ul"));
List<WebElement> 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
Expand Down
45 changes: 45 additions & 0 deletions com.ebay/src/main/java/sell/SellPage.java
Original file line number Diff line number Diff line change
@@ -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.*;


Expand All @@ -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<WebElement> 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);
}
}

12 changes: 9 additions & 3 deletions com.ebay/src/main/java/sell/SellPageLocators.java
Original file line number Diff line number Diff line change
@@ -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]}";
}
2 changes: 1 addition & 1 deletion com.ebay/src/main/resources/secret.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
URL="https://www.ebay.com/sl/prelist/suggest"
URL="https://www.ebay.com/sl/sell"
29 changes: 25 additions & 4 deletions com.ebay/src/test/java/sellPageTest/SellPageTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}

0 comments on commit 943074b

Please sign in to comment.