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

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

Issue 2171713003: [system health] Make mobile washington post story more robust. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: whitespace Created 4 years, 5 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 unified diff | Download patch
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 8
9 class _BrowsingStory(system_health_story.SystemHealthStory): 9 class _BrowsingStory(system_health_story.SystemHealthStory):
10 """Abstract base class for browsing stories. 10 """Abstract base class for browsing stories.
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 191
192 192
193 class WashingtonPostMobileStory(_NewsBrowsingStory): 193 class WashingtonPostMobileStory(_NewsBrowsingStory):
194 """Progressive website""" 194 """Progressive website"""
195 NAME = 'browse:news:washingtonpost' 195 NAME = 'browse:news:washingtonpost'
196 URL = 'https://www.washingtonpost.com/pwa' 196 URL = 'https://www.washingtonpost.com/pwa'
197 IS_SINGLE_PAGE_APP = True 197 IS_SINGLE_PAGE_APP = True
198 ITEM_SELECTOR = '.hed > a' 198 ITEM_SELECTOR = '.hed > a'
199 SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY 199 SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY
200 _CLOSE_BUTTON_SELECTOR = '.close' 200 _CLOSE_BUTTON_SELECTOR = '.close'
201 _MAIL_BUTTON_SELECTOR = '.mailBlock'
201 202
202 def _DidLoadDocument(self, action_runner): 203 def _DidLoadDocument(self, action_runner):
203 # Close the popup window. On Nexus 9 (and probably other tables) the popup 204 # Close the popup window. On Nexus 9 (and probably other tables) the popup
204 # window does not have a "Close" button, instead it has only a "Send link 205 # window does not have a "Close" button, instead it has only a "Send link
205 # to phone" button. So on tablets we run with the popup window open. The 206 # to phone" button. So on tablets we run with the popup window open. The
206 # popup is transparent, so this is mostly an aesthetical issue. 207 # popup is transparent, so this is mostly an aesthetical issue.
207 has_button = action_runner.EvaluateJavaScript( 208 action_runner.WaitForElement(selector="%s, %s" %
209 (self._CLOSE_BUTTON_SELECTOR, self._MAIL_BUTTON_SELECTOR))
210 has_close_button = action_runner.EvaluateJavaScript(
208 '!!document.querySelector("%s")' % self._CLOSE_BUTTON_SELECTOR) 211 '!!document.querySelector("%s")' % self._CLOSE_BUTTON_SELECTOR)
209 if has_button: 212 if has_close_button:
210 action_runner.ClickElement(selector=self._CLOSE_BUTTON_SELECTOR) 213 action_runner.ClickElement(selector=self._CLOSE_BUTTON_SELECTOR)
214 else:
petrcermak 2016/07/21 09:49:13 Given that you have waited for the element, I don'
ulan 2016/07/21 09:53:24 Done.
215 assert action_runner.EvaluateJavaScript(
216 '!!document.querySelector("%s")' % self._MAIL_BUTTON_SELECTOR)
211 super(WashingtonPostMobileStory, self)._DidLoadDocument(action_runner) 217 super(WashingtonPostMobileStory, self)._DidLoadDocument(action_runner)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698