Created
July 31, 2013 23:28
-
-
Save chrisst/6127166 to your computer and use it in GitHub Desktop.
SeleniumPercentageOff fix
This file contains hidden or 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
commit 6d12abfa57e15e49e13b8a2fae9d56f35261a7c0 | |
Author: Chris Stephens <cstephens@backcountry.com> | |
Date: Wed Jul 31 17:08:39 2013 -0600 | |
[FIX_SELENIUM] fix the sale perctange off test so it doesn't include products that have a range of sale prices | |
diff --git a/qa-automation-tests/src/main/java/com/backcountry/component/retail/BasePLPPages.java b/qa-automation-tests/src/main/java/com/backcountry/component/retail/BasePLPPages.java | |
index 960d357..ce11290 100644 | |
--- a/qa-automation-tests/src/main/java/com/backcountry/component/retail/BasePLPPages.java | |
+++ b/qa-automation-tests/src/main/java/com/backcountry/component/retail/BasePLPPages.java | |
@@ -322,6 +322,15 @@ public class BasePLPPages extends BaseComponent { | |
} | |
throw new RuntimeException("Could not find an on-sale product on this page"); | |
} | |
+ | |
+ public Product getFirstSinglePricedSaleProduct() { | |
+ for (WebElement productElement : getProductElements()) { | |
+ if (productElement.findElements(saleSelector()).size() > 0 && productElement.findElements(saleFromSelector()).size() < 1) { | |
+ return new Product(productElement); | |
+ } | |
+ } | |
+ throw new RuntimeException("Could not find an on-sale product on this page"); | |
+ } | |
public List<Product> getProductItems() { | |
List<Product> productItems = new ArrayList<Product>(); | |
@@ -414,6 +423,10 @@ public class BasePLPPages extends BaseComponent { | |
private By saleSelector() { | |
return By.cssSelector(".qa-low-price"); | |
} | |
+ | |
+ private By saleFromSelector() { | |
+ return By.cssSelector(".qa-from"); | |
+ } | |
private By toosSelector(){ | |
return By.cssSelector(".qa-toos"); | |
diff --git a/qa-automation-tests/src/test/java/com/backcountry/tests/retail/pdp/PercentageOffTest.java b/qa-automation-tests/src/test/java/com/backcountry/tests/retail/pdp/PercentageOffTest.java | |
index e06b4cd..3cfdd9e 100644 | |
--- a/qa-automation-tests/src/test/java/com/backcountry/tests/retail/pdp/PercentageOffTest.java | |
+++ b/qa-automation-tests/src/test/java/com/backcountry/tests/retail/pdp/PercentageOffTest.java | |
@@ -19,7 +19,7 @@ public class PercentageOffTest extends RetailBaseTestCase { | |
goToSiteHomepage(); | |
withPage().header().searchByTerm(searchTerm); | |
BasePLPPages searchResults = withPage().productListingPage(); | |
- Product product = searchResults.getFirstSaleProduct(); | |
+ Product product = searchResults.getFirstSinglePricedSaleProduct(); | |
product.click(); | |
} else { | |
helperFactory().navigationTestHelper().navigateToNonTOOSPdp(productUrl); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment