Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class GalleryLastToFirstSlideReportingTest extends GallerySlidingReportingTest {
- protected String lastSlideRegex;
- protected String tempEvent;
- protected String updatedURL;
- @Override
- public void slideGallery(String template, boolean isFocus, boolean isAutoSliding) {
- isFocusNeeded = isFocus;
- isAutoSlidingParam = isAutoSliding;
- url = EnvironmentUrlUtils.getUrlByTemplate(template, "reporting").get(0);
- ProxyUtils.blockBetAds(rbmc, proxyPort);
- driver = WebDriverUtils.openUrlSafely(driverFactory, url, rbmc);
- rbmc.createNewHar(proxyPort);
- proxyPort = driverFactory.getProxyPort();
- imageGalleryPage = new ImageGalleryPage(driver);
- galleryItemsNumber = imageGalleryPage.getGallerySlidesCount();
- if (!isAutoSliding) {
- imageGalleryPage.clickPauseButtonIfDisplayed();
- imageGalleryPage.slideToGallerySlide(galleryItemsNumber);
- } else {
- imageGalleryPage.waitForGallerySlideVisible(galleryItemsNumber - 1, false);
- }
- if (!isAutoSliding) {
- lastSlideRegex = OmnitureConstants.EVENT3_EVENT23;
- tempEvent = OmnitureConstants.EVENT3 + ProxyRegexConstants.PERCENT_DECODED_SYMBOL + OmnitureConstants.EVENT23;
- imageGalleryPage.slideToGallerySlide(1);
- } else {
- lastSlideRegex = OmnitureConstants.EVENT3_EVENT22;
- tempEvent = OmnitureConstants.EVENT3 + ProxyRegexConstants.PERCENT_DECODED_SYMBOL + OmnitureConstants.EVENT22;
- // imageGalleryPage.clickPlayButtonIfDisplayed();
- imageGalleryPage.waitForNextGallerySlideVisible(1, false);
- }
- updatedURL = driver.getCurrentUrl();
- galleryCurrentItemNumber = imageGalleryPage.getCurrentGallerySlideNumber();
- slideImageURL = imageGalleryPage.getOriginalSlideImageURL();
- galleryItemsNumber = imageGalleryPage.getGallerySlidesCount();
- }
- @Override
- @ExpectedFail(bugs = { AUT_624_ISSUE })
- public void checkOmnitureCalls() {
- SoftAssert softAssert = new SoftAssert();
- IValidator validator = new PageCallValidator();
- List<OmnitureCallModel> actualOmnitureRequests = new LinkedList<>();
- Sleeper.SYSTEM_SLEEPER.sleep(new Duration(10, TimeUnit.SECONDS));
- Har har = rbmc.getHarByPortAndHost(proxyPort, ".*metrics.*c42=1&.*");
- String omniturePathPattern = OmnitureUtils.getOmnitureURLPatternByEnvironment(url) + tempEvent + ProxyRegexConstants.ANY_SYMBOL;
- String cookie = plainQueryUtilService.getCookie();
- OmnitureCallModel expectedOmnitureCallModel = OmnitureUtils.buildGallerySliding(updatedURL, cookie, plainQueryService,
- isFocusNeeded, galleryItemsNumber, galleryCurrentItemNumber, isAutoSlidingParam, slideImageURL, lastSlideRegex);
- actualOmnitureRequests = new ProxyRequestParamsData<OmnitureCallModel>(har, omniturePathPattern, OmnitureCallModel.class)
- .getDataModelList();
- updateC11V11Parameter(expectedOmnitureCallModel, updatedURL);
- Map<String, String> rules = new HashMap<String, String>();
- rules.put(OmnitureConstants.C18_PARAMETER, RulesConstants.REGEX_MATCHES_RULE);
- rules.put(OmnitureConstants.V18_PARAMETER, RulesConstants.REGEX_MATCHES_RULE);
- for (OmnitureCallModel omnitureCall : actualOmnitureRequests) {
- omnitureCall = OmnitureUtils.sortTagsC8V8(omnitureCall, "; ");
- softAssert.assertTrue(validator.isModelsEquals(expectedOmnitureCallModel, omnitureCall, rules, 100, "",
- new HashMap<String, Object>(), new HashMap<String, Object>(), OmnitureUtils.createBugList(getBugsMap()), true));
- softAssert.assertTrue(OmnitureUtils.isServerParameterCorrect(omnitureCall.getServer()),
- "Error! Server parameter isn't correct.");
- }
- softAssert.assertAll();
- }
- private Map<String, String> getBugsMap() {
- Map<String, String> bugsMap = new HashMap<String, String>();
- bugsMap.put(OmnitureConstants.C22_PARAMETER, AUT_624_ISSUE);
- bugsMap.put(OmnitureConstants.V22_PARAMETER, AUT_624_ISSUE);
- return bugsMap;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement