Advertisement
Guest User

Untitled

a guest
May 29th, 2017
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 3.76 KB | None | 0 0
  1. public class GalleryLastToFirstSlideReportingTest extends GallerySlidingReportingTest {
  2.  
  3.     protected String lastSlideRegex;
  4.  
  5.     protected String tempEvent;
  6.  
  7.     protected String updatedURL;
  8.  
  9.     @Override
  10.     public void slideGallery(String template, boolean isFocus, boolean isAutoSliding) {
  11.         isFocusNeeded = isFocus;
  12.         isAutoSlidingParam = isAutoSliding;
  13.         url = EnvironmentUrlUtils.getUrlByTemplate(template, "reporting").get(0);
  14.         ProxyUtils.blockBetAds(rbmc, proxyPort);
  15.         driver = WebDriverUtils.openUrlSafely(driverFactory, url, rbmc);
  16.         rbmc.createNewHar(proxyPort);
  17.         proxyPort = driverFactory.getProxyPort();
  18.         imageGalleryPage = new ImageGalleryPage(driver);
  19.         galleryItemsNumber = imageGalleryPage.getGallerySlidesCount();
  20.         if (!isAutoSliding) {
  21.             imageGalleryPage.clickPauseButtonIfDisplayed();
  22.             imageGalleryPage.slideToGallerySlide(galleryItemsNumber);
  23.         } else {
  24.             imageGalleryPage.waitForGallerySlideVisible(galleryItemsNumber - 1, false);
  25.         }
  26.        
  27.         if (!isAutoSliding) {
  28.             lastSlideRegex = OmnitureConstants.EVENT3_EVENT23;
  29.             tempEvent = OmnitureConstants.EVENT3 + ProxyRegexConstants.PERCENT_DECODED_SYMBOL + OmnitureConstants.EVENT23;
  30.             imageGalleryPage.slideToGallerySlide(1);
  31.         } else {
  32.             lastSlideRegex = OmnitureConstants.EVENT3_EVENT22;
  33.             tempEvent = OmnitureConstants.EVENT3 + ProxyRegexConstants.PERCENT_DECODED_SYMBOL + OmnitureConstants.EVENT22;
  34. //          imageGalleryPage.clickPlayButtonIfDisplayed();
  35.             imageGalleryPage.waitForNextGallerySlideVisible(1, false);
  36.         }
  37.         updatedURL = driver.getCurrentUrl();
  38.         galleryCurrentItemNumber = imageGalleryPage.getCurrentGallerySlideNumber();
  39.         slideImageURL = imageGalleryPage.getOriginalSlideImageURL();
  40.         galleryItemsNumber = imageGalleryPage.getGallerySlidesCount();
  41.     }
  42.  
  43.     @Override
  44.     @ExpectedFail(bugs = { AUT_624_ISSUE })
  45.     public void checkOmnitureCalls() {
  46.         SoftAssert softAssert = new SoftAssert();
  47.         IValidator validator = new PageCallValidator();
  48.         List<OmnitureCallModel> actualOmnitureRequests = new LinkedList<>();
  49.         Sleeper.SYSTEM_SLEEPER.sleep(new Duration(10, TimeUnit.SECONDS));
  50.         Har har = rbmc.getHarByPortAndHost(proxyPort, ".*metrics.*c42=1&.*");
  51.         String omniturePathPattern = OmnitureUtils.getOmnitureURLPatternByEnvironment(url) + tempEvent + ProxyRegexConstants.ANY_SYMBOL;
  52.         String cookie = plainQueryUtilService.getCookie();
  53.         OmnitureCallModel expectedOmnitureCallModel = OmnitureUtils.buildGallerySliding(updatedURL, cookie, plainQueryService,
  54.                 isFocusNeeded, galleryItemsNumber, galleryCurrentItemNumber, isAutoSlidingParam, slideImageURL, lastSlideRegex);
  55.         actualOmnitureRequests = new ProxyRequestParamsData<OmnitureCallModel>(har, omniturePathPattern, OmnitureCallModel.class)
  56.                 .getDataModelList();
  57.         updateC11V11Parameter(expectedOmnitureCallModel, updatedURL);
  58.         Map<String, String> rules = new HashMap<String, String>();
  59.         rules.put(OmnitureConstants.C18_PARAMETER, RulesConstants.REGEX_MATCHES_RULE);
  60.         rules.put(OmnitureConstants.V18_PARAMETER, RulesConstants.REGEX_MATCHES_RULE);
  61.         for (OmnitureCallModel omnitureCall : actualOmnitureRequests) {
  62.             omnitureCall = OmnitureUtils.sortTagsC8V8(omnitureCall, "; ");
  63.             softAssert.assertTrue(validator.isModelsEquals(expectedOmnitureCallModel, omnitureCall, rules, 100, "",
  64.                     new HashMap<String, Object>(), new HashMap<String, Object>(), OmnitureUtils.createBugList(getBugsMap()), true));
  65.             softAssert.assertTrue(OmnitureUtils.isServerParameterCorrect(omnitureCall.getServer()),
  66.                     "Error! Server parameter isn't correct.");
  67.         }
  68.         softAssert.assertAll();
  69.     }
  70.  
  71.     private Map<String, String> getBugsMap() {
  72.         Map<String, String> bugsMap = new HashMap<String, String>();
  73.         bugsMap.put(OmnitureConstants.C22_PARAMETER, AUT_624_ISSUE);
  74.         bugsMap.put(OmnitureConstants.V22_PARAMETER, AUT_624_ISSUE);
  75.         return bugsMap;
  76.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement