| OLD | NEW |
| 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 import logging | |
| 6 import sys | 5 import sys |
| 7 | 6 |
| 7 from page_sets.system_health import platforms |
| 8 from page_sets.system_health import system_health_story |
| 9 |
| 8 from page_sets.login_helpers import dropbox_login | 10 from page_sets.login_helpers import dropbox_login |
| 9 from page_sets.login_helpers import google_login | 11 from page_sets.login_helpers import google_login |
| 10 | 12 |
| 11 from telemetry.core import discover | |
| 12 from telemetry.page import page | |
| 13 | 13 |
| 14 | 14 class _LoadingStory(system_health_story.SystemHealthStory): |
| 15 _ALL_PLATFORMS = frozenset({'desktop', 'mobile'}) | |
| 16 _DESKTOP_ONLY = frozenset({'desktop'}) | |
| 17 _MOBILE_ONLY = frozenset({'mobile'}) | |
| 18 _NO_PLATFORMS = frozenset() | |
| 19 | |
| 20 | |
| 21 _DUMP_WAIT_TIME = 3 | |
| 22 | |
| 23 | |
| 24 class _SinglePageStory(page.Page): | |
| 25 """Abstract base class for single-page System Health user stories.""" | 15 """Abstract base class for single-page System Health user stories.""" |
| 26 | 16 pass |
| 27 # The full name of a single page story has the form CASE:GROUP:PAGE (e.g. | |
| 28 # 'load:search:google'). | |
| 29 NAME = NotImplemented | |
| 30 URL = NotImplemented | |
| 31 SUPPORTED_PLATFORMS = _ALL_PLATFORMS | |
| 32 | |
| 33 def __init__(self, story_set, take_memory_measurement): | |
| 34 case, group, _ = self.NAME.split(':') | |
| 35 super(_SinglePageStory, self).__init__( | |
| 36 page_set=story_set, name=self.NAME, url=self.URL, | |
| 37 credentials_path='../data/credentials.json', | |
| 38 grouping_keys={'case': case, 'group': group}) | |
| 39 self._take_memory_measurement = take_memory_measurement | |
| 40 | |
| 41 def _Measure(self, action_runner): | |
| 42 if not self._take_memory_measurement: | |
| 43 return | |
| 44 # TODO(petrcermak): This method is essentially the same as | |
| 45 # MemoryHealthPage._TakeMemoryMeasurement() in memory_health_story.py. | |
| 46 # Consider sharing the common code. | |
| 47 action_runner.Wait(_DUMP_WAIT_TIME) | |
| 48 action_runner.ForceGarbageCollection() | |
| 49 action_runner.Wait(_DUMP_WAIT_TIME) | |
| 50 tracing_controller = action_runner.tab.browser.platform.tracing_controller | |
| 51 if not tracing_controller.is_tracing_running: | |
| 52 return # Tracing is not running, e.g., when recording a WPR archive. | |
| 53 if not action_runner.tab.browser.DumpMemory(): | |
| 54 logging.error('Unable to get a memory dump for %s.', self.name) | |
| 55 | |
| 56 def _Login(self, action_runner): | |
| 57 pass | |
| 58 | |
| 59 def _DidLoadDocument(self, action_runner): | |
| 60 pass | |
| 61 | |
| 62 def RunNavigateSteps(self, action_runner): | |
| 63 self._Login(action_runner) | |
| 64 super(_SinglePageStory, self).RunNavigateSteps(action_runner) | |
| 65 | |
| 66 def RunPageInteractions(self, action_runner): | |
| 67 action_runner.tab.WaitForDocumentReadyStateToBeComplete() | |
| 68 self._DidLoadDocument(action_runner) | |
| 69 self._Measure(action_runner) | |
| 70 | 17 |
| 71 | 18 |
| 72 def IterAllStoryClasses(): | 19 def IterAllStoryClasses(): |
| 73 # Sort the classes by their names so that their order is stable and | 20 return system_health_story.IterAllStoryClasses( |
| 74 # deterministic. | 21 sys.modules[__name__], _LoadingStory) |
| 75 for unused_cls_name, cls in sorted(discover.DiscoverClassesInModule( | |
| 76 module=sys.modules[__name__], | |
| 77 base_class=_SinglePageStory, | |
| 78 index_by_class_name=True).iteritems()): | |
| 79 yield cls | |
| 80 | 22 |
| 81 | 23 |
| 82 ################################################################################ | 24 ################################################################################ |
| 83 # Search and e-commerce. | 25 # Search and e-commerce. |
| 84 ################################################################################ | 26 ################################################################################ |
| 85 | 27 |
| 86 | 28 |
| 87 class LoadGoogleStory(_SinglePageStory): | 29 class LoadGoogleStory(_LoadingStory): |
| 88 NAME = 'load:search:google' | 30 NAME = 'load:search:google' |
| 89 URL = 'https://www.google.com/#hl=en&q=science' | 31 URL = 'https://www.google.com/#hl=en&q=science' |
| 90 | 32 |
| 91 | 33 |
| 92 class LoadBaiduStory(_SinglePageStory): | 34 class LoadBaiduStory(_LoadingStory): |
| 93 NAME = 'load:search:baidu' | 35 NAME = 'load:search:baidu' |
| 94 URL = 'https://www.baidu.com/s?word=google' | 36 URL = 'https://www.baidu.com/s?word=google' |
| 95 | 37 |
| 96 | 38 |
| 97 class LoadYahooStory(_SinglePageStory): | 39 class LoadYahooStory(_LoadingStory): |
| 98 NAME = 'load:search:yahoo' | 40 NAME = 'load:search:yahoo' |
| 99 URL = 'https://search.yahoo.com/search;_ylt=?p=google' | 41 URL = 'https://search.yahoo.com/search;_ylt=?p=google' |
| 100 | 42 |
| 101 | 43 |
| 102 class LoadAmazonStory(_SinglePageStory): | 44 class LoadAmazonStory(_LoadingStory): |
| 103 NAME = 'load:search:amazon' | 45 NAME = 'load:search:amazon' |
| 104 URL = 'https://www.amazon.com/s/?field-keywords=nexus' | 46 URL = 'https://www.amazon.com/s/?field-keywords=nexus' |
| 105 | 47 |
| 106 | 48 |
| 107 class LoadTaobaoDesktopStory(_SinglePageStory): | 49 class LoadTaobaoDesktopStory(_LoadingStory): |
| 108 NAME = 'load:search:taobao' | 50 NAME = 'load:search:taobao' |
| 109 URL = 'https://world.taobao.com/' | 51 URL = 'https://world.taobao.com/' |
| 110 SUPPORTED_PLATFORMS = _DESKTOP_ONLY | 52 SUPPORTED_PLATFORMS = platforms.DESKTOP_ONLY |
| 111 | 53 |
| 112 | 54 |
| 113 class LoadTaobaoMobileStory(_SinglePageStory): | 55 class LoadTaobaoMobileStory(_LoadingStory): |
| 114 NAME = 'load:search:taobao' | 56 NAME = 'load:search:taobao' |
| 115 # "ali_trackid" in the URL suppresses "Download app" interstitial. | 57 # "ali_trackid" in the URL suppresses "Download app" interstitial. |
| 116 URL = 'http://m.intl.taobao.com/?ali_trackid' | 58 URL = 'http://m.intl.taobao.com/?ali_trackid' |
| 117 SUPPORTED_PLATFORMS = _MOBILE_ONLY | 59 SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY |
| 118 | 60 |
| 119 | 61 |
| 120 class LoadYandexStory(_SinglePageStory): | 62 class LoadYandexStory(_LoadingStory): |
| 121 NAME = 'load:search:yandex' | 63 NAME = 'load:search:yandex' |
| 122 URL = 'https://yandex.ru/touchsearch?text=science' | 64 URL = 'https://yandex.ru/touchsearch?text=science' |
| 123 | 65 |
| 124 | 66 |
| 125 class LoadEbayStory(_SinglePageStory): | 67 class LoadEbayStory(_LoadingStory): |
| 126 NAME = 'load:search:ebay' | 68 NAME = 'load:search:ebay' |
| 127 # Redirects to the "http://" version. | 69 # Redirects to the "http://" version. |
| 128 URL = 'https://www.ebay.com/sch/i.html?_nkw=headphones' | 70 URL = 'https://www.ebay.com/sch/i.html?_nkw=headphones' |
| 129 | 71 |
| 130 | 72 |
| 131 ################################################################################ | 73 ################################################################################ |
| 132 # Social networks. | 74 # Social networks. |
| 133 ################################################################################ | 75 ################################################################################ |
| 134 | 76 |
| 135 | 77 |
| 136 class LoadFacebookStory(_SinglePageStory): | 78 class LoadFacebookStory(_LoadingStory): |
| 137 # Using Facebook login often causes "404 Not Found" with WPR. | 79 # Using Facebook login often causes "404 Not Found" with WPR. |
| 138 NAME = 'load:social:facebook' | 80 NAME = 'load:social:facebook' |
| 139 URL = 'https://www.facebook.com/rihanna' | 81 URL = 'https://www.facebook.com/rihanna' |
| 140 | 82 |
| 141 | 83 |
| 142 class LoadTwitterStory(_SinglePageStory): | 84 class LoadTwitterStory(_LoadingStory): |
| 143 NAME = 'load:social:twitter' | 85 NAME = 'load:social:twitter' |
| 144 URL = 'https://www.twitter.com/justinbieber?skip_interstitial=true' | 86 URL = 'https://www.twitter.com/justinbieber?skip_interstitial=true' |
| 145 | 87 |
| 146 | 88 |
| 147 class LoadVkStory(_SinglePageStory): | 89 class LoadVkStory(_LoadingStory): |
| 148 NAME = 'load:social:vk' | 90 NAME = 'load:social:vk' |
| 149 URL = 'https://vk.com/sbeatles' | 91 URL = 'https://vk.com/sbeatles' |
| 150 # Due to the deterministic date injected by WPR (February 2008), the cookie | 92 # Due to the deterministic date injected by WPR (February 2008), the cookie |
| 151 # set by https://vk.com immediately expires, so the page keeps refreshing | 93 # set by https://vk.com immediately expires, so the page keeps refreshing |
| 152 # indefinitely on mobile | 94 # indefinitely on mobile |
| 153 # (see https://github.com/chromium/web-page-replay/issues/71). | 95 # (see https://github.com/chromium/web-page-replay/issues/71). |
| 154 SUPPORTED_PLATFORMS = _DESKTOP_ONLY | 96 SUPPORTED_PLATFORMS = platforms.DESKTOP_ONLY |
| 155 | 97 |
| 156 | 98 |
| 157 class LoadInstagramStory(_SinglePageStory): | 99 class LoadInstagramStory(_LoadingStory): |
| 158 NAME = 'load:social:instagram' | 100 NAME = 'load:social:instagram' |
| 159 URL = 'https://www.instagram.com/selenagomez/' | 101 URL = 'https://www.instagram.com/selenagomez/' |
| 160 | 102 |
| 161 | 103 |
| 162 class LoadPinterestStory(_SinglePageStory): | 104 class LoadPinterestStory(_LoadingStory): |
| 163 NAME = 'load:social:pinterest' | 105 NAME = 'load:social:pinterest' |
| 164 URL = 'https://uk.pinterest.com/categories/popular/' | 106 URL = 'https://uk.pinterest.com/categories/popular/' |
| 165 | 107 |
| 166 | 108 |
| 167 class LoadTumblrStory(_SinglePageStory): | 109 class LoadTumblrStory(_LoadingStory): |
| 168 NAME = 'load:social:tumblr' | 110 NAME = 'load:social:tumblr' |
| 169 # Redirects to the "http://" version. | 111 # Redirects to the "http://" version. |
| 170 URL = 'https://50thousand.tumblr.com/' | 112 URL = 'https://50thousand.tumblr.com/' |
| 171 | 113 |
| 172 | 114 |
| 173 ################################################################################ | 115 ################################################################################ |
| 174 # News, discussion and knowledge portals and blogs. | 116 # News, discussion and knowledge portals and blogs. |
| 175 ################################################################################ | 117 ################################################################################ |
| 176 | 118 |
| 177 | 119 |
| 178 class LoadBbcStory(_SinglePageStory): | 120 class LoadBbcStory(_LoadingStory): |
| 179 NAME = 'load:news:bbc' | 121 NAME = 'load:news:bbc' |
| 180 # Redirects to the "http://" version. | 122 # Redirects to the "http://" version. |
| 181 URL = 'https://www.bbc.co.uk/news/world-asia-china-36189636' | 123 URL = 'https://www.bbc.co.uk/news/world-asia-china-36189636' |
| 182 | 124 |
| 183 | 125 |
| 184 class LoadCnnStory(_SinglePageStory): | 126 class LoadCnnStory(_LoadingStory): |
| 185 NAME = 'load:news:cnn' | 127 NAME = 'load:news:cnn' |
| 186 # Using "https://" shows "Your connection is not private". | 128 # Using "https://" shows "Your connection is not private". |
| 187 URL = ( | 129 URL = 'http://edition.cnn.com' |
| 188 'http://edition.cnn.com/2016/05/02/health/three-habitable-planets-earth-dw
arf-star/index.html') | |
| 189 | 130 |
| 190 | 131 |
| 191 class LoadRedditDesktopStory(_SinglePageStory): | 132 class LoadHackerNewsStory(_LoadingStory): |
| 192 NAME = 'load:news:reddit' | 133 NAME = 'load:news:hackernews' |
| 193 URL = ( | 134 URL = 'https://news.ycombinator.com' |
| 194 'https://www.reddit.com/r/AskReddit/comments/4hi90e/whats_your_best_weddin
g_horror_story/') | |
| 195 SUPPORTED_PLATFORMS = _DESKTOP_ONLY | |
| 196 | 135 |
| 197 | 136 |
| 198 class LoadRedditMobileStory(_SinglePageStory): | 137 class LoadNytimesDesktopStory(_LoadingStory): |
| 199 NAME = 'load:news:reddit' | 138 NAME = 'load:news:nytimes' |
| 200 URL = ( | 139 URL = 'http://www.nytimes.com' |
| 201 'https://m.reddit.com/r/AskReddit/comments/4hi90e/whats_your_best_wedding_
horror_story/') | 140 SUPPORTED_PLATFORMS = platforms.DESKTOP_ONLY |
| 202 SUPPORTED_PLATFORMS = _MOBILE_ONLY | |
| 203 | 141 |
| 204 | 142 |
| 205 class LoadQqMobileStory(_SinglePageStory): | 143 class LoadNytimesMobileStory(_LoadingStory): |
| 144 NAME = 'load:news:nytimes' |
| 145 URL = 'http://mobile.nytimes.com' |
| 146 SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY |
| 147 |
| 148 |
| 149 class LoadQqMobileStory(_LoadingStory): |
| 206 NAME = 'load:news:qq' | 150 NAME = 'load:news:qq' |
| 207 # Using "https://" hangs and shows "This site can't be reached". | 151 # Using "https://" hangs and shows "This site can't be reached". |
| 208 URL = 'http://news.qq.com/a/20160503/003186.htm' | 152 URL = 'http://news.qq.com' |
| 209 | 153 |
| 210 | 154 |
| 211 class LoadSohuStory(_SinglePageStory): | 155 class LoadRedditDesktopStory(_LoadingStory): |
| 156 NAME = 'load:news:reddit' |
| 157 URL = 'https://www.reddit.com/r/news/top/?sort=top&t=week' |
| 158 SUPPORTED_PLATFORMS = platforms.DESKTOP_ONLY |
| 159 |
| 160 |
| 161 class LoadRedditMobileStory(_LoadingStory): |
| 162 NAME = 'load:news:reddit' |
| 163 URL = 'https://www.reddit.com/r/news/top/?sort=top&t=week' |
| 164 SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY |
| 165 |
| 166 |
| 167 class LoadSohuStory(_LoadingStory): |
| 212 NAME = 'load:news:sohu' | 168 NAME = 'load:news:sohu' |
| 213 # Using "https://" leads to missing images and scripts on mobile (due to | 169 # Using "https://" leads to missing images and scripts on mobile (due to |
| 214 # mixed content). | 170 # mixed content). |
| 215 URL = 'http://m.sohu.com/n/447433356/' | 171 URL = 'http://m.sohu.com/n/447433356/' |
| 216 # The desktop page (http://news.sohu.com/20160503/n447433356.shtml) almost | 172 # The desktop page (http://news.sohu.com/20160503/n447433356.shtml) almost |
| 217 # always fails to completely load due to | 173 # always fails to completely load due to |
| 218 # https://github.com/chromium/web-page-replay/issues/74. | 174 # https://github.com/chromium/web-page-replay/issues/74. |
| 219 SUPPORTED_PLATFORMS = _MOBILE_ONLY | 175 SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY |
| 220 | 176 |
| 221 | 177 |
| 222 class LoadWikipediaStory(_SinglePageStory): | 178 class LoadWashingtonPostMobileStory(_LoadingStory): |
| 179 NAME = 'load:news:washingtonpost' |
| 180 URL = 'https://www.washingtonpost.com/pwa' |
| 181 SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY |
| 182 |
| 183 def _DidLoadDocument(self, action_runner): |
| 184 # Close the popup window. |
| 185 action_runner.ClickElement(selector='.close') |
| 186 |
| 187 |
| 188 class LoadWikipediaStory(_LoadingStory): |
| 223 NAME = 'load:news:wikipedia' | 189 NAME = 'load:news:wikipedia' |
| 224 URL = 'https://en.wikipedia.org/wiki/Science' | 190 URL = 'https://en.wikipedia.org/wiki/Science' |
| 225 | 191 |
| 226 | 192 |
| 227 ################################################################################ | 193 ################################################################################ |
| 228 # Audio and video. | 194 # Audio and video. |
| 229 ################################################################################ | 195 ################################################################################ |
| 230 | 196 |
| 231 | 197 |
| 232 class LoadYouTubeStory(_SinglePageStory): | 198 class LoadYouTubeStory(_LoadingStory): |
| 233 # No way to disable autoplay on desktop. | 199 # No way to disable autoplay on desktop. |
| 234 NAME = 'load:media:youtube' | 200 NAME = 'load:media:youtube' |
| 235 URL = 'https://www.youtube.com/watch?v=QGfhS1hfTWw&autoplay=false' | 201 URL = 'https://www.youtube.com/watch?v=QGfhS1hfTWw&autoplay=false' |
| 236 | 202 |
| 237 | 203 |
| 238 class LoadDailymotionStory(_SinglePageStory): | 204 class LoadDailymotionStory(_LoadingStory): |
| 239 # The side panel with related videos doesn't show on desktop due to | 205 # The side panel with related videos doesn't show on desktop due to |
| 240 # https://github.com/chromium/web-page-replay/issues/74. | 206 # https://github.com/chromium/web-page-replay/issues/74. |
| 241 NAME = 'load:media:dailymotion' | 207 NAME = 'load:media:dailymotion' |
| 242 URL = ( | 208 URL = ( |
| 243 'https://www.dailymotion.com/video/x489k7d_street-performer-shows-off-slin
ky-skills_fun?autoplay=false') | 209 'https://www.dailymotion.com/video/x489k7d_street-performer-shows-off-slin
ky-skills_fun?autoplay=false') |
| 244 | 210 |
| 245 | 211 |
| 246 class LoadGoogleImagesStory(_SinglePageStory): | 212 class LoadGoogleImagesStory(_LoadingStory): |
| 247 NAME = 'load:media:google_images' | 213 NAME = 'load:media:google_images' |
| 248 URL = 'https://www.google.co.uk/search?tbm=isch&q=love' | 214 URL = 'https://www.google.co.uk/search?tbm=isch&q=love' |
| 249 | 215 |
| 250 | 216 |
| 251 class LoadSoundCloudStory(_SinglePageStory): | 217 class LoadSoundCloudStory(_LoadingStory): |
| 252 # No way to disable autoplay on desktop. Album artwork doesn't load due to | 218 # No way to disable autoplay on desktop. Album artwork doesn't load due to |
| 253 # https://github.com/chromium/web-page-replay/issues/73. | 219 # https://github.com/chromium/web-page-replay/issues/73. |
| 254 NAME = 'load:media:soundcloud' | 220 NAME = 'load:media:soundcloud' |
| 255 URL = 'https://soundcloud.com/lifeofdesiigner/desiigner-panda' | 221 URL = 'https://soundcloud.com/lifeofdesiigner/desiigner-panda' |
| 256 | 222 |
| 257 | 223 |
| 258 class Load9GagStory(_SinglePageStory): | 224 class Load9GagStory(_LoadingStory): |
| 259 NAME = 'load:media:9gag' | 225 NAME = 'load:media:9gag' |
| 260 URL = 'https://www.9gag.com/' | 226 URL = 'https://www.9gag.com/' |
| 261 | 227 |
| 262 | 228 |
| 263 class LoadFlickr(_SinglePageStory): | 229 class LoadFlickr(_LoadingStory): |
| 264 NAME = 'load:media:flickr' | 230 NAME = 'load:media:flickr' |
| 265 URL = 'https://www.flickr.com/photos/tags/farm' | 231 URL = 'https://www.flickr.com/photos/tags/farm' |
| 266 | 232 |
| 267 def _DidLoadDocument(self, action_runner): | 233 def _DidLoadDocument(self, action_runner): |
| 268 # Wait until the 'Recently tagged' view loads. | 234 # Wait until the 'Recently tagged' view loads. |
| 269 action_runner.WaitForJavaScriptCondition(''' | 235 action_runner.WaitForJavaScriptCondition(''' |
| 270 document.querySelector( | 236 document.querySelector( |
| 271 '.search-photos-everyone-trending-view .photo-list-view') | 237 '.search-photos-everyone-trending-view .photo-list-view') |
| 272 !== null''') | 238 !== null''') |
| 273 | 239 |
| 274 | 240 |
| 275 ################################################################################ | 241 ################################################################################ |
| 276 # Online tools (documents, emails, storage, ...). | 242 # Online tools (documents, emails, storage, ...). |
| 277 ################################################################################ | 243 ################################################################################ |
| 278 | 244 |
| 279 | 245 |
| 280 class LoadDocsStory(_SinglePageStory): | 246 class LoadDocsStory(_LoadingStory): |
| 281 NAME = 'load:tools:docs' | 247 NAME = 'load:tools:docs' |
| 282 URL = ( | 248 URL = ( |
| 283 'https://docs.google.com/document/d/1GvzDP-tTLmJ0myRhUAfTYWs3ZUFilUICg8psN
HyccwQ/edit?usp=sharing') | 249 'https://docs.google.com/document/d/1GvzDP-tTLmJ0myRhUAfTYWs3ZUFilUICg8psN
HyccwQ/edit?usp=sharing') |
| 284 | 250 |
| 285 | 251 |
| 286 class _LoadGmailBaseStory(_SinglePageStory): | 252 class _LoadGmailBaseStory(_LoadingStory): |
| 287 NAME = 'load:tools:gmail' | 253 NAME = 'load:tools:gmail' |
| 288 URL = 'https://mail.google.com/mail/' | 254 URL = 'https://mail.google.com/mail/' |
| 289 SUPPORTED_PLATFORMS = _NO_PLATFORMS | 255 SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY |
| 290 | 256 |
| 291 def _Login(self, action_runner): | 257 def _Login(self, action_runner): |
| 292 google_login.LoginGoogleAccount(action_runner, 'googletest', | 258 google_login.LoginGoogleAccount(action_runner, 'googletest', |
| 293 self.credentials_path) | 259 self.credentials_path) |
| 294 | 260 |
| 295 # Navigating to https://mail.google.com immediately leads to an infinite | 261 # Navigating to https://mail.google.com immediately leads to an infinite |
| 296 # redirection loop due to a bug in WPR (see | 262 # redirection loop due to a bug in WPR (see |
| 297 # https://github.com/chromium/web-page-replay/issues/70). We therefore first | 263 # https://github.com/chromium/web-page-replay/issues/70). We therefore first |
| 298 # navigate to a sub-URL to set up the session and hit the resulting | 264 # navigate to a sub-URL to set up the session and hit the resulting |
| 299 # redirection loop. Afterwards, we can safely navigate to | 265 # redirection loop. Afterwards, we can safely navigate to |
| 300 # https://mail.google.com. | 266 # https://mail.google.com. |
| 301 action_runner.Navigate( | 267 action_runner.Navigate( |
| 302 'https://mail.google.com/mail/mu/mp/872/trigger_redirection_loop') | 268 'https://mail.google.com/mail/mu/mp/872/trigger_redirection_loop') |
| 303 action_runner.tab.WaitForDocumentReadyStateToBeComplete() | 269 action_runner.tab.WaitForDocumentReadyStateToBeComplete() |
| 304 | 270 |
| 305 | 271 |
| 306 class LoadGmailDesktopStory(_LoadGmailBaseStory): | 272 class LoadGmailDesktopStory(_LoadGmailBaseStory): |
| 307 SUPPORTED_PLATFORMS = _DESKTOP_ONLY | 273 SUPPORTED_PLATFORMS = platforms.DESKTOP_ONLY |
| 308 | 274 |
| 309 def _DidLoadDocument(self, action_runner): | 275 def _DidLoadDocument(self, action_runner): |
| 310 # Wait until the UI loads. | 276 # Wait until the UI loads. |
| 311 action_runner.WaitForJavaScriptCondition( | 277 action_runner.WaitForJavaScriptCondition( |
| 312 'document.getElementById("loading").style.display === "none"') | 278 'document.getElementById("loading").style.display === "none"') |
| 313 | 279 |
| 314 class LoadGmailMobileStory(_LoadGmailBaseStory): | 280 class LoadGmailMobileStory(_LoadGmailBaseStory): |
| 315 SUPPORTED_PLATFORMS = _MOBILE_ONLY | 281 SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY |
| 316 | 282 |
| 317 def _DidLoadDocument(self, action_runner): | 283 def _DidLoadDocument(self, action_runner): |
| 318 # Close the "Get Inbox by Gmail" interstitial. | 284 # Close the "Get Inbox by Gmail" interstitial. |
| 319 action_runner.WaitForJavaScriptCondition( | 285 action_runner.WaitForJavaScriptCondition( |
| 320 'document.querySelector("#isppromo a") !== null') | 286 'document.querySelector("#isppromo a") !== null') |
| 321 action_runner.ExecuteJavaScript( | 287 action_runner.ExecuteJavaScript( |
| 322 'document.querySelector("#isppromo a").click()') | 288 'document.querySelector("#isppromo a").click()') |
| 323 # Wait until the UI loads. | 289 # Wait until the UI loads. |
| 324 action_runner.WaitForJavaScriptCondition( | 290 action_runner.WaitForJavaScriptCondition( |
| 325 'document.getElementById("apploadingdiv").style.height === "0px"') | 291 'document.getElementById("apploadingdiv").style.height === "0px"') |
| 326 | 292 |
| 327 | 293 |
| 328 class LoadMapsStory(_SinglePageStory): | 294 class LoadMapsStory(_LoadingStory): |
| 329 NAME = 'load:tools:maps' | 295 NAME = 'load:tools:maps' |
| 330 URL = 'https://www.google.com/maps/place/London,+UK/' | 296 URL = 'https://www.google.com/maps/place/London,+UK/' |
| 331 | 297 |
| 332 | 298 |
| 333 class LoadStackOverflowStory(_SinglePageStory): | 299 class LoadStackOverflowStory(_LoadingStory): |
| 334 NAME = 'load:tools:stackoverflow' | 300 NAME = 'load:tools:stackoverflow' |
| 335 URL = ( | 301 URL = ( |
| 336 'https://stackoverflow.com/questions/36827659/compiling-an-application-for
-use-in-highly-radioactive-environments') | 302 'https://stackoverflow.com/questions/36827659/compiling-an-application-for
-use-in-highly-radioactive-environments') |
| 337 | 303 |
| 338 | 304 |
| 339 class LoadDropboxStory(_SinglePageStory): | 305 class LoadDropboxStory(_LoadingStory): |
| 340 NAME = 'load:tools:dropbox' | 306 NAME = 'load:tools:dropbox' |
| 341 URL = 'https://www.dropbox.com' | 307 URL = 'https://www.dropbox.com' |
| 342 | 308 |
| 343 def _Login(self, action_runner): | 309 def _Login(self, action_runner): |
| 344 dropbox_login.LoginAccount(action_runner, 'dropbox', self.credentials_path) | 310 dropbox_login.LoginAccount(action_runner, 'dropbox', self.credentials_path) |
| 345 | 311 |
| 346 | 312 |
| 347 class LoadWeatherStory(_SinglePageStory): | 313 class LoadWeatherStory(_LoadingStory): |
| 348 NAME = 'load:tools:weather' | 314 NAME = 'load:tools:weather' |
| 349 URL = 'https://weather.com/en-GB/weather/today/l/USCA0286:1:US' | 315 URL = 'https://weather.com/en-GB/weather/today/l/USCA0286:1:US' |
| 350 | 316 |
| 351 | 317 |
| 352 class LoadDriveStory(_SinglePageStory): | 318 class LoadDriveStory(_LoadingStory): |
| 353 NAME = 'load:tools:drive' | 319 NAME = 'load:tools:drive' |
| 354 URL = 'https://drive.google.com/drive/my-drive' | 320 URL = 'https://drive.google.com/drive/my-drive' |
| 355 | 321 |
| 356 def _Login(self, action_runner): | 322 def _Login(self, action_runner): |
| 357 google_login.LoginGoogleAccount(action_runner, 'googletest', | 323 google_login.LoginGoogleAccount(action_runner, 'googletest', |
| 358 self.credentials_path) | 324 self.credentials_path) |
| 359 | 325 |
| 360 | 326 |
| 361 ################################################################################ | 327 ################################################################################ |
| 362 # In-browser games (HTML5 and Flash). | 328 # In-browser games (HTML5 and Flash). |
| 363 ################################################################################ | 329 ################################################################################ |
| 364 | 330 |
| 365 | 331 |
| 366 class LoadBubblesStory(_SinglePageStory): | 332 class LoadBubblesStory(_LoadingStory): |
| 367 NAME = 'load:games:bubbles' | 333 NAME = 'load:games:bubbles' |
| 368 URL = ( | 334 URL = ( |
| 369 'https://games.cdn.famobi.com/html5games/s/smarty-bubbles/v010/?fg_domain=
play.famobi.com&fg_uid=d8f24956-dc91-4902-9096-a46cb1353b6f&fg_pid=4638e320-4444
-4514-81c4-d80a8c662371&fg_beat=620') | 335 'https://games.cdn.famobi.com/html5games/s/smarty-bubbles/v010/?fg_domain=
play.famobi.com&fg_uid=d8f24956-dc91-4902-9096-a46cb1353b6f&fg_pid=4638e320-4444
-4514-81c4-d80a8c662371&fg_beat=620') |
| 370 | 336 |
| 371 def _DidLoadDocument(self, action_runner): | 337 def _DidLoadDocument(self, action_runner): |
| 372 # The #logo element is removed right before the main menu is displayed. | 338 # The #logo element is removed right before the main menu is displayed. |
| 373 action_runner.WaitForJavaScriptCondition( | 339 action_runner.WaitForJavaScriptCondition( |
| 374 'document.getElementById("logo") === null') | 340 'document.getElementById("logo") === null') |
| 375 | 341 |
| 376 | 342 |
| 377 class LoadLazorsStory(_SinglePageStory): | 343 class LoadLazorsStory(_LoadingStory): |
| 378 NAME = 'load:games:lazors' | 344 NAME = 'load:games:lazors' |
| 379 # Using "https://" hangs and shows "This site can't be reached". | 345 # Using "https://" hangs and shows "This site can't be reached". |
| 380 URL = 'http://www8.games.mobi/games/html5/lazors/lazors.html' | 346 URL = 'http://www8.games.mobi/games/html5/lazors/lazors.html' |
| 381 | 347 |
| 382 | 348 |
| 383 class LoadSpyChaseStory(_SinglePageStory): | 349 class LoadSpyChaseStory(_LoadingStory): |
| 384 NAME = 'load:games:spychase' | 350 NAME = 'load:games:spychase' |
| 385 # Using "https://" shows "Your connection is not private". | 351 # Using "https://" shows "Your connection is not private". |
| 386 URL = 'http://playstar.mobi/games/spychase/index.php' | 352 URL = 'http://playstar.mobi/games/spychase/index.php' |
| 387 | 353 |
| 388 def _DidLoadDocument(self, action_runner): | 354 def _DidLoadDocument(self, action_runner): |
| 389 # The background of the game canvas is set when the "Tap screen to play" | 355 # The background of the game canvas is set when the "Tap screen to play" |
| 390 # caption is displayed. | 356 # caption is displayed. |
| 391 action_runner.WaitForJavaScriptCondition( | 357 action_runner.WaitForJavaScriptCondition( |
| 392 'document.querySelector("#game canvas").style.background !== ""') | 358 'document.querySelector("#game canvas").style.background !== ""') |
| 393 | 359 |
| 394 | 360 |
| 395 class LoadMiniclipStory(_SinglePageStory): | 361 class LoadMiniclipStory(_LoadingStory): |
| 396 NAME = 'load:games:miniclip' | 362 NAME = 'load:games:miniclip' |
| 397 # Using "https://" causes "404 Not Found" during WPR recording. | 363 # Using "https://" causes "404 Not Found" during WPR recording. |
| 398 URL = 'http://www.miniclip.com/games/en/' | 364 URL = 'http://www.miniclip.com/games/en/' |
| 399 # Desktop only (requires Flash). | 365 # Desktop only (requires Flash). |
| 400 SUPPORTED_PLATFORMS = _DESKTOP_ONLY | 366 SUPPORTED_PLATFORMS = platforms.DESKTOP_ONLY |
| 401 | 367 |
| 402 | 368 |
| 403 class LoadAlphabettyStory(_SinglePageStory): | 369 class LoadAlphabettyStory(_LoadingStory): |
| 404 NAME = 'load:games:alphabetty' | 370 NAME = 'load:games:alphabetty' |
| 405 URL = 'https://king.com/play/alphabetty' | 371 URL = 'https://king.com/play/alphabetty' |
| 406 # Desktop only (requires Flash). | 372 # Desktop only (requires Flash). |
| 407 SUPPORTED_PLATFORMS = _DESKTOP_ONLY | 373 SUPPORTED_PLATFORMS = platforms.DESKTOP_ONLY |
| OLD | NEW |