1 # Copyright 2014 The Chromium Authors. All rights reserved. 2 # Use of this source code is governed by a BSD-style license that can be 3 # found in the LICENSE file. 4 from telemetry.page import page as page_module 5 from telemetry.page import page_set as page_set_module 6 7 8 class PlusAltPostsPhotosPage(page_module.Page): 9 10 """ Why: Alternate between clicking posts and albums """ 11 12 def __init__(self, page_set): 13 super(PlusAltPostsPhotosPage, self).__init__( 14 url='https://plus.google.com/+BarackObama/posts', 15 page_set=page_set, 16 name='plus_alt_posts_photos') 17 self.credentials_path = 'data/credentials.json' 18 self.credentials = 'google' 19 self.user_agent_type = 'desktop' 20 self.archive_data_file = 'data/plus_alt_posts_photos.json' 21 22 def RunNavigateSteps(self, action_runner): 23 action_runner.NavigateToPage(self) 24 action_runner.WaitForElement(text='Barack Obama') 25 action_runner.WaitForElement( 26 'span[guidedhelpid="posts_tab_profile"][class*="s6U8x"]') 27 28 def RunEndure(self, action_runner): 29 action_runner.ClickElement('span[guidedhelpid="posts_tab_profile"]') 30 action_runner.WaitForElement( 31 'span[guidedhelpid="posts_tab_profile"][class*="s6U8x"]') 32 action_runner.Wait(5) 33 action_runner.ClickElement('span[guidedhelpid="photos_tab_profile"]') 34 action_runner.WaitForElement( 35 'span[guidedhelpid="photos_tab_profile"][class*="s6U8x"]') 36 action_runner.Wait(5) 37 38 39 class PlusAltPostsPhotosPageSet(page_set_module.PageSet): 40 41 """ Chrome Endure test for Google Plus. """ 42 43 def __init__(self): 44 super(PlusAltPostsPhotosPageSet, self).__init__( 45 credentials_path='data/credentials.json', 46 user_agent_type='desktop', 47 archive_data_file='data/plus_alt_posts_photos.json', 48 bucket=page_set_module.PUBLIC_BUCKET) 49 50 self.AddPage(PlusAltPostsPhotosPage(self)) 51