| 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 | 4 |
| 5 import re | 5 import re |
| 6 | 6 |
| 7 from telemetry import story |
| 8 from telemetry.page import page as page_module |
| 7 from telemetry.page import shared_page_state | 9 from telemetry.page import shared_page_state |
| 8 from telemetry.page import page as page_module | |
| 9 from telemetry.page import page_set as page_set_module | |
| 10 | 10 |
| 11 | 11 |
| 12 def _CreateXpathFunction(xpath): | 12 def _CreateXpathFunction(xpath): |
| 13 return ('document.evaluate("%s",' | 13 return ('document.evaluate("%s",' |
| 14 'document,' | 14 'document,' |
| 15 'null,' | 15 'null,' |
| 16 'XPathResult.FIRST_ORDERED_NODE_TYPE,' | 16 'XPathResult.FIRST_ORDERED_NODE_TYPE,' |
| 17 'null)' | 17 'null)' |
| 18 '.singleNodeValue' % re.escape(xpath)) | 18 '.singleNodeValue' % re.escape(xpath)) |
| 19 | 19 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 action_runner.WaitForElement( | 52 action_runner.WaitForElement( |
| 53 element_function=_CreateXpathFunction('//div[text()="COMPOSE"]')) | 53 element_function=_CreateXpathFunction('//div[text()="COMPOSE"]')) |
| 54 self.ComposeClick(action_runner) | 54 self.ComposeClick(action_runner) |
| 55 action_runner.Wait(1) | 55 action_runner.Wait(1) |
| 56 action_runner.WaitForElement( | 56 action_runner.WaitForElement( |
| 57 'div[class~="oh"][data-tooltip="Discard draft"]') | 57 'div[class~="oh"][data-tooltip="Discard draft"]') |
| 58 action_runner.ClickElement('div[class~="oh"][data-tooltip="Discard draft"]') | 58 action_runner.ClickElement('div[class~="oh"][data-tooltip="Discard draft"]') |
| 59 action_runner.Wait(1) | 59 action_runner.Wait(1) |
| 60 | 60 |
| 61 | 61 |
| 62 class GmailComposeDiscardPageSet(page_set_module.PageSet): | 62 class GmailComposeDiscardPageSet(story.StorySet): |
| 63 | 63 |
| 64 """ | 64 """ |
| 65 Description: Gmail endure test: compose and discard an email. | 65 Description: Gmail endure test: compose and discard an email. |
| 66 """ | 66 """ |
| 67 | 67 |
| 68 def __init__(self): | 68 def __init__(self): |
| 69 super(GmailComposeDiscardPageSet, self).__init__() | 69 super(GmailComposeDiscardPageSet, self).__init__() |
| 70 | 70 |
| 71 self.AddUserStory(GmailComposeDiscardPage(self)) | 71 self.AddUserStory(GmailComposeDiscardPage(self)) |
| OLD | NEW |