Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9)

Side by Side Diff: tools/perf/page_sets/system_health/browsing_stories.py

Issue 2414153004: [System Health] Make pinterest/tumblr stories scroll to elements off screen. (Closed)
Patch Set: Disable youtube browsing story Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « tools/perf/page_sets/data/system_health_desktop_036.wpr.sha1 ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2016 The Chromium Authors. All rights reserved. 1 # Copyright 2016 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 from page_sets.system_health import platforms 5 from page_sets.system_health import platforms
6 from page_sets.system_health import system_health_story 6 from page_sets.system_health import system_health_story
7 7
8 from page_sets.login_helpers import pinterest_login 8 from page_sets.login_helpers import pinterest_login
9 9
10 from telemetry import decorators 10 from telemetry import decorators
(...skipping 11 matching lines...) Expand all
22 ITEM_SELECTOR = NotImplemented 22 ITEM_SELECTOR = NotImplemented
23 ABSTRACT_STORY = True 23 ABSTRACT_STORY = True
24 24
25 def _WaitForNavigation(self, action_runner): 25 def _WaitForNavigation(self, action_runner):
26 if not self.IS_SINGLE_PAGE_APP: 26 if not self.IS_SINGLE_PAGE_APP:
27 action_runner.WaitForNavigate() 27 action_runner.WaitForNavigate()
28 28
29 def _NavigateToItem(self, action_runner, index): 29 def _NavigateToItem(self, action_runner, index):
30 item_selector = 'document.querySelectorAll("%s")[%d]' % ( 30 item_selector = 'document.querySelectorAll("%s")[%d]' % (
31 self.ITEM_SELECTOR, index) 31 self.ITEM_SELECTOR, index)
32 # Only scrolls if element is not currently in viewport.
33 action_runner.ScrollPageToElement(element_function=item_selector)
32 self._ClickLink(action_runner, item_selector) 34 self._ClickLink(action_runner, item_selector)
33 35
34 def _ClickLink(self, action_runner, element_function): 36 def _ClickLink(self, action_runner, element_function):
35 action_runner.WaitForElement(element_function=element_function) 37 action_runner.WaitForElement(element_function=element_function)
36 action_runner.ClickElement(element_function=element_function) 38 action_runner.ClickElement(element_function=element_function)
37 self._WaitForNavigation(action_runner) 39 self._WaitForNavigation(action_runner)
38 40
39 def _NavigateBack(self, action_runner): 41 def _NavigateBack(self, action_runner):
40 action_runner.ExecuteJavaScript('window.history.back()') 42 action_runner.ExecuteJavaScript('window.history.back()')
41 self._WaitForNavigation(action_runner) 43 self._WaitForNavigation(action_runner)
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 272
271 class YouTubeMobileStory(_MediaBrowsingStory): 273 class YouTubeMobileStory(_MediaBrowsingStory):
272 NAME = 'browse:media:youtube' 274 NAME = 'browse:media:youtube'
273 URL = 'https://m.youtube.com/watch?v=QGfhS1hfTWw&autoplay=false' 275 URL = 'https://m.youtube.com/watch?v=QGfhS1hfTWw&autoplay=false'
274 ITEM_SELECTOR = '._mhgb > a' 276 ITEM_SELECTOR = '._mhgb > a'
275 SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY 277 SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY
276 IS_SINGLE_PAGE_APP = True 278 IS_SINGLE_PAGE_APP = True
277 ITEM_SELECTOR_INDEX = 3 279 ITEM_SELECTOR_INDEX = 3
278 280
279 281
282 # Failing during CQ runs. crbug.com/661775
283 @decorators.Disabled('linux', 'win')
280 class YouTubeDesktopStory(_MediaBrowsingStory): 284 class YouTubeDesktopStory(_MediaBrowsingStory):
281 NAME = 'browse:media:youtube' 285 NAME = 'browse:media:youtube'
282 URL = 'https://www.youtube.com/watch?v=QGfhS1hfTWw&autoplay=false' 286 URL = 'https://www.youtube.com/watch?v=QGfhS1hfTWw&autoplay=false'
283 ITEM_SELECTOR = '.yt-uix-simple-thumb-related' 287 ITEM_SELECTOR = '.yt-uix-simple-thumb-related'
284 SUPPORTED_PLATFORMS = platforms.DESKTOP_ONLY 288 SUPPORTED_PLATFORMS = platforms.DESKTOP_ONLY
285 IS_SINGLE_PAGE_APP = True 289 IS_SINGLE_PAGE_APP = True
286 # A longer view time allows videos to load and play. 290 # A longer view time allows videos to load and play.
287 ITEM_VIEW_TIME_IN_SECONDS = 5 291 ITEM_VIEW_TIME_IN_SECONDS = 5
288 ITEMS_TO_VISIT = 8 292 ITEMS_TO_VISIT = 8
289 ITEM_SELECTOR_INDEX = 3 293 ITEM_SELECTOR_INDEX = 3
(...skipping 18 matching lines...) Expand all
308 # theater viewer. 312 # theater viewer.
309 SUPPORTED_PLATFORMS = platforms.NO_PLATFORMS 313 SUPPORTED_PLATFORMS = platforms.NO_PLATFORMS
310 IS_SINGLE_PAGE_APP = True 314 IS_SINGLE_PAGE_APP = True
311 315
312 316
313 class TumblrDesktopStory(_MediaBrowsingStory): 317 class TumblrDesktopStory(_MediaBrowsingStory):
314 NAME = 'browse:media:tumblr' 318 NAME = 'browse:media:tumblr'
315 URL = 'https://tumblr.com/search/gifs' 319 URL = 'https://tumblr.com/search/gifs'
316 ITEM_SELECTOR = '.photo' 320 ITEM_SELECTOR = '.photo'
317 IS_SINGLE_PAGE_APP = True 321 IS_SINGLE_PAGE_APP = True
318 ITEMS_TO_VISIT = 2 # Increase when crbug.com/651909 is implemented. 322 ITEMS_TO_VISIT = 8
319 ITEM_VIEW_TIME_IN_SECONDS = 5
320 INCREMENT_INDEX_AFTER_EACH_ITEM = True 323 INCREMENT_INDEX_AFTER_EACH_ITEM = True
321 SUPPORTED_PLATFORMS = platforms.NO_PLATFORMS # crbug.com/651909. 324 SUPPORTED_PLATFORMS = platforms.DESKTOP_ONLY
322 325
323 def _ViewMediaItem(self, action_runner, index): 326 def _ViewMediaItem(self, action_runner, index):
324 super(TumblrDesktopStory, self)._ViewMediaItem(action_runner, index) 327 super(TumblrDesktopStory, self)._ViewMediaItem(action_runner, index)
325 action_runner.MouseClick(selector='#tumblr_lightbox_center_image') 328 action_runner.MouseClick(selector='#tumblr_lightbox_center_image')
326 329 action_runner.Wait(1) # To make browsing more realistic.
327 330
328 class PinterestDesktopStory(_MediaBrowsingStory): 331 class PinterestDesktopStory(_MediaBrowsingStory):
329 NAME = 'browse:media:pinterest' 332 NAME = 'browse:media:pinterest'
330 URL = 'https://pinterest.com' 333 URL = 'https://pinterest.com'
331 ITEM_SELECTOR = '.pinImageDim' 334 ITEM_SELECTOR = '.pinImageDim'
332 IS_SINGLE_PAGE_APP = True 335 IS_SINGLE_PAGE_APP = True
333 ITEMS_TO_VISIT = 5 # Increase when crbug.com/651909 is implemented. 336 ITEMS_TO_VISIT = 8
334 ITEM_VIEW_TIME_IN_SECONDS = 5
335 INCREMENT_INDEX_AFTER_EACH_ITEM = True 337 INCREMENT_INDEX_AFTER_EACH_ITEM = True
336 SUPPORTED_PLATFORMS = platforms.DESKTOP_ONLY 338 SUPPORTED_PLATFORMS = platforms.DESKTOP_ONLY
337 339
338 def _Login(self, action_runner): 340 def _Login(self, action_runner):
339 pinterest_login.LoginDesktopAccount(action_runner, 'googletest', 341 pinterest_login.LoginDesktopAccount(action_runner, 'googletest',
340 self.credentials_path) 342 self.credentials_path)
341 343
342 def _ViewMediaItem(self, action_runner, index): 344 def _ViewMediaItem(self, action_runner, index):
343 super(PinterestDesktopStory, self)._ViewMediaItem(action_runner, index) 345 super(PinterestDesktopStory, self)._ViewMediaItem(action_runner, index)
344 # To imitate real user interaction, we do not want to pin every post. 346 # To imitate real user interaction, we do not want to pin every post.
(...skipping 10 matching lines...) Expand all
355 inner_save_function = 'document.querySelector(".nameAndIcons")' 357 inner_save_function = 'document.querySelector(".nameAndIcons")'
356 action_runner.WaitForElement(element_function=inner_save_function) 358 action_runner.WaitForElement(element_function=inner_save_function)
357 action_runner.ClickElement(element_function=inner_save_function) 359 action_runner.ClickElement(element_function=inner_save_function)
358 action_runner.Wait(1) # Wait to make navigation realistic. 360 action_runner.Wait(1) # Wait to make navigation realistic.
359 361
360 # Close selection. 362 # Close selection.
361 x_element_function = ('document.querySelector(' 363 x_element_function = ('document.querySelector('
362 '".Button.borderless.close.visible")') 364 '".Button.borderless.close.visible")')
363 action_runner.ClickElement(element_function=x_element_function) 365 action_runner.ClickElement(element_function=x_element_function)
364 action_runner.Wait(1) # Wait to make navigation realistic. 366 action_runner.Wait(1) # Wait to make navigation realistic.
OLDNEW
« no previous file with comments | « tools/perf/page_sets/data/system_health_desktop_036.wpr.sha1 ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698