use of net.lightbody.bmp.core.har.HarEntry in project selenium-tests by Wikia.
the class NetworkTrafficInterceptor method logDFP.
/**
* Looks for correlator pattern in requests query strings to DFP domain, and logs if all the calls
* have the same correlator ID. Any difference is ID is logged as failure.
*/
public void logDFP(String skinCorrelator) {
har = getHar();
String expectedCorrelator = null;
Pattern pt = Pattern.compile("(correlator=)\\d*");
for (HarEntry entry : har.getLog().getEntries()) {
if (entry.getRequest().getUrl().contains("pubads.g.doubleclick.net") && entry.getRequest().getQueryString().toString().contains(skinCorrelator)) {
Matcher matcher = pt.matcher(entry.getRequest().getQueryString().toString());
if (matcher.find()) {
String correlatorID = matcher.group(0);
if (expectedCorrelator == null) {
expectedCorrelator = correlatorID;
}
PageObjectLogging.log("CORRELATOR CHECK", "CORRELATOR ID: " + correlatorID, correlatorID.equals(expectedCorrelator));
} else {
throw new WebDriverException("Missing correlator param in query string");
}
}
}
}
use of net.lightbody.bmp.core.har.HarEntry in project selenium-tests by Wikia.
the class TestAdsVelesTracking method adsTrackingVelesTracked.
@NetworkTrafficDump()
@Test(groups = "AdsTrackingVeles", dataProviderClass = AdsDataProvider.class, dataProvider = "adsVelesTracking")
public void adsTrackingVelesTracked(final Page page, final Map<String, String> positionsAndPrices) {
networkTrafficInterceptor.startIntercepting();
AdsBaseObject pageObject = new AdsBaseObject(driver, urlBuilder.getUrlForPage(page));
Set<HarEntry> entries = findEntriesByUrlPart(pageObject, VELES_TRACKING_REQUEST_PART, positionsAndPrices);
Assertion.assertTrue(wasVelesTrackedIn(entries, positionsAndPrices), "Veles should be tracked only in " + positionsAndPrices);
}
Aggregations