1
# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
2
# Copyright 2012 Canonical
4
# This program is free software: you can redistribute it and/or modify it
5
# under the terms of the GNU General Public License version 3, as published
6
# by the Free Software Foundation.
8
"""Tests for the Browser"""
10
from __future__ import absolute_import
12
from testtools.matchers import Equals, NotEquals, GreaterThan
13
from autopilot.matchers import Eventually
15
from kalossi_browser.tests import BrowserTestCase
22
class TestMainWindow(BrowserTestCase):
23
"""Tests the main browser features"""
25
""" This is needed to wait for the application to start.
26
In the testfarm, the application may take some time to show up."""
28
super(TestMainWindow, self).setUp()
29
self.assertThat(self.main_window.get_qml_view().visible, Eventually(Equals(True)))
32
super(TestMainWindow, self).tearDown()
34
"""Test opening a website"""
35
def test_open_website(self):
36
address_bar = self.main_window.get_address_bar()
37
self.pointing_device.move_to_object(address_bar)
38
self.pointing_device.click()
39
address_bar_clear_button = self.main_window.get_address_bar_clear_button()
40
self.pointing_device.move_to_object(address_bar_clear_button)
41
self.pointing_device.click()
42
self.pointing_device.move_to_object(address_bar)
43
self.pointing_device.click()
45
self.keyboard.type("http://www.canonical.com")
46
self.keyboard.press("Enter")
48
web_view = self.main_window.get_web_view()
49
self.assertThat(web_view.url, Eventually(Equals("http://www.canonical.com/")))