Commit 58ec0f4f authored by ykyyip@chromium.org's avatar ykyyip@chromium.org

add polymer calculator pageset

BUG=333078

Review URL: https://codereview.chromium.org/247283006

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@266392 0039d316-1c4b-4281-b951-d872f2087c98
parent fdc74404
{
"description": "Describes the Web Page Replay archives for a page set. Don't edit by hand! Use record_wpr for updating.",
"archives": {
"polymer_000.wpr": [
"http://localhost:8000/components/paper-calculator/demo.html"
]
}
}
\ No newline at end of file
308553ef02178a571414d551f8a2084438ec49a5
\ No newline at end of file
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# pylint: disable=W0401,W0614
from telemetry.page.actions.all_page_actions import *
from telemetry.page import page as page_module
from telemetry.page import page_set as page_set_module
class PolymerCalculatorPage(page_module.PageWithDefaultRunNavigate):
def __init__(self, page_set):
super(PolymerCalculatorPage, self).__init__(
url='http://localhost:8000/components/paper-calculator/demo.html',
page_set=page_set)
self.user_agent_type = 'mobile'
self.archive_data_file = 'data/polymer.json'
def RunNavigateSteps(self, action_runner):
action_runner.RunAction(NavigateAction())
action_runner.RunAction(WaitAction(
{
'seconds': 2
}))
def RunSmoothness(self, action_runner):
self.TapButton(action_runner)
self.SlidePanel(action_runner)
def TapButton(self, action_runner):
action_runner.RunAction(TapAction(
{
'element_function': '''
function(callback) {
callback(
document.querySelector(
'body /deep/ #outerPanels'
).querySelector(
'#standard'
).shadowRoot.querySelector(
'paper-calculator-key[label="5"]'
)
);
}''',
'wait_after': { 'seconds': 2 }
}))
def SlidePanel(self, action_runner):
action_runner.RunAction(SwipeAction(
{
'left_start_percentage': 0.1,
'distance': 300,
'direction': 'left',
'wait_after': {
'javascript': '''
document.querySelector(
'body /deep/ #outerPanels'
).hasAttribute('opened')
'''
},
'top_start_percentage': 0.2,
'element_function': '''
function(callback) {
callback(
document.querySelector(
'body /deep/ #outerPanels'
).querySelector(
'#advanced'
).shadowRoot.querySelector(
'.handle-bar'
)
);
}''',
'speed': 5000
}))
class PolymerPageSet(page_set_module.PageSet):
def __init__(self):
super(PolymerPageSet, self).__init__(
user_agent_type='mobile',
archive_data_file='data/polymer.json')
self.AddPage(PolymerCalculatorPage(self))
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment