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

Unified Diff: tools/perf/page_sets/system_health/browsing_stories.py

Issue 2383883002: [System Health] Add browsing user stories for pinterest and tumblr. (Closed)
Patch Set: Created 4 years, 3 months 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 side-by-side diff with in-line comments
Download patch
Index: tools/perf/page_sets/system_health/browsing_stories.py
diff --git a/tools/perf/page_sets/system_health/browsing_stories.py b/tools/perf/page_sets/system_health/browsing_stories.py
index 410714904a788134f4a2b3cb82165b8754cec637..090516ccf7d2aa064e018939e797bc255d64e3d7 100644
--- a/tools/perf/page_sets/system_health/browsing_stories.py
+++ b/tools/perf/page_sets/system_health/browsing_stories.py
@@ -5,6 +5,8 @@
from page_sets.system_health import platforms
from page_sets.system_health import system_health_story
+from page_sets.login_helpers import pinterest_login
+
from telemetry import decorators
@@ -301,3 +303,55 @@ class FacebookPhotosDesktopStory(_MediaBrowsingStory):
# theater viewer.
SUPPORTED_PLATFORMS = platforms.NO_PLATFORMS
IS_SINGLE_PAGE_APP = True
+
+
+class TumblrDesktopStory(_MediaBrowsingStory):
+ NAME = 'browse:media:tumblr'
+ URL = 'https://tumblr.com/search/gifs'
+ ITEM_SELECTOR = '.photo'
+ IS_SINGLE_PAGE_APP = True
+ ITEMS_TO_VISIT = 2 # Increase when crbug.com/651909 is implemented.
+ ITEM_VIEW_TIME_IN_SECONDS = 5
+
+ def _ViewMediaItem(self, action_runner):
+ super(TumblrDesktopStory, self)._ViewMediaItem(action_runner)
+ action_runner.MouseClick(selector='#tumblr_lightbox_center_image')
+ self.ITEM_SELECTOR_INDEX += 1
petrcermak 2016/10/03 09:01:23 This works, but it's very hacky. Please don't shad
rnephew (Reviews Here) 2016/10/03 16:57:13 Done.
+
+
+class PinterestDesktopStory(_MediaBrowsingStory):
+ NAME = 'browse:media:pinterest'
+ URL = 'https://pinterest.com'
+ ITEM_SELECTOR = '.pinImageDim'
+ IS_SINGLE_PAGE_APP = True
+ ITEMS_TO_VISIT = 5 # Increase when crbug.com/651909 is implemented.
+ ITEM_VIEW_TIME_IN_SECONDS = 5
+
+ def _Login(self, action_runner):
+ pinterest_login.LoginDesktopAccount(action_runner, 'googletest',
+ self.credentials_path)
+
+ def _ViewMediaItem(self, action_runner):
+ super(PinterestDesktopStory, self)._ViewMediaItem(action_runner)
+ # To imitate real user interaction, we do not want to pin every post.
+ # We will only pin every other post.
+ if self.ITEM_SELECTOR_INDEX % 2 == 0:
+ # Pin the selection.
+ save_function = ('document.querySelector('
+ '".Button.Module.ShowModalButton.btn.hasIcon.hasText.'
+ 'isBrioFlat.medium.primary.primaryOnHover.repin.'
+ 'pinActionBarButton.isBrioFlat.rounded")')
+ action_runner.ClickElement(element_function=save_function)
+ action_runner.Wait(1) # Wait to make navigation realistic.
+ # Select which board to pin to.
+ inner_save_function = 'document.querySelector(".nameAndIcons")'
+ action_runner.WaitForElement(element_function=inner_save_function)
+ action_runner.ClickElement(element_function=inner_save_function)
+ action_runner.Wait(1) # Wait to make navigation realistic.
+
+ # Close selection.
+ x_element_function = ('document.querySelector('
+ '".Button.borderless.close.visible")')
+ action_runner.ClickElement(element_function=x_element_function)
+ action_runner.Wait(1) # Wait to make navigation realistic.
+ self.ITEM_SELECTOR_INDEX += 1
petrcermak 2016/10/03 09:01:23 ditto: don't shadow a constant
rnephew (Reviews Here) 2016/10/03 16:57:13 Done.

Powered by Google App Engine
This is Rietveld 408576698