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 GmailAltTwoLabelsPage(page_module.Page): | 10 class GmailAltTwoLabelsPage(page_module.Page): |
11 | 11 |
12 """ Why: Alternate between Inbox and Sent Mail """ | 12 """ Why: Alternate between Inbox and Sent Mail """ |
13 | 13 |
14 def __init__(self, page_set): | 14 def __init__(self, page_set): |
15 super(GmailAltTwoLabelsPage, self).__init__( | 15 super(GmailAltTwoLabelsPage, self).__init__( |
16 url='https://mail.google.com/mail/', | 16 url='https://mail.google.com/mail/', |
17 page_set=page_set, | 17 page_set=page_set, |
18 name='gmail_alt_two_labels') | 18 name='gmail_alt_two_labels') |
19 | 19 |
20 self.credentials_path = 'data/credentials.json' | 20 self.credentials_path = 'data/credentials.json' |
21 self.credentials = 'google' | 21 self.credentials = 'google' |
22 self.user_agent_type = 'desktop' | 22 self.user_agent_type = 'desktop' |
23 self.archive_data_file = 'data/gmail_alt_two_labels.json' | 23 self.archive_data_file = 'data/gmail_alt_two_labels.json' |
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 'wait_until': {'condition': 'href_change'}, | 34 'wait_until': {'condition': 'href_change'}, |
37 'selector': 'a[href="https://mail.google.com/mail/u/0/?shva=1#sent"]' | 35 'selector': 'a[href="https://mail.google.com/mail/u/0/?shva=1#sent"]' |
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 GmailAltTwoLabelsPageSet(page_set_module.PageSet): | 46 class GmailAltTwoLabelsPageSet(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(GmailAltTwoLabelsPageSet, self).__init__( | 51 super(GmailAltTwoLabelsPageSet, 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_two_labels.json') | 54 archive_data_file='data/gmail_alt_two_labels.json') |
57 | 55 |
58 self.AddPage(GmailAltTwoLabelsPage(self)) | 56 self.AddPage(GmailAltTwoLabelsPage(self)) |
OLD | NEW |