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