Merge lp:~aacid/unity-2d/unity-2d_test_alt_f2_pops_dash into lp:unity-2d

Proposed by Albert Astals Cid on 2012-01-24
Status: Merged
Approved by: Gerry Boland on 2012-01-25
Approved revision: 868
Merged at revision: 867
Proposed branch: lp:~aacid/unity-2d/unity-2d_test_alt_f2_pops_dash
Merge into: lp:unity-2d
Diff against target: 126 lines (+122/-0)
1 file modified
tests/places/places-tests.rb (+122/-0)
To merge this branch: bzr merge lp:~aacid/unity-2d/unity-2d_test_alt_f2_pops_dash
Reviewer Review Type Date Requested Status
Gerry Boland 2012-01-24 Approve on 2012-01-25
Lohith D Shivamurthy (community) Needs Fixing on 2012-01-25
Review via email: mp+89873@code.launchpad.net

Description of the Change

[test] Test that Alt+F2 and that clicking the bfb show the Dash

To post a comment you must log in.
864. By Albert Astals Cid on 2012-01-24

merge

865. By Albert Astals Cid on 2012-01-24

port to the target/host split

Gerry Boland (gerboland) wrote :

Rogue comments:
+ # check width before proceeding
in two places.

But is great aside from that.

review: Needs Fixing
Lohith D Shivamurthy (dyams) wrote :

Three points I noticed:
1) Isn't the places-tests.rb is very generic, something like places-alt-f2-tests.rb is more suitable.
2) 'context "Launcher Autohide and Show Tests"' Needs to changed to suitable string like 'Dash Alt-F2 Tests'?
3) Verifying only dash is visible is not sufficient to confirm that it is 'Run a command' prompt. Should you also verify the text in search_entry? Or Do i miss something here?

review: Needs Fixing
866. By Albert Astals Cid on 2012-01-25

merge

867. By Albert Astals Cid on 2012-01-25

Remove two out-of-place comments spotted by Gerry

868. By Albert Astals Cid on 2012-01-25

Fix context name

Albert Astals Cid (aacid) wrote :

@Gerry: Removed the wrong comments

Albert Astals Cid (aacid) wrote :

@Lohith:
 1) Well, my idea was starting a file that would hold various places tests, as you can see it does not only old "alt-f2" test but also "click-bfb-to-show" test, so "places-alt-f2-tests.rb" wouldn't be a good name either. If you guys think that having a broad naming so it can hold more tests in the future is not a good idea i can rename it to something like places-showing-tests.rb
 2) Fixed!
 3) Well the idea of the test is making sure the dash is opened by both alt+f2 and clicking in the bfb, the fact that it opens one thing or another is not what we wanted to check here (What we wanted to check is that moving from dbus activation to in-process activation (in the -shell) the affected code paths work)

Lohith D Shivamurthy (dyams) wrote :

@Albert:
Agreed!
1) No, its not the question of avoiding the generic names. Ideally speaking places-tests.rb can include every test case involving places, but we won't put all tests involving places into in a single file. no?
2) Thanks
3) Ok, then its fine.

Albert Astals Cid (aacid) wrote :

As discussed on IRC 1) is fine for the moment, we'll move it later if needed

Gerry Boland (gerboland) wrote :

