OLD | NEW |
1 # Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 # pylint: disable=W0401,W0614 | 4 # pylint: disable=W0401,W0614 |
5 from telemetry.page.actions.all_page_actions import * | 5 from telemetry.page.actions.all_page_actions import * |
6 from telemetry.page import page as page_module | 6 from telemetry.page import page as page_module |
7 from telemetry.page import page_set as page_set_module | 7 from telemetry.page import page_set as page_set_module |
8 | 8 |
9 | 9 |
10 class KeySilkCasesPage(page_module.Page): | 10 class KeySilkCasesPage(page_module.Page): |
11 | 11 |
12 def __init__(self, url, page_set): | 12 def __init__(self, url, page_set): |
13 super(KeySilkCasesPage, self).__init__(url=url, page_set=page_set) | 13 super(KeySilkCasesPage, self).__init__(url=url, page_set=page_set) |
14 self.credentials_path = 'data/credentials.json' | 14 self.credentials_path = 'data/credentials.json' |
15 self.user_agent_type = 'mobile' | 15 self.user_agent_type = 'mobile' |
16 self.archive_data_file = 'data/key_silk_cases.json' | 16 self.archive_data_file = 'data/key_silk_cases.json' |
17 | 17 |
18 def RunNavigateSteps(self, action_runner): | 18 def RunNavigateSteps(self, action_runner): |
19 action_runner.NavigateToPage(self) | 19 action_runner.NavigateToPage(self) |
20 action_runner.RunAction(WaitAction( | 20 action_runner.Wait(2) |
21 { | |
22 'seconds': 2 | |
23 })) | |
24 | 21 |
25 def RunSmoothness(self, action_runner): | 22 def RunSmoothness(self, action_runner): |
26 action_runner.RunAction(ScrollAction()) | 23 action_runner.RunAction(ScrollAction()) |
27 | 24 |
28 | 25 |
29 class Page1(KeySilkCasesPage): | 26 class Page1(KeySilkCasesPage): |
30 | 27 |
31 """ Why: Infinite scroll. Brings out all of our perf issues. """ | 28 """ Why: Infinite scroll. Brings out all of our perf issues. """ |
32 | 29 |
33 def __init__(self, page_set): | 30 def __init__(self, page_set): |
(...skipping 14 matching lines...) Expand all Loading... |
48 class Page2(KeySilkCasesPage): | 45 class Page2(KeySilkCasesPage): |
49 | 46 |
50 """ Why: Brings out layer management bottlenecks. """ | 47 """ Why: Brings out layer management bottlenecks. """ |
51 | 48 |
52 def __init__(self, page_set): | 49 def __init__(self, page_set): |
53 super(Page2, self).__init__( | 50 super(Page2, self).__init__( |
54 url='http://groupcloned.com/test/plain/list-animation-simple.html', | 51 url='http://groupcloned.com/test/plain/list-animation-simple.html', |
55 page_set=page_set) | 52 page_set=page_set) |
56 | 53 |
57 def RunSmoothness(self, action_runner): | 54 def RunSmoothness(self, action_runner): |
58 action_runner.RunAction(WaitAction({'seconds': 2})) | 55 action_runner.Wait(2) |
59 | 56 |
60 | 57 |
61 class Page3(KeySilkCasesPage): | 58 class Page3(KeySilkCasesPage): |
62 | 59 |
63 """ | 60 """ |
64 Why: Best-known method for fake sticky. Janks sometimes. Interacts badly with | 61 Why: Best-known method for fake sticky. Janks sometimes. Interacts badly with |
65 compositor scrolls. | 62 compositor scrolls. |
66 """ | 63 """ |
67 | 64 |
68 def __init__(self, page_set): | 65 def __init__(self, page_set): |
(...skipping 18 matching lines...) Expand all Loading... |
87 Why: Card expansion: only the card should repaint, but in reality lots of | 84 Why: Card expansion: only the card should repaint, but in reality lots of |
88 storms happen. | 85 storms happen. |
89 """ | 86 """ |
90 | 87 |
91 def __init__(self, page_set): | 88 def __init__(self, page_set): |
92 super(Page4, self).__init__( | 89 super(Page4, self).__init__( |
93 url='http://jsfiddle.net/3yDKh/4/embedded/result', | 90 url='http://jsfiddle.net/3yDKh/4/embedded/result', |
94 page_set=page_set) | 91 page_set=page_set) |
95 | 92 |
96 def RunSmoothness(self, action_runner): | 93 def RunSmoothness(self, action_runner): |
97 action_runner.RunAction(WaitAction({'seconds': 3})) | 94 action_runner.Wait(3) |
98 | 95 |
99 | 96 |
100 class Page5(KeySilkCasesPage): | 97 class Page5(KeySilkCasesPage): |
101 | 98 |
102 """ | 99 """ |
103 Why: Card expansion with animated contents, using will-change on the card | 100 Why: Card expansion with animated contents, using will-change on the card |
104 """ | 101 """ |
105 | 102 |
106 def __init__(self, page_set): | 103 def __init__(self, page_set): |
107 super(Page5, self).__init__( | 104 super(Page5, self).__init__( |
108 url='http://jsfiddle.net/jx5De/13/embedded/result', | 105 url='http://jsfiddle.net/jx5De/13/embedded/result', |
109 page_set=page_set) | 106 page_set=page_set) |
110 | 107 |
111 self.gpu_raster = True | 108 self.gpu_raster = True |
112 | 109 |
113 def RunSmoothness(self, action_runner): | 110 def RunSmoothness(self, action_runner): |
114 action_runner.RunAction(WaitAction({'seconds': 4})) | 111 action_runner.Wait(4) |
115 | 112 |
116 | 113 |
117 class Page6(KeySilkCasesPage): | 114 class Page6(KeySilkCasesPage): |
118 | 115 |
119 """ | 116 """ |
120 Why: Card fly-in: It should be fast to animate in a bunch of cards using | 117 Why: Card fly-in: It should be fast to animate in a bunch of cards using |
121 margin-top and letting layout do the rest. | 118 margin-top and letting layout do the rest. |
122 """ | 119 """ |
123 | 120 |
124 def __init__(self, page_set): | 121 def __init__(self, page_set): |
125 super(Page6, self).__init__( | 122 super(Page6, self).__init__( |
126 url='http://jsfiddle.net/3yDKh/6/embedded/result', | 123 url='http://jsfiddle.net/3yDKh/6/embedded/result', |
127 page_set=page_set) | 124 page_set=page_set) |
128 | 125 |
129 def RunSmoothness(self, action_runner): | 126 def RunSmoothness(self, action_runner): |
130 action_runner.RunAction(WaitAction({'seconds': 3})) | 127 action_runner.Wait(3) |
131 | 128 |
132 | 129 |
133 class Page7(KeySilkCasesPage): | 130 class Page7(KeySilkCasesPage): |
134 | 131 |
135 """ | 132 """ |
136 Why: Image search expands a spacer div when you click an image to accomplish | 133 Why: Image search expands a spacer div when you click an image to accomplish |
137 a zoomin effect. Each image has a layer. Even so, this triggers a lot of | 134 a zoomin effect. Each image has a layer. Even so, this triggers a lot of |
138 unnecessary repainting. | 135 unnecessary repainting. |
139 """ | 136 """ |
140 | 137 |
141 def __init__(self, page_set): | 138 def __init__(self, page_set): |
142 super(Page7, self).__init__( | 139 super(Page7, self).__init__( |
143 url='http://jsfiddle.net/R8DX9/1/embedded/result/', | 140 url='http://jsfiddle.net/R8DX9/1/embedded/result/', |
144 page_set=page_set) | 141 page_set=page_set) |
145 | 142 |
146 def RunSmoothness(self, action_runner): | 143 def RunSmoothness(self, action_runner): |
147 action_runner.RunAction(WaitAction({'seconds': 3})) | 144 action_runner.Wait(3) |
148 | 145 |
149 | 146 |
150 class Page8(KeySilkCasesPage): | 147 class Page8(KeySilkCasesPage): |
151 | 148 |
152 """ | 149 """ |
153 Why: Swipe to dismiss of an element that has a fixed-position child that is | 150 Why: Swipe to dismiss of an element that has a fixed-position child that is |
154 its pseudo-sticky header. Brings out issues with layer creation and | 151 its pseudo-sticky header. Brings out issues with layer creation and |
155 repainting. | 152 repainting. |
156 """ | 153 """ |
157 | 154 |
158 def __init__(self, page_set): | 155 def __init__(self, page_set): |
159 super(Page8, self).__init__( | 156 super(Page8, self).__init__( |
160 url='http://jsfiddle.net/rF9Gh/3/embedded/result/', | 157 url='http://jsfiddle.net/rF9Gh/3/embedded/result/', |
161 page_set=page_set) | 158 page_set=page_set) |
162 | 159 |
163 def RunSmoothness(self, action_runner): | 160 def RunSmoothness(self, action_runner): |
164 action_runner.RunAction(WaitAction({'seconds': 3})) | 161 action_runner.Wait(3) |
165 | 162 |
166 | 163 |
167 class Page9(KeySilkCasesPage): | 164 class Page9(KeySilkCasesPage): |
168 | 165 |
169 """ | 166 """ |
170 Why: Horizontal and vertical expansion of a card that is cheap to layout but | 167 Why: Horizontal and vertical expansion of a card that is cheap to layout but |
171 costly to rasterize. | 168 costly to rasterize. |
172 """ | 169 """ |
173 | 170 |
174 def __init__(self, page_set): | 171 def __init__(self, page_set): |
175 super(Page9, self).__init__( | 172 super(Page9, self).__init__( |
176 url='http://jsfiddle.net/TLXLu/2/embedded/result/', | 173 url='http://jsfiddle.net/TLXLu/2/embedded/result/', |
177 page_set=page_set) | 174 page_set=page_set) |
178 | 175 |
179 self.gpu_raster = True | 176 self.gpu_raster = True |
180 | 177 |
181 def RunSmoothness(self, action_runner): | 178 def RunSmoothness(self, action_runner): |
182 action_runner.RunAction(WaitAction({'seconds': 4})) | 179 action_runner.Wait(4) |
183 | 180 |
184 | 181 |
185 class Page10(KeySilkCasesPage): | 182 class Page10(KeySilkCasesPage): |
186 | 183 |
187 """ | 184 """ |
188 Why: Vertical Expansion of a card that is cheap to layout but costly to | 185 Why: Vertical Expansion of a card that is cheap to layout but costly to |
189 rasterize. | 186 rasterize. |
190 """ | 187 """ |
191 | 188 |
192 def __init__(self, page_set): | 189 def __init__(self, page_set): |
193 super(Page10, self).__init__( | 190 super(Page10, self).__init__( |
194 url='http://jsfiddle.net/cKB9D/6/embedded/result/', | 191 url='http://jsfiddle.net/cKB9D/6/embedded/result/', |
195 page_set=page_set) | 192 page_set=page_set) |
196 | 193 |
197 self.gpu_raster = True | 194 self.gpu_raster = True |
198 | 195 |
199 def RunSmoothness(self, action_runner): | 196 def RunSmoothness(self, action_runner): |
200 action_runner.RunAction(WaitAction({'seconds': 4})) | 197 action_runner.Wait(4) |
201 | 198 |
202 | 199 |
203 class Page11(KeySilkCasesPage): | 200 class Page11(KeySilkCasesPage): |
204 | 201 |
205 """ | 202 """ |
206 Why: Parallax effect is common on photo-viewer-like applications, overloading | 203 Why: Parallax effect is common on photo-viewer-like applications, overloading |
207 software rasterization | 204 software rasterization |
208 """ | 205 """ |
209 | 206 |
210 def __init__(self, page_set): | 207 def __init__(self, page_set): |
211 super(Page11, self).__init__( | 208 super(Page11, self).__init__( |
212 url='http://jsfiddle.net/vBQHH/10/embedded/result/', | 209 url='http://jsfiddle.net/vBQHH/10/embedded/result/', |
213 page_set=page_set) | 210 page_set=page_set) |
214 | 211 |
215 self.gpu_raster = True | 212 self.gpu_raster = True |
216 | 213 |
217 def RunSmoothness(self, action_runner): | 214 def RunSmoothness(self, action_runner): |
218 action_runner.RunAction(WaitAction({'seconds': 4})) | 215 action_runner.Wait(4) |
219 | 216 |
220 | 217 |
221 class Page12(KeySilkCasesPage): | 218 class Page12(KeySilkCasesPage): |
222 | 219 |
223 """ Why: Addressing paint storms during coordinated animations. """ | 220 """ Why: Addressing paint storms during coordinated animations. """ |
224 | 221 |
225 def __init__(self, page_set): | 222 def __init__(self, page_set): |
226 super(Page12, self).__init__( | 223 super(Page12, self).__init__( |
227 url='http://jsfiddle.net/ugkd4/9/embedded/result/', | 224 url='http://jsfiddle.net/ugkd4/9/embedded/result/', |
228 page_set=page_set) | 225 page_set=page_set) |
229 | 226 |
230 def RunSmoothness(self, action_runner): | 227 def RunSmoothness(self, action_runner): |
231 action_runner.RunAction(WaitAction({'seconds': 5})) | 228 action_runner.Wait(5) |
232 | 229 |
233 | 230 |
234 class Page13(KeySilkCasesPage): | 231 class Page13(KeySilkCasesPage): |
235 | 232 |
236 """ Why: Mask transitions are common mobile use cases. """ | 233 """ Why: Mask transitions are common mobile use cases. """ |
237 | 234 |
238 def __init__(self, page_set): | 235 def __init__(self, page_set): |
239 super(Page13, self).__init__( | 236 super(Page13, self).__init__( |
240 url='http://jsfiddle.net/xLuvC/embedded/result/', | 237 url='http://jsfiddle.net/xLuvC/embedded/result/', |
241 page_set=page_set) | 238 page_set=page_set) |
242 | 239 |
243 self.gpu_raster = True | 240 self.gpu_raster = True |
244 | 241 |
245 def RunSmoothness(self, action_runner): | 242 def RunSmoothness(self, action_runner): |
246 action_runner.RunAction(WaitAction({'seconds': 4})) | 243 action_runner.Wait(4) |
247 | 244 |
248 | 245 |
249 class Page14(KeySilkCasesPage): | 246 class Page14(KeySilkCasesPage): |
250 | 247 |
251 """ Why: Card expansions with images and text are pretty and common. """ | 248 """ Why: Card expansions with images and text are pretty and common. """ |
252 | 249 |
253 def __init__(self, page_set): | 250 def __init__(self, page_set): |
254 super(Page14, self).__init__( | 251 super(Page14, self).__init__( |
255 url='http://jsfiddle.net/bNp2h/1/embedded/result/', | 252 url='http://jsfiddle.net/bNp2h/1/embedded/result/', |
256 page_set=page_set) | 253 page_set=page_set) |
257 | 254 |
258 self.gpu_raster = True | 255 self.gpu_raster = True |
259 | 256 |
260 def RunSmoothness(self, action_runner): | 257 def RunSmoothness(self, action_runner): |
261 action_runner.RunAction(WaitAction({'seconds': 4})) | 258 action_runner.Wait(4) |
262 | 259 |
263 | 260 |
264 class Page15(KeySilkCasesPage): | 261 class Page15(KeySilkCasesPage): |
265 | 262 |
266 """ Why: Coordinated animations for expanding elements. """ | 263 """ Why: Coordinated animations for expanding elements. """ |
267 | 264 |
268 def __init__(self, page_set): | 265 def __init__(self, page_set): |
269 super(Page15, self).__init__( | 266 super(Page15, self).__init__( |
270 url='file://key_silk_cases/font_wipe.html', | 267 url='file://key_silk_cases/font_wipe.html', |
271 page_set=page_set) | 268 page_set=page_set) |
272 | 269 |
273 def RunSmoothness(self, action_runner): | 270 def RunSmoothness(self, action_runner): |
274 action_runner.RunAction(WaitAction({'seconds': 5})) | 271 action_runner.Wait(5) |
275 | 272 |
276 | 273 |
277 class Page16(KeySilkCasesPage): | 274 class Page16(KeySilkCasesPage): |
278 | 275 |
279 def __init__(self, page_set): | 276 def __init__(self, page_set): |
280 super(Page16, self).__init__( | 277 super(Page16, self).__init__( |
281 url='file://key_silk_cases/inbox_app.html?swipe_to_dismiss', | 278 url='file://key_silk_cases/inbox_app.html?swipe_to_dismiss', |
282 page_set=page_set) | 279 page_set=page_set) |
283 | 280 |
284 def RunNavigateSteps(self, action_runner): | 281 def RunNavigateSteps(self, action_runner): |
285 action_runner.NavigateToPage(self) | 282 action_runner.NavigateToPage(self) |
286 action_runner.RunAction(WaitAction({'seconds': 2})) | 283 action_runner.Wait(2) |
287 | 284 |
288 def SwipeToDismiss(self, action_runner): | 285 def SwipeToDismiss(self, action_runner): |
289 action_runner.RunAction(SwipeAction( | 286 action_runner.RunAction(SwipeAction( |
290 { | 287 { |
291 'left_start_percentage': 0.8, | 288 'left_start_percentage': 0.8, |
292 'distance': 200, | 289 'distance': 200, |
293 'direction': 'left', | 290 'direction': 'left', |
294 'top_start_percentage': 0.2, | 291 'top_start_percentage': 0.2, |
295 'element_function': ''' | 292 'element_function': ''' |
296 function(callback) { | 293 function(callback) { |
297 callback(document.getElementsByClassName('message')[2]); | 294 callback(document.getElementsByClassName('message')[2]); |
298 }''', | 295 }''', |
299 'speed': 5000 | 296 'speed': 5000 |
300 })) | 297 })) |
301 interaction = action_runner.BeginInteraction('Wait', is_smooth=True) | 298 interaction = action_runner.BeginInteraction('Wait', is_smooth=True) |
302 action_runner.RunAction(WaitAction({ | 299 action_runner.WaitForJavaScriptCondition( |
303 'javascript': 'document.getElementsByClassName("message").length < 18' | 300 'document.getElementsByClassName("message").length < 18') |
304 })) | |
305 interaction.End() | 301 interaction.End() |
306 | 302 |
307 def RunSmoothness(self, action_runner): | 303 def RunSmoothness(self, action_runner): |
308 self.SwipeToDismiss(action_runner) | 304 self.SwipeToDismiss(action_runner) |
309 | 305 |
310 | 306 |
311 class Page17(KeySilkCasesPage): | 307 class Page17(KeySilkCasesPage): |
312 | 308 |
313 def __init__(self, page_set): | 309 def __init__(self, page_set): |
314 super(Page17, self).__init__( | 310 super(Page17, self).__init__( |
315 url='file://key_silk_cases/inbox_app.html?stress_hidey_bars', | 311 url='file://key_silk_cases/inbox_app.html?stress_hidey_bars', |
316 page_set=page_set) | 312 page_set=page_set) |
317 | 313 |
318 def RunNavigateSteps(self, action_runner): | 314 def RunNavigateSteps(self, action_runner): |
319 action_runner.NavigateToPage(self) | 315 action_runner.NavigateToPage(self) |
320 action_runner.RunAction(WaitAction({'seconds': 2})) | 316 action_runner.Wait(2) |
321 | 317 |
322 def RunSmoothness(self, action_runner): | 318 def RunSmoothness(self, action_runner): |
323 self.StressHideyBars(action_runner) | 319 self.StressHideyBars(action_runner) |
324 | 320 |
325 def StressHideyBars(self, action_runner): | 321 def StressHideyBars(self, action_runner): |
326 action_runner.RunAction(ScrollAction( | 322 action_runner.RunAction(ScrollAction( |
327 { | 323 { |
328 'direction': 'down', | 324 'direction': 'down', |
329 'speed': 200, | 325 'speed': 200, |
330 'scrollable_element_function': ''' | 326 'scrollable_element_function': ''' |
(...skipping 23 matching lines...) Expand all Loading... |
354 | 350 |
355 class Page18(KeySilkCasesPage): | 351 class Page18(KeySilkCasesPage): |
356 | 352 |
357 def __init__(self, page_set): | 353 def __init__(self, page_set): |
358 super(Page18, self).__init__( | 354 super(Page18, self).__init__( |
359 url='file://key_silk_cases/inbox_app.html?toggle_drawer', | 355 url='file://key_silk_cases/inbox_app.html?toggle_drawer', |
360 page_set=page_set) | 356 page_set=page_set) |
361 | 357 |
362 def RunNavigateSteps(self, action_runner): | 358 def RunNavigateSteps(self, action_runner): |
363 action_runner.NavigateToPage(self) | 359 action_runner.NavigateToPage(self) |
364 action_runner.RunAction(WaitAction( | 360 action_runner.Wait(2) |
365 { | |
366 'seconds': 2 | |
367 })) | |
368 | 361 |
369 def RunSmoothness(self, action_runner): | 362 def RunSmoothness(self, action_runner): |
370 for _ in xrange(6): | 363 for _ in xrange(6): |
371 self.ToggleDrawer(action_runner) | 364 self.ToggleDrawer(action_runner) |
372 | 365 |
373 def ToggleDrawer(self, action_runner): | 366 def ToggleDrawer(self, action_runner): |
374 action_runner.RunAction(TapAction( | 367 action_runner.RunAction(TapAction( |
375 { | 368 { |
376 'selector': '#menu-button', | 369 'selector': '#menu-button', |
377 'wait_after' : {'seconds': 1} | 370 'wait_after' : {'seconds': 1} |
378 })) | 371 })) |
379 | 372 |
380 | 373 |
381 class Page19(KeySilkCasesPage): | 374 class Page19(KeySilkCasesPage): |
382 | 375 |
383 def __init__(self, page_set): | 376 def __init__(self, page_set): |
384 super(Page19, self).__init__( | 377 super(Page19, self).__init__( |
385 url='file://key_silk_cases/inbox_app.html?slide_drawer', | 378 url='file://key_silk_cases/inbox_app.html?slide_drawer', |
386 page_set=page_set) | 379 page_set=page_set) |
387 | 380 |
388 def ToggleDrawer(self, action_runner): | 381 def ToggleDrawer(self, action_runner): |
389 action_runner.RunAction(TapAction( | 382 action_runner.RunAction(TapAction( |
390 { | 383 { |
391 'selector': '#menu-button' | 384 'selector': '#menu-button' |
392 })) | 385 })) |
393 interaction = action_runner.BeginInteraction('Wait', is_smooth=True) | 386 interaction = action_runner.BeginInteraction('Wait', is_smooth=True) |
394 action_runner.RunAction(WaitAction({ | 387 action_runner.WaitForJavaScriptCondition( |
395 'javascript': 'document.getElementById("nav-drawer").active' | 388 'document.getElementById("nav-drawer").active') |
396 })) | |
397 interaction.End() | 389 interaction.End() |
398 | 390 |
399 | 391 |
400 def RunNavigateSteps(self, action_runner): | 392 def RunNavigateSteps(self, action_runner): |
401 action_runner.NavigateToPage(self) | 393 action_runner.NavigateToPage(self) |
402 action_runner.RunAction(WaitAction({'seconds': 2})) | 394 action_runner.Wait(2) |
403 self.ToggleDrawer(action_runner) | 395 self.ToggleDrawer(action_runner) |
404 | 396 |
405 def RunSmoothness(self, action_runner): | 397 def RunSmoothness(self, action_runner): |
406 self.SlideDrawer(action_runner) | 398 self.SlideDrawer(action_runner) |
407 | 399 |
408 def SlideDrawer(self, action_runner): | 400 def SlideDrawer(self, action_runner): |
409 action_runner.RunAction(SwipeAction( | 401 action_runner.RunAction(SwipeAction( |
410 { | 402 { |
411 'left_start_percentage': 0.8, | 403 'left_start_percentage': 0.8, |
412 'distance': 200, | 404 'distance': 200, |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
469 'element_function': ''' | 461 'element_function': ''' |
470 function(callback) { | 462 function(callback) { |
471 callback(document.getElementsByClassName("vk_arc")[0]); | 463 callback(document.getElementsByClassName("vk_arc")[0]); |
472 }''', | 464 }''', |
473 'wait_after': {'seconds': 2} | 465 'wait_after': {'seconds': 2} |
474 })) | 466 })) |
475 | 467 |
476 | 468 |
477 def RunNavigateSteps(self, action_runner): | 469 def RunNavigateSteps(self, action_runner): |
478 action_runner.NavigateToPage(self) | 470 action_runner.NavigateToPage(self) |
479 action_runner.RunAction(WaitAction({'seconds': 3})) | 471 action_runner.Wait(3) |
480 self.ScrollKnowledgeCardToTop(action_runner) | 472 self.ScrollKnowledgeCardToTop(action_runner) |
481 | 473 |
482 def RunSmoothness(self, action_runner): | 474 def RunSmoothness(self, action_runner): |
483 self.ExpandKnowledgeCard(action_runner) | 475 self.ExpandKnowledgeCard(action_runner) |
484 | 476 |
485 | 477 |
486 class Page22(KeySilkCasesPage): | 478 class Page22(KeySilkCasesPage): |
487 | 479 |
488 def __init__(self, page_set): | 480 def __init__(self, page_set): |
489 super(Page22, self).__init__( | 481 super(Page22, self).__init__( |
490 url='http://plus.google.com/app/basic/stream', | 482 url='http://plus.google.com/app/basic/stream', |
491 page_set=page_set) | 483 page_set=page_set) |
492 | 484 |
493 self.disabled = 'Times out on Windows; crbug.com/338838' | 485 self.disabled = 'Times out on Windows; crbug.com/338838' |
494 self.credentials = 'google' | 486 self.credentials = 'google' |
495 | 487 |
496 def RunNavigateSteps(self, action_runner): | 488 def RunNavigateSteps(self, action_runner): |
497 action_runner.NavigateToPage(self) | 489 action_runner.NavigateToPage(self) |
498 action_runner.RunAction(WaitAction( | 490 action_runner.WaitForJavaScriptCondition( |
499 { | 491 'document.getElementsByClassName("fHa").length > 0') |
500 'javascript': 'document.getElementsByClassName("fHa").length > 0' | 492 action_runner.Wait(2) |
501 })) | |
502 action_runner.RunAction(WaitAction( | |
503 { | |
504 'seconds': 2 | |
505 })) | |
506 | 493 |
507 def RunSmoothness(self, action_runner): | 494 def RunSmoothness(self, action_runner): |
508 action_runner.RunAction(ScrollAction( | 495 action_runner.RunAction(ScrollAction( |
509 { | 496 { |
510 'scrollable_element_function': ''' | 497 'scrollable_element_function': ''' |
511 function(callback) { | 498 function(callback) { |
512 callback(document.getElementById('mainContent')); | 499 callback(document.getElementById('mainContent')); |
513 }''' | 500 }''' |
514 })) | 501 })) |
515 | 502 |
(...skipping 12 matching lines...) Expand all Loading... |
528 | 515 |
529 def RunSmoothness(self, action_runner): | 516 def RunSmoothness(self, action_runner): |
530 action_runner.RunAction(ScrollAction( | 517 action_runner.RunAction(ScrollAction( |
531 { | 518 { |
532 'direction': 'down', | 519 'direction': 'down', |
533 'scroll_requires_touch': True, | 520 'scroll_requires_touch': True, |
534 'scroll_distance_function': | 521 'scroll_distance_function': |
535 'function() { return window.innerHeight / 2; }' | 522 'function() { return window.innerHeight / 2; }' |
536 })) | 523 })) |
537 interaction = action_runner.BeginInteraction('Wait', is_smooth=True) | 524 interaction = action_runner.BeginInteraction('Wait', is_smooth=True) |
538 action_runner.RunAction(WaitAction({'seconds' : 1})) | 525 action_runner.Wait(1) |
539 interaction.End() | 526 interaction.End() |
540 | 527 |
541 | 528 |
542 class Page24(KeySilkCasesPage): | 529 class Page24(KeySilkCasesPage): |
543 | 530 |
544 """ | 531 """ |
545 Why: Google News: this iOS version is slower than accelerated scrolling | 532 Why: Google News: this iOS version is slower than accelerated scrolling |
546 """ | 533 """ |
547 | 534 |
548 def __init__(self, page_set): | 535 def __init__(self, page_set): |
549 super(Page24, self).__init__( | 536 super(Page24, self).__init__( |
550 url='http://mobile-news.sandbox.google.com/news/pt0?scroll', | 537 url='http://mobile-news.sandbox.google.com/news/pt0?scroll', |
551 page_set=page_set) | 538 page_set=page_set) |
552 | 539 |
553 def RunNavigateSteps(self, action_runner): | 540 def RunNavigateSteps(self, action_runner): |
554 action_runner.NavigateToPage(self) | 541 action_runner.NavigateToPage(self) |
555 action_runner.RunAction(WaitAction( | 542 action_runner.WaitForJavaScriptCondition( |
556 { | 543 'document.getElementById(":h") != null') |
557 'javascript': 'document.getElementById(":h") != null' | 544 action_runner.Wait(1) |
558 })) | |
559 action_runner.RunAction(WaitAction( | |
560 { | |
561 'seconds': 1 | |
562 })) | |
563 | 545 |
564 def RunSmoothness(self, action_runner): | 546 def RunSmoothness(self, action_runner): |
565 action_runner.RunAction(ScrollAction( | 547 action_runner.RunAction(ScrollAction( |
566 { | 548 { |
567 'scroll_distance_function': 'function() { return 2500; }', | 549 'scroll_distance_function': 'function() { return 2500; }', |
568 'scrollable_element_function': | 550 'scrollable_element_function': |
569 'function(callback) { callback(document.getElementById(":5")); }', | 551 'function(callback) { callback(document.getElementById(":5")); }', |
570 'scroll_requires_touch': True | 552 'scroll_requires_touch': True |
571 })) | 553 })) |
572 | 554 |
573 | 555 |
574 class Page25(KeySilkCasesPage): | 556 class Page25(KeySilkCasesPage): |
575 | 557 |
576 def __init__(self, page_set): | 558 def __init__(self, page_set): |
577 super(Page25, self).__init__( | 559 super(Page25, self).__init__( |
578 url='http://mobile-news.sandbox.google.com/news/pt0?swipe', | 560 url='http://mobile-news.sandbox.google.com/news/pt0?swipe', |
579 page_set=page_set) | 561 page_set=page_set) |
580 | 562 |
581 def RunNavigateSteps(self, action_runner): | 563 def RunNavigateSteps(self, action_runner): |
582 action_runner.NavigateToPage(self) | 564 action_runner.NavigateToPage(self) |
583 action_runner.RunAction(WaitAction( | 565 action_runner.WaitForJavaScriptCondition( |
584 { | 566 'document.getElementById(":h") != null') |
585 'javascript': 'document.getElementById(":h") != null' | 567 action_runner.Wait(1) |
586 })) | |
587 action_runner.RunAction(WaitAction( | |
588 { | |
589 'seconds': 1 | |
590 })) | |
591 | 568 |
592 def RunSmoothness(self, action_runner): | 569 def RunSmoothness(self, action_runner): |
593 action_runner.RunAction(SwipeAction( | 570 action_runner.RunAction(SwipeAction( |
594 { | 571 { |
595 'distance': 100, | 572 'distance': 100, |
596 'direction': "left", | 573 'direction': "left", |
597 'element_function': ''' | 574 'element_function': ''' |
598 function(callback) { | 575 function(callback) { |
599 callback(document.getElementById(':f')); | 576 callback(document.getElementById(':f')); |
600 }''' | 577 }''' |
601 })) | 578 })) |
602 interaction = action_runner.BeginInteraction('Wait', is_smooth=True) | 579 interaction = action_runner.BeginInteraction('Wait', is_smooth=True) |
603 action_runner.RunAction(WaitAction({'seconds' : 1})) | 580 action_runner.Wait(1) |
604 interaction.End() | 581 interaction.End() |
605 | 582 |
606 | 583 |
607 class Page26(KeySilkCasesPage): | 584 class Page26(KeySilkCasesPage): |
608 | 585 |
609 """ Why: famo.us twitter demo """ | 586 """ Why: famo.us twitter demo """ |
610 | 587 |
611 def __init__(self, page_set): | 588 def __init__(self, page_set): |
612 super(Page26, self).__init__( | 589 super(Page26, self).__init__( |
613 url='http://s.codepen.io/befamous/fullpage/pFsqb?scroll', | 590 url='http://s.codepen.io/befamous/fullpage/pFsqb?scroll', |
614 page_set=page_set) | 591 page_set=page_set) |
615 | 592 |
616 def RunNavigateSteps(self, action_runner): | 593 def RunNavigateSteps(self, action_runner): |
617 action_runner.NavigateToPage(self) | 594 action_runner.NavigateToPage(self) |
618 action_runner.RunAction(WaitAction( | 595 action_runner.WaitForJavaScriptCondition( |
619 { | 596 'document.getElementsByClassName("tweet").length > 0') |
620 'javascript': 'document.getElementsByClassName("tweet").length > 0' | 597 action_runner.Wait(1) |
621 })) | |
622 action_runner.RunAction(WaitAction( | |
623 { | |
624 'seconds': 1 | |
625 })) | |
626 | 598 |
627 def RunSmoothness(self, action_runner): | 599 def RunSmoothness(self, action_runner): |
628 action_runner.RunAction(ScrollAction( | 600 action_runner.RunAction(ScrollAction( |
629 { | 601 { |
630 'scroll_distance_function': 'function() { return 5000; }' | 602 'scroll_distance_function': 'function() { return 5000; }' |
631 })) | 603 })) |
632 | 604 |
633 | 605 |
634 class KeySilkCasesPageSet(page_set_module.PageSet): | 606 class KeySilkCasesPageSet(page_set_module.PageSet): |
635 | 607 |
(...skipping 24 matching lines...) Expand all Loading... |
660 self.AddPage(Page17(self)) | 632 self.AddPage(Page17(self)) |
661 self.AddPage(Page18(self)) | 633 self.AddPage(Page18(self)) |
662 self.AddPage(Page19(self)) | 634 self.AddPage(Page19(self)) |
663 self.AddPage(Page20(self)) | 635 self.AddPage(Page20(self)) |
664 self.AddPage(Page21(self)) | 636 self.AddPage(Page21(self)) |
665 self.AddPage(Page22(self)) | 637 self.AddPage(Page22(self)) |
666 self.AddPage(Page23(self)) | 638 self.AddPage(Page23(self)) |
667 self.AddPage(Page24(self)) | 639 self.AddPage(Page24(self)) |
668 self.AddPage(Page25(self)) | 640 self.AddPage(Page25(self)) |
669 self.AddPage(Page26(self)) | 641 self.AddPage(Page26(self)) |
OLD | NEW |