| 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 GmailAltThreadlistConversationPage( | 10 class GmailAltThreadlistConversationPage( |
| 11 page_module.Page): | 11 page_module.Page): |
| 12 | 12 |
| 13 """ Why: Alternate between Inbox and the first email conversation. """ | 13 """ Why: Alternate between Inbox and the first email conversation. """ |
| 14 | 14 |
| 15 def __init__(self, page_set): | 15 def __init__(self, page_set): |
| 16 super(GmailAltThreadlistConversationPage, self).__init__( | 16 super(GmailAltThreadlistConversationPage, self).__init__( |
| 17 url='https://mail.google.com/mail/', | 17 url='https://mail.google.com/mail/', |
| 18 page_set=page_set, | 18 page_set=page_set, |
| 19 name='gmail_alt_threadlist_conversation') | 19 name='gmail_alt_threadlist_conversation') |
| 20 self.credentials_path = 'data/credentials.json' | 20 self.credentials_path = 'data/credentials.json' |
| 21 self.user_agent_type = 'desktop' | 21 self.user_agent_type = 'desktop' |
| 22 self.archive_data_file = 'data/gmail_alt_threadlist_conversation.json' | 22 self.archive_data_file = 'data/gmail_alt_threadlist_conversation.json' |
| 23 self.credentials = 'google' | 23 self.credentials = 'google' |
| 24 | 24 |
| 25 def RunNavigateSteps(self, action_runner): | 25 def RunNavigateSteps(self, action_runner): |
| 26 action_runner.NavigateToPage(self) | 26 action_runner.NavigateToPage(self) |
| 27 action_runner.RunAction(WaitAction( | 27 action_runner.WaitForJavaScriptCondition( |
| 28 { | 28 'window.gmonkey !== undefined && ' |
| 29 'javascript': | 29 'document.getElementById("gb") !== null') |
| 30 'window.gmonkey !== undefined && document.getElementById("gb") !== null' | |
| 31 })) | |
| 32 | 30 |
| 33 def RunEndure(self, action_runner): | 31 def RunEndure(self, action_runner): |
| 34 action_runner.RunAction(ClickElementAction( | 32 action_runner.RunAction(ClickElementAction( |
| 35 { | 33 { |
| 36 'xpath': '//span[@email]', | 34 'xpath': '//span[@email]', |
| 37 'wait_until': {'condition': 'href_change'} | 35 'wait_until': {'condition': 'href_change'} |
| 38 })) | 36 })) |
| 39 action_runner.RunAction(WaitAction({'seconds': 1})) | 37 action_runner.Wait(1) |
| 40 action_runner.RunAction(ClickElementAction( | 38 action_runner.RunAction(ClickElementAction( |
| 41 { | 39 { |
| 42 'wait_until': {'condition': 'href_change'}, | 40 'wait_until': {'condition': 'href_change'}, |
| 43 'selector': 'a[href="https://mail.google.com/mail/u/0/?shva=1#inbox"]' | 41 'selector': 'a[href="https://mail.google.com/mail/u/0/?shva=1#inbox"]' |
| 44 })) | 42 })) |
| 45 action_runner.RunAction(WaitAction({'seconds': 1})) | 43 action_runner.Wait(1) |
| 46 | 44 |
| 47 | 45 |
| 48 class GmailAltThreadlistConversationPageSet(page_set_module.PageSet): | 46 class GmailAltThreadlistConversationPageSet(page_set_module.PageSet): |
| 49 | 47 |
| 50 """ Chrome Endure test for GMail. """ | 48 """ Chrome Endure test for GMail. """ |
| 51 | 49 |
| 52 def __init__(self): | 50 def __init__(self): |
| 53 super(GmailAltThreadlistConversationPageSet, self).__init__( | 51 super(GmailAltThreadlistConversationPageSet, self).__init__( |
| 54 credentials_path='data/credentials.json', | 52 credentials_path='data/credentials.json', |
| 55 user_agent_type='desktop', | 53 user_agent_type='desktop', |
| 56 archive_data_file='data/gmail_alt_threadlist_conversation.json') | 54 archive_data_file='data/gmail_alt_threadlist_conversation.json') |
| 57 | 55 |
| 58 self.AddPage(GmailAltThreadlistConversationPage(self)) | 56 self.AddPage(GmailAltThreadlistConversationPage(self)) |
| OLD | NEW |