Home | History | Annotate | Download | only in page_sets
      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 CalendarForwardBackwardPage(page_module.Page):
      9 
     10   """ Why: Click forward(4x) and backwards(4x) repeatedly """
     11 
     12   def __init__(self, page_set):
     13     super(CalendarForwardBackwardPage, self).__init__(
     14       url='https://www.google.com/calendar/',
     15       page_set=page_set,
     16       name='calendar_forward_backward')
     17     self.credentials_path = 'data/credentials.json'
     18     self.credentials = 'google'
     19     self.user_agent_type = 'desktop'
     20     self.archive_data_file = 'data/calendar_forward_backward.json'
     21 
     22   def RunNavigateSteps(self, action_runner):
     23     action_runner.NavigateToPage(self)
     24     action_runner.Wait(2)
     25     action_runner.WaitForElement('div[class~="navForward"]')
     26     action_runner.ExecuteJavaScript('''
     27         (function() {
     28           var elem = document.createElement('meta');
     29           elem.name='viewport';
     30           elem.content='initial-scale=1';
     31           document.body.appendChild(elem);
     32         })();''')
     33 
     34   def RunEndure(self, action_runner):
     35     action_runner.ClickElement('div[class~="navForward"]')
     36     action_runner.Wait(2)
     37     action_runner.WaitForElement('div[class~="navForward"]')
     38     action_runner.ClickElement('div[class~="navForward"]')
     39     action_runner.Wait(2)
     40     action_runner.WaitForElement('div[class~="navForward"]')
     41     action_runner.ClickElement('div[class~="navForward"]')
     42     action_runner.Wait(2)
     43     action_runner.WaitForElement('div[class~="navForward"]')
     44     action_runner.ClickElement('div[class~="navForward"]')
     45     action_runner.Wait(2)
     46     action_runner.WaitForElement('div[class~="navBack"]')
     47     action_runner.ClickElement('div[class~="navBack"]')
     48     action_runner.Wait(2)
     49     action_runner.WaitForElement('div[class~="navBack"]')
     50     action_runner.ClickElement('div[class~="navBack"]')
     51     action_runner.Wait(2)
     52     action_runner.WaitForElement('div[class~="navBack"]')
     53     action_runner.ClickElement('div[class~="navBack"]')
     54     action_runner.Wait(2)
     55     action_runner.WaitForElement('div[class~="navBack"]')
     56     action_runner.ClickElement('div[class~="navBack"]')
     57     action_runner.Wait(2)
     58     action_runner.WaitForElement('div[class~="navForward"]')
     59 
     60 
     61 class CalendarForwardBackwardPageSet(page_set_module.PageSet):
     62 
     63   """ Chrome Endure test for Google Calendar. """
     64 
     65   def __init__(self):
     66     super(CalendarForwardBackwardPageSet, self).__init__(
     67       credentials_path='data/credentials.json',
     68       user_agent_type='desktop',
     69       archive_data_file='data/calendar_forward_backward.json',
     70       bucket=page_set_module.PUBLIC_BUCKET)
     71 
     72     self.AddPage(CalendarForwardBackwardPage(self))
     73