Ok, I think we're in agreement, merging!
Thanks Albert.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file 'tests/places/places-tests.rb'
2--- tests/places/places-tests.rb 1970-01-01 00:00:00 +0000
3+++ tests/places/places-tests.rb 2012-01-25 08:54:24 +0000
4@@ -0,0 +1,122 @@
5+#!/usr/bin/env ruby1.8
6+=begin
7+/*
8+ * This file is part of unity-2d
9+ *
10+ * Copyright 2012 Canonical Ltd.
11+ *
12+ * Authors:
13+ * - Albert Astals Cid <albert.astals@canonical.com>
14+ *
15+ * This program is free software; you can redistribute it and/or modify
16+ * it under the terms of the GNU General Public License as published by
17+ * the Free Software Foundation; version 3.
18+ *
19+ * This program is distributed in the hope that it will be useful,
20+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
21+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22+ * GNU General Public License for more details.
23+ *
24+ * You should have received a copy of the GNU General Public License
25+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
26+ */
27+=end
28+
29+require '../run-tests.rb' unless $INIT_COMPLETED
30+require 'xdo/xwindow'
31+require 'xdo/keyboard'
32+require 'xdo/mouse'
33+require 'tmpwindow'
34+
35+############################# Test Suite #############################
36+context "Dash Tests" do
37+ # Run once at the beginning of this test suite
38+ startup do
39+ $SUT.execute_shell_command 'killall unity-2d-places'
40+ $SUT.execute_shell_command 'killall unity-2d-places'
41+
42+ $SUT.execute_shell_command 'killall unity-2d-launcher'
43+ $SUT.execute_shell_command 'killall unity-2d-launcher'
44+
45+ # Minimize all windows
46+ XDo::XWindow.toggle_minimize_all
47+ end
48+
49+ # Run once at the end of this test suite
50+ shutdown do
51+ end
52+
53+ # Run before each test case begins
54+ setup do
55+ # Execute the application
56+ @app_launcher = $SUT.run( :name => UNITY_2D_LAUNCHER,
57+ :arguments => "-testability",
58+ :sleeptime => 2 )
59+
60+ @app_places = $SUT.run( :name => UNITY_2D_PLACES,
61+ :arguments => "-testability",
62+ :sleeptime => 2 )
63+
64+ end
65+
66+ # Run after each test case completes
67+ teardown do
68+ TmpWindow.close_all_windows
69+ #Need to kill Launcher as it does not shutdown when politely asked
70+ $SUT.execute_shell_command 'pkill -nf unity-2d-launcher'
71+ $SUT.execute_shell_command 'pkill -nf unity-2d-places'
72+ end
73+
74+ #####################################################################################
75+ # Test casess
76+
77+ # Test case objectives:
78+ # * Check that Alt+F2 shows dash
79+ # Pre-conditions
80+ # * Desktop with no running applications
81+ # Test steps
82+ # * Verify dash is not showing
83+ # * Press Alt+F2
84+ # * Verify dash is showing
85+ # Post-conditions
86+ # * None
87+ # References
88+ # * None
89+ test "Alt+F2 shows the Dash" do
90+ verify_not(0, 'There should not be a Dash declarative view on startup') {
91+ @app_places.DashDeclarativeView()
92+ }
93+ XDo::Keyboard.alt_F2 #Must use uppercase F to indicate function keys
94+ verify(TIMEOUT, 'There should be a Dash declarative view after pressing Alt+F2') {
95+ @app_places.DashDeclarativeView()
96+ }
97+ end
98+
99+ # Test case objectives:
100+ # * Check that pressing the bfb shows the dash
101+ # Pre-conditions
102+ # * Desktop with no running applications
103+ # Test steps
104+ # * Verify dash is not showing
105+ # * Click on the bfb
106+ # * Verify dash is showing
107+ # Post-conditions
108+ # * None
109+ # References
110+ # * None
111+ test "Pressing the bfb shows the Dash" do
112+ verify_not(0, 'There should not be a Dash declarative view on startup') {
113+ @app_places.DashDeclarativeView()
114+ }
115+ bfb = @app_launcher.LauncherList( :name => 'main' ).LauncherList( :isBfb => true );
116+ XDo::Mouse.move(0, 200, 0, true)
117+ verify_equal( 0, TIMEOUT, 'Launcher hiding when mouse at left edge of screen' ) {
118+ @app_launcher.Unity2dPanel()['x_absolute'].to_i
119+ }
120+ bfb.move_mouse()
121+ bfb.tap()
122+ verify(TIMEOUT, 'There should be a Dash declarative view after activating the bfb') {
123+ @app_places.DashDeclarativeView()
124+ }
125+ end
126+end

Subscribers

People subscribed via source and target branches