summaryrefslogtreecommitdiffstats
path: root/tools/perf/page_sets/gmail_expand_collapse_conversation.py
blob: 8cf222b01424b98f6d6406d900ef925fb7ce3dba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from telemetry.page import page as page_module
from telemetry.page import page_set as page_set_module


class GmailExpandCollapseConversationPage(
  page_module.Page):

  """ Why: Expand and Collapse a long conversation. """
  # TODO(edmundyan): Find a long conversation rather than hardcode url

  def __init__(self, page_set):
    super(GmailExpandCollapseConversationPage, self).__init__(
      url='https://mail.google.com/mail/u/0/#inbox/13c6a141fa95ffe0',
      page_set=page_set,
      name='gmail_expand_collapse_conversation')
    self.credentials_path = 'data/credentials.json'
    self.credentials = 'google'
    self.user_agent_type = 'desktop'
    self.archive_data_file = 'data/gmail_expand_collapse_conversation.json'

  def RunNavigateSteps(self, action_runner):
    action_runner.NavigateToPage(self)
    action_runner.WaitForElement('img[alt="Expand all"]')
    action_runner.ClickElement('img[alt="Expand all"]')
    action_runner.Wait(5)
    action_runner.WaitForElement('img[alt="Collapse all"]')
    action_runner.ClickElement('img[alt="Collapse all"]')
    action_runner.Wait(1)

  def RunEndure(self, action_runner):
    action_runner.WaitForElement('img[alt="Expand all"]')
    action_runner.ClickElement('img[alt="Expand all"]')
    action_runner.Wait(1)
    action_runner.WaitForElement('img[alt="Collapse all"]')
    action_runner.ClickElement('img[alt="Collapse all"]')
    action_runner.Wait(1)


class GmailExpandCollapseConversationPageSet(page_set_module.PageSet):

  """
  Description: Chrome Endure test for GMail.
  """

  def __init__(self):
    super(GmailExpandCollapseConversationPageSet, self).__init__(
      credentials_path='data/credentials.json',
      user_agent_type='desktop',
      archive_data_file='data/gmail_expand_collapse_conversation.json',
      bucket=page_set_module.PUBLIC_BUCKET)

    self.AddPage(GmailExpandCollapseConversationPage(self))