Merge lp:~nskaggs/ubuntu-autopilot-tests/firefox_autopilot_1.3 into lp:ubuntu-autopilot-tests

Proposed by Nicholas Skaggs
Status: Merged
Merged at revision: 41
Proposed branch: lp:~nskaggs/ubuntu-autopilot-tests/firefox_autopilot_1.3
Merge into: lp:ubuntu-autopilot-tests
Diff against target: 60 lines (+37/-2)
1 file modified
ubuntu_autopilot_tests/firefox/test_firefox.py (+37/-2)
To merge this branch: bzr merge lp:~nskaggs/ubuntu-autopilot-tests/firefox_autopilot_1.3
Reviewer Review Type Date Requested Status
Carla Sella (community) Approve
Nicholas Skaggs (community) Approve
Review via email: mp+165419@code.launchpad.net

Description of the change

conversion of firefox testcase to 1.3

To post a comment you must log in.
40. By Nicholas Skaggs

add test for tabs and windows

Revision history for this message
Nicholas Skaggs (nskaggs) :
review: Approve
Revision history for this message
Carla Sella (carla-sella) wrote :

Everything looks fine.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'ubuntu_autopilot_tests/firefox/test_firefox.py'
2--- ubuntu_autopilot_tests/firefox/test_firefox.py 2012-11-26 21:45:45 +0000
3+++ ubuntu_autopilot_tests/firefox/test_firefox.py 2013-05-23 17:43:26 +0000
4@@ -1,15 +1,18 @@
5+#Note: This testcase avoids using introspection because autopilot-gtk fails to introspect firefox properly
6 from autopilot.testcase import AutopilotTestCase
7 from autopilot.matchers import Eventually
8 from testtools.matchers import Equals, Contains
9+from autopilot.process import ProcessManager
10
11 #register firefox as an application so we can call it
12-AutopilotTestCase.register_known_application("Firefox", "firefox.desktop", "firefox")
13+ProcessManager.register_known_application("Firefox", "firefox.desktop", "firefox")
14
15 class FirefoxTests(AutopilotTestCase):
16
17 def setUp(self):
18 super(FirefoxTests, self).setUp()
19- self.app = self.start_app_window("Firefox")
20+ self.manager = ProcessManager.create('BAMF')
21+ self.app = self.manager.start_app_window("Firefox")
22
23 #make sure firefox is up and loaded
24 self.app.set_focus()
25@@ -65,3 +68,35 @@
26 #check that page title loaded linux on wikipedia
27 self.assertThat(lambda: self.app.name, Eventually(Contains("Linux")))
28 self.assertThat(lambda: self.app.name, Eventually(Contains("Wikipedia")))
29+
30+ def test_tabs_and_windows(self):
31+ #This test will check that Firefox can create tabs and windows
32+
33+ #test fullscreen
34+ self.keyboard.press_and_release("F11")
35+
36+ #verify fullscreen
37+ #Does Evince enter fullscreen mode?
38+ self.assertThat(lambda: self.app._get_window_states(), Eventually(Contains("_NET_WM_STATE_FULLSCREEN")))
39+
40+ #go back to normal
41+ self.keyboard.press_and_release("F11")
42+
43+ #open new tab
44+ self.keyboard.press_and_release("Ctrl+t")
45+
46+ #check that page title reflects new tab
47+ self.assertThat(lambda: self.app.name, Eventually(Equals("Mozilla Firefox")))
48+
49+ #close new tab
50+ self.keyboard.press_and_release("Ctrl+w")
51+
52+ #open new window
53+ originalWindowCount = len(self.manager.get_open_windows_by_application("Firefox"))
54+ self.keyboard.press_and_release("Ctrl+n")
55+
56+ #check that we spawned a new window; we use window count so this works even if you have firefox already running (shouldn't happen in a sterile labe enviroment however)
57+ self.assertThat(lambda: len(self.manager.get_open_windows_by_application("Firefox")), Eventually(Equals(originalWindowCount + 1)))
58+
59+ #close window
60+ self.keyboard.press_and_release("Ctrl+w")

Subscribers

People subscribed via source and target branches