~ubuntu-branches/ubuntu/trusty/ubuntu-html5-theme/trusty-proposed

« back to all changes in this revision

Viewing changes to tests/autopilot/ubuntu_html5_ui_toolkit/tests/test_pagestack.py

  • Committer: Package Import Robot
  • Author(s): Ubuntu daily release, Robert Bruce Park, Ubuntu daily release
  • Date: 2014-02-04 14:42:31 UTC
  • mfrom: (1.1.11)
  • Revision ID: package-import@ubuntu.com-20140204144231-cygzw6ti0zem0fsw
Tags: 0.1.1+14.04.20140204-0ubuntu1
[ Robert Bruce Park ]
* Add transitional packages to assist with package rename effort.

[ Ubuntu daily release ]
* Automatic snapshot from revision 122

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
 
2
# Copyright 2013 Canonical
 
3
#
 
4
# This program is free software: you can redistribute it and/or modify it
 
5
# under the terms of the GNU Lesser General Public License version 3, as published
 
6
# by the Free Software Foundation.
 
7
 
 
8
from __future__ import absolute_import
 
9
 
 
10
import time
 
11
 
 
12
from testtools.matchers import Contains, Equals
 
13
from autopilot.matchers import Eventually
 
14
 
 
15
from ubuntu_html5_ui_toolkit.tests import UbuntuHTML5TestCaseBase, UbuntuThemeRemotePageTestCaseBase
 
16
 
 
17
class UbuntuThemePageStackTestCase(UbuntuHTML5TestCaseBase):
 
18
 
 
19
    def setUp(self):
 
20
        super(UbuntuThemePageStackTestCase, self).setUp()
 
21
 
 
22
    def test_pageLoadsWithNoPageStacks(self):
 
23
        self.browse_to_test_html('test-nopagestack-in-app.html')
 
24
        self.assertThat(self.eval_expression_in_page_unsafe('var UI = new UbuntuUI(); UI.init(); return "ok";'), Equals('ok'));
 
25
 
 
26
    def test_pageLoadsWithPageStacks(self):
 
27
        self.browse_to_test_html('test-pagestack-in-app.html')
 
28
        self.assertThat(self.eval_expression_in_page_unsafe('var UI = new UbuntuUI(); UI.init(); return "ok";'), Equals('ok'));
 
29
        self.assertThat(self.is_dom_node_visible('main'), Equals(True))
 
30
 
 
31
    def test_pageChangeWithPageStackPush(self):
 
32
        self.browse_to_test_html('test-pagestack-in-app.html')
 
33
        self.assertThat(self.eval_expression_in_page_unsafe('var UI = new UbuntuUI(); UI.init(); UI.pagestack.push("results"); return "ok";'), Equals('ok'));
 
34
        self.assertThat(self.is_dom_node_visible('main'), Equals(False))
 
35
        self.assertThat(self.is_dom_node_visible('results'), Equals(True))
 
36
 
 
37
    def test_pageChangeWithPageStackPopped(self):
 
38
        self.browse_to_test_html('test-pagestack-in-app.html')
 
39
        self.assertThat(self.eval_expression_in_page_unsafe('var UI = new UbuntuUI(); UI.init(); UI.pagestack.push("main"); UI.pagestack.push("results"); UI.pagestack.push("article"); UI.pagestack.pop(); return "ok";'), Equals('ok'));
 
40
        self.assertThat(self.is_dom_node_visible('main'), Equals(False))
 
41
        self.assertThat(self.is_dom_node_visible('results'), Equals(True))
 
42
        self.assertThat(self.is_dom_node_visible('article'), Equals(False))