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

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: Disable Tumblr Created 4 years, 2 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
« no previous file with comments | « tools/perf/page_sets/login_helpers/pinterest_login.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..61e172a1fc1f0b9e328d3926b43146a2d8ebce58 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
@@ -234,11 +236,15 @@ class _MediaBrowsingStory(_BrowsingStory):
ITEM_VIEW_TIME_IN_SECONDS = 3
ITEMS_TO_VISIT = 15
ITEM_SELECTOR_INDEX = 0
+ INCREMENT_INDEX = False
petrcermak 2016/10/04 13:34:21 INCREMENT_INDEX_AFTER_EACH_ITEM might be easier to
rnephew (Reviews Here) 2016/10/04 15:51:12 Done.
def _DidLoadDocument(self, action_runner):
+ index = self.ITEM_SELECTOR_INDEX
for _ in xrange(self.ITEMS_TO_VISIT):
- self._NavigateToItem(action_runner, self.ITEM_SELECTOR_INDEX)
+ self._NavigateToItem(action_runner, index)
self._ViewMediaItem(action_runner)
+ if self.INCREMENT_INDEX:
+ index += 1
def _ViewMediaItem(self, action_runner):
action_runner.tab.WaitForDocumentReadyStateToBeComplete()
@@ -301,3 +307,56 @@ 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
+ INCREMENT_INDEX = True
+ SUPPORTED_PLATFORMS = platforms.NO_PLATFORMS # crbug.com/651909.
+
+ def _ViewMediaItem(self, action_runner):
+ super(TumblrDesktopStory, self)._ViewMediaItem(action_runner)
+ action_runner.MouseClick(selector='#tumblr_lightbox_center_image')
+
+
+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
+ INCREMENT_INDEX = True
+
+ 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:
petrcermak 2016/10/04 13:34:21 ITEM_SELECTOR_INDEX is now a constant. You'll need
rnephew (Reviews Here) 2016/10/04 15:51:12 I did replay them, I just didn't pay close enough
+ # 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.
« no previous file with comments | « tools/perf/page_sets/login_helpers/pinterest_login.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698