Merge lp:~uriboni/webbrowser-app/addressbar-load-no-clear into lp:webbrowser-app

Proposed by Ugo Riboni
Status: Merged
Approved by: Olivier Tilloy
Approved revision: 1255
Merged at revision: 1265
Proposed branch: lp:~uriboni/webbrowser-app/addressbar-load-no-clear
Merge into: lp:webbrowser-app
Diff against target: 96 lines (+39/-14)
3 files modified
src/app/webbrowser/AddressBar.qml (+8/-1)
tests/autopilot/webbrowser_app/tests/test_addressbar_states.py (+31/-0)
tests/unittests/qml/tst_AddressBar.qml (+0/-13)
To merge this branch: bzr merge lp:~uriboni/webbrowser-app/addressbar-load-no-clear
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Approve
Olivier Tilloy Approve
Review via email: mp+275347@code.launchpad.net

Commit message

Prevent the address bar from being cleared when the actual url changes and the user has already started typing.

Description of the change

Prevent the address bar from being cleared when the actual url changes and the user has already started typing

To post a comment you must log in.
1247. By Ugo Riboni

Transform an unit test into an AP test that does not fail with this change and actually tests the bug fix it is supposed to test as described in the bug report

1248. By Ugo Riboni

Add a new AP test to verify this bug fix

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Olivier Tilloy (osomon) wrote :

test_clears_when_actual_url_changed doesn’t actually test bug #1456199, it should focus the address bar before opening a new tab.

review: Needs Fixing
Revision history for this message
Olivier Tilloy (osomon) wrote :

And a link to bug #1487713 in a comment before test_does_not_clear_when_typing_while_loading would be useful.

Revision history for this message
Olivier Tilloy (osomon) wrote :

The change otherwise looks good, I’ll play further with it on my device to convince myself that it doesn’t introduce any regression (this code is not exactly as robust as I’d like it to be, despite the unit tests and autopilot tests).

1249. By Ugo Riboni

Adjust AP test to more closely match what the bug report says

1250. By Ugo Riboni

Reference bug that the new AP test is for

1251. By Ugo Riboni

Sync with trunk

1252. By Ugo Riboni

Clear the address bar when going into incognito mode

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
1253. By Ugo Riboni

Merge changes from trunk

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Olivier Tilloy (osomon) wrote :

Is revision 1252 ("Clear the address bar when going into incognito mode") really needed? I would have expected the address bar to be cleared anyway, given that a new tab is being open. Does this code fix an existing issue? If so there should probably be an additional autopilot test for it.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Ugo Riboni (uriboni) wrote :

> Is revision 1252 ("Clear the address bar when going into incognito mode")
> really needed? I would have expected the address bar to be cleared anyway,
> given that a new tab is being open. Does this code fix an existing issue? If
> so there should probably be an additional autopilot test for it.

Not clearing the address bar when going incognito was a side effect of the changes I made, so I had to fix that.
There was already an AP test for it (the first in test_private.py)

Revision history for this message
Olivier Tilloy (osomon) wrote :

Got it, thanks.

webbrowser_app.tests.test_addressbar_states.TestAddressBarStates.test_clears_when_actual_url_changed seems to be failing reliably in the last few CI runs on mako, can you check what’s going on?

review: Needs Fixing
1254. By Ugo Riboni

Fix failing AP test

1255. By Ugo Riboni

The test was actually OK, but it should have run only on desktop

Revision history for this message
Ugo Riboni (uriboni) wrote :

> Got it, thanks.
>
> webbrowser_app.tests.test_addressbar_states.TestAddressBarStates.test_clears_w
> hen_actual_url_changed seems to be failing reliably in the last few CI runs on
> mako, can you check what’s going on?

It does fail because the test is for http://pad.lv/1456199 which is explicitly a desktop only problem. I excluded that test from running on devices because it does not make sense there.

Revision history for this message
Olivier Tilloy (osomon) wrote :

LGTM, thanks.

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/app/webbrowser/AddressBar.qml'
2--- src/app/webbrowser/AddressBar.qml 2015-09-01 17:25:21 +0000
3+++ src/app/webbrowser/AddressBar.qml 2015-11-03 09:28:15 +0000
4@@ -348,6 +348,13 @@
5 property bool simplified: false
6 }
7
8+ onIncognitoChanged: {
9+ if (incognito) {
10+ text = ""
11+ internal.simplified = false
12+ }
13+ }
14+
15 onEditingChanged: {
16 if (findInPageMode) return
17 if (editing && internal.simplified) {
18@@ -376,7 +383,7 @@
19 }
20
21 onActualUrlChanged: {
22- if ((editing && actualUrl.toString()) || findInPageMode) return
23+ if (editing || findInPageMode) return
24 if (canSimplifyText) {
25 text = internal.simplifyUrl(actualUrl)
26 internal.simplified = true
27
28=== modified file 'tests/autopilot/webbrowser_app/tests/test_addressbar_states.py'
29--- tests/autopilot/webbrowser_app/tests/test_addressbar_states.py 2015-02-17 20:52:30 +0000
30+++ tests/autopilot/webbrowser_app/tests/test_addressbar_states.py 2015-11-03 09:28:15 +0000
31@@ -14,6 +14,11 @@
32 # You should have received a copy of the GNU General Public License
33 # along with this program. If not, see <http://www.gnu.org/licenses/>.
34
35+import testtools
36+from testtools.matchers import Equals
37+from autopilot.matchers import Eventually
38+from autopilot.platform import model
39+
40 from webbrowser_app.tests import StartOpenRemotePageTestCaseBase
41
42
43@@ -53,3 +58,29 @@
44 address_bar.write(self.url)
45 address_bar.click_action_button()
46 address_bar.activeFocus.wait_for(False)
47+
48+ # http://pad.lv/1456199
49+ @testtools.skipIf(model() != "Desktop", "on desktop only")
50+ def test_clears_when_actual_url_changed(self):
51+ address_bar = self.main_window.address_bar
52+ self.pointing_device.click_object(address_bar)
53+ address_bar.activeFocus.wait_for(True)
54+ url = self.base_url + "/test1"
55+ self.main_window.go_to_url(url)
56+ self.main_window.wait_until_page_loaded(url)
57+ self.pointing_device.click_object(address_bar)
58+ address_bar.activeFocus.wait_for(True)
59+ self.new_tab_view = self.open_new_tab(open_tabs_view=True)
60+ self.assertThat(address_bar.text, Eventually(Equals("")))
61+
62+ # http://pad.lv/1487713
63+ def test_does_not_clear_when_typing_while_loading(self):
64+ address_bar = self.main_window.address_bar
65+ self.pointing_device.click_object(address_bar)
66+ address_bar.activeFocus.wait_for(True)
67+ url = self.base_url + "/wait/3"
68+ self.main_window.go_to_url(url)
69+ self.pointing_device.click_object(address_bar)
70+ address_bar.write("x")
71+ self.main_window.wait_until_page_loaded(url)
72+ self.assertThat(address_bar.text, Equals("x"))
73
74=== modified file 'tests/unittests/qml/tst_AddressBar.qml'
75--- tests/unittests/qml/tst_AddressBar.qml 2015-08-11 10:37:56 +0000
76+++ tests/unittests/qml/tst_AddressBar.qml 2015-11-03 09:28:15 +0000
77@@ -274,19 +274,6 @@
78 compare(addressBar.text, data.actualUrl)
79 }
80
81- function test_shouldBeClearedWhenFocusedIfActualUrlIsCleared() {
82- // https://launchpad.net/bugs/1456199
83- var text = "http://example.org"
84- typeString(text)
85- compare(addressBar.text, text)
86- verify(addressBar.activeFocus)
87- addressBar.actualUrl = text
88- verify(addressBar.activeFocus)
89- addressBar.actualUrl = ""
90- verify(addressBar.activeFocus)
91- compare(addressBar.text, "")
92- }
93-
94 function test_actionButtonShouldBeDisabledWhenEmpty() {
95 verify(!addressBar.__actionButton.enabled)
96 keyClick(Qt.Key_U)

Subscribers

People subscribed via source and target branches

to status/vote changes: