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.RunAction(WaitAction( | 28 action_runner.WaitForElement('img[alt="Expand all"]') |
29 { | |
30 'condition': 'element', | |
31 'selector': 'img[alt="Expand all"]' | |
32 })) | |
33 action_runner.RunAction(ClickElementAction( | 29 action_runner.RunAction(ClickElementAction( |
34 { | 30 { |
35 'selector': 'img[alt="Expand all"]' | 31 'selector': 'img[alt="Expand all"]' |
36 })) | 32 })) |
37 action_runner.RunAction(WaitAction({'seconds': 5})) | 33 action_runner.Wait(5) |
38 action_runner.RunAction(WaitAction( | 34 action_runner.WaitForElement('img[alt="Collapse all"]') |
39 { | |
40 'condition': 'element', | |
41 'selector': 'img[alt="Collapse all"]' | |
42 })) | |
43 action_runner.RunAction(ClickElementAction( | 35 action_runner.RunAction(ClickElementAction( |
44 { | 36 { |
45 'selector': 'img[alt="Collapse all"]' | 37 'selector': 'img[alt="Collapse all"]' |
46 })) | 38 })) |
47 action_runner.RunAction(WaitAction({'seconds': 1})) | 39 action_runner.Wait(1) |
48 | 40 |
49 def RunEndure(self, action_runner): | 41 def RunEndure(self, action_runner): |
50 action_runner.RunAction(WaitAction( | 42 action_runner.WaitForElement('img[alt="Expand all"]') |
51 { | |
52 'condition': 'element', | |
53 'selector': 'img[alt="Expand all"]' | |
54 })) | |
55 action_runner.RunAction(ClickElementAction( | 43 action_runner.RunAction(ClickElementAction( |
56 { | 44 { |
57 'selector': 'img[alt="Expand all"]' | 45 'selector': 'img[alt="Expand all"]' |
58 })) | 46 })) |
59 action_runner.RunAction(WaitAction({'seconds': 1})) | 47 action_runner.Wait(1) |
60 action_runner.RunAction(WaitAction( | 48 action_runner.WaitForElement('img[alt="Collapse all"]') |
61 { | |
62 'condition': 'element', | |
63 'selector': 'img[alt="Collapse all"]' | |
64 })) | |
65 action_runner.RunAction(ClickElementAction( | 49 action_runner.RunAction(ClickElementAction( |
66 { | 50 { |
67 'selector': 'img[alt="Collapse all"]' | 51 'selector': 'img[alt="Collapse all"]' |
68 })) | 52 })) |
69 action_runner.RunAction(WaitAction({'seconds': 1})) | 53 action_runner.Wait(1) |
70 | 54 |
71 | 55 |
72 class GmailExpandCollapseConversationPageSet(page_set_module.PageSet): | 56 class GmailExpandCollapseConversationPageSet(page_set_module.PageSet): |
73 | 57 |
74 """ | 58 """ |
75 Description: Chrome Endure test for GMail. | 59 Description: Chrome Endure test for GMail. |
76 """ | 60 """ |
77 | 61 |
78 def __init__(self): | 62 def __init__(self): |
79 super(GmailExpandCollapseConversationPageSet, self).__init__( | 63 super(GmailExpandCollapseConversationPageSet, self).__init__( |
80 credentials_path='data/credentials.json', | 64 credentials_path='data/credentials.json', |
81 user_agent_type='desktop', | 65 user_agent_type='desktop', |
82 archive_data_file='data/gmail_expand_collapse_conversation.json') | 66 archive_data_file='data/gmail_expand_collapse_conversation.json') |
83 | 67 |
84 self.AddPage(GmailExpandCollapseConversationPage(self)) | 68 self.AddPage(GmailExpandCollapseConversationPage(self)) |
OLD | NEW |