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 GmailExpandCollapseConversationPage( | 10 class GmailExpandCollapseConversationPage( |
11 page_module.Page): | 11 page_module.Page): |
12 | 12 |
13 """ Why: Expand and Collapse a long conversation. """ | 13 """ Why: Expand and Collapse a long conversation. """ |
14 # TODO(edmundyan): Find a long conversation rather than hardcode url | 14 # TODO(edmundyan): Find a long conversation rather than hardcode url |
15 | 15 |
16 def __init__(self, page_set): | 16 def __init__(self, page_set): |
17 super(GmailExpandCollapseConversationPage, self).__init__( | 17 super(GmailExpandCollapseConversationPage, self).__init__( |
18 url='https://mail.google.com/mail/u/0/#inbox/13c6a141fa95ffe0', | 18 url='https://mail.google.com/mail/u/0/#inbox/13c6a141fa95ffe0', |
19 page_set=page_set, | 19 page_set=page_set, |
20 name='gmail_expand_collapse_conversation') | 20 name='gmail_expand_collapse_conversation') |
21 self.credentials_path = 'data/credentials.json' | 21 self.credentials_path = 'data/credentials.json' |
22 self.credentials = 'google' | 22 self.credentials = 'google' |
23 self.user_agent_type = 'desktop' | 23 self.user_agent_type = 'desktop' |
24 self.archive_data_file = 'data/gmail_expand_collapse_conversation.json' | 24 self.archive_data_file = 'data/gmail_expand_collapse_conversation.json' |
25 | 25 |
26 def RunNavigateSteps(self, action_runner): | 26 def RunNavigateSteps(self, action_runner): |
27 action_runner.NavigateToPage(self) | 27 action_runner.NavigateToPage(self) |
28 action_runner.WaitForElement('img[alt="Expand all"]') | 28 action_runner.WaitForElement('img[alt="Expand all"]') |
29 action_runner.RunAction(ClickElementAction( | 29 action_runner.ClickElement('img[alt="Expand all"]') |
30 { | |
31 'selector': 'img[alt="Expand all"]' | |
32 })) | |
33 action_runner.Wait(5) | 30 action_runner.Wait(5) |
34 action_runner.WaitForElement('img[alt="Collapse all"]') | 31 action_runner.WaitForElement('img[alt="Collapse all"]') |
35 action_runner.RunAction(ClickElementAction( | 32 action_runner.ClickElement('img[alt="Collapse all"]') |
36 { | |
37 'selector': 'img[alt="Collapse all"]' | |
38 })) | |
39 action_runner.Wait(1) | 33 action_runner.Wait(1) |
40 | 34 |
41 def RunEndure(self, action_runner): | 35 def RunEndure(self, action_runner): |
42 action_runner.WaitForElement('img[alt="Expand all"]') | 36 action_runner.WaitForElement('img[alt="Expand all"]') |
43 action_runner.RunAction(ClickElementAction( | 37 action_runner.ClickElement('img[alt="Expand all"]') |
44 { | |
45 'selector': 'img[alt="Expand all"]' | |
46 })) | |
47 action_runner.Wait(1) | 38 action_runner.Wait(1) |
48 action_runner.WaitForElement('img[alt="Collapse all"]') | 39 action_runner.WaitForElement('img[alt="Collapse all"]') |
49 action_runner.RunAction(ClickElementAction( | 40 action_runner.ClickElement('img[alt="Collapse all"]') |
50 { | |
51 'selector': 'img[alt="Collapse all"]' | |
52 })) | |
53 action_runner.Wait(1) | 41 action_runner.Wait(1) |
54 | 42 |
55 | 43 |
56 class GmailExpandCollapseConversationPageSet(page_set_module.PageSet): | 44 class GmailExpandCollapseConversationPageSet(page_set_module.PageSet): |
57 | 45 |
58 """ | 46 """ |
59 Description: Chrome Endure test for GMail. | 47 Description: Chrome Endure test for GMail. |
60 """ | 48 """ |
61 | 49 |
62 def __init__(self): | 50 def __init__(self): |
63 super(GmailExpandCollapseConversationPageSet, self).__init__( | 51 super(GmailExpandCollapseConversationPageSet, self).__init__( |
64 credentials_path='data/credentials.json', | 52 credentials_path='data/credentials.json', |
65 user_agent_type='desktop', | 53 user_agent_type='desktop', |
66 archive_data_file='data/gmail_expand_collapse_conversation.json') | 54 archive_data_file='data/gmail_expand_collapse_conversation.json') |
67 | 55 |
68 self.AddPage(GmailExpandCollapseConversationPage(self)) | 56 self.AddPage(GmailExpandCollapseConversationPage(self)) |
OLD | NEW |