Merge lp:~abreu-alexandre/webbrowser-app/add-integration-tests-for-webappcontainer into lp:webbrowser-app
- add-integration-tests-for-webappcontainer
- Merge into trunk
Status: | Merged |
---|---|
Merged at revision: | 492 |
Proposed branch: | lp:~abreu-alexandre/webbrowser-app/add-integration-tests-for-webappcontainer |
Merge into: | lp:webbrowser-app |
Diff against target: |
367 lines (+273/-6) 11 files modified
debian/control (+12/-0) debian/webapp-container-autopilot.install (+1/-0) src/app/webcontainer/WebApp.qml (+2/-0) src/app/webcontainer/webapp-container.cpp (+3/-1) src/app/webcontainer/webapp-container.qml (+2/-0) tests/autopilot/CMakeLists.txt (+3/-5) tests/autopilot/webapp_container/__init__.py (+16/-0) tests/autopilot/webapp_container/tests/__init__.py (+82/-0) tests/autopilot/webapp_container/tests/fake_servers.py (+68/-0) tests/autopilot/webapp_container/tests/test_app_launch.py (+36/-0) tests/autopilot/webapp_container/tests/test_chrome_setup.py (+48/-0) |
To merge this branch: | bzr merge lp:~abreu-alexandre/webbrowser-app/add-integration-tests-for-webappcontainer |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
PS Jenkins bot | continuous-integration | Needs Fixing | |
Olivier Tilloy | Approve | ||
Leo Arias (community) | code review | Needs Fixing | |
Review via email: mp+199089@code.launchpad.net |
Commit message
Add a basic set of integration tests for the webapp container
Description of the change
Add a basic set of integration tests for the webapp container
PS Jenkins bot (ps-jenkins) wrote : | # |
- 426. By Alexandre Abreu
-
Restrict url webapps pattern replacement depending on which part is being affected. Fixes: https:/
/bugs.launchpad .net/bugs/ 1240685. Approved by PS Jenkins bot, Olivier Tilloy.
- 427. By Olivier Tilloy
-
Ensure the test server is up and responding before starting the tests,
and use standard logging everywhere.Approved by PS Jenkins bot.
- 428. By Alexandre Abreu
-
Fix back forward hud actions.
Approved by Olivier Tilloy, PS Jenkins bot.
- 429. By Launchpad Translations on behalf of phablet-team
-
Launchpad automatic translations update.
- 430. By Launchpad Translations on behalf of phablet-team
-
Launchpad automatic translations update.
- 431. By Launchpad Translations on behalf of phablet-team
-
Launchpad automatic translations update.
Olivier Tilloy (osomon) wrote : | # |
When listing the available autopilot tests for webapp_container locally from my development branch (and without the container installed system-wide), I’m getting the following error:
$ autopilot list webapp_container
Loading tests from: /home/osomon/
Failed to import test module: webapp_
Traceback (most recent call last):
File "/usr/lib/
module = self._get_
File "/usr/lib/
__import_
File "/home/
class WebappContainer
File "/home/
['which', 'webapp-
File "/usr/lib/
raise CalledProcessEr
CalledProcessError: Command '['which', 'webapp-
The call to subprocess.
Olivier Tilloy (osomon) wrote : | # |
Minor nit:
16 +Description: Webapp container autopilot tests
should be:
Description: Ubuntu web applications container autopilot tests
Olivier Tilloy (osomon) wrote : | # |
set(WEBBROWSER_
install(DIRECTORY ${WEBBROWSER_
DESTINATION ${PYTHON_
)
set(WEBCONTAINE
install(DIRECTORY ${WEBCONTAINER_
DESTINATION ${PYTHON_
)
This could be simplified to:
install(
)
Olivier Tilloy (osomon) wrote : | # |
142 +"""webapp_
This one (tests/
Olivier Tilloy (osomon) wrote : | # |
Running flake8 on tests/autopilot
Olivier Tilloy (osomon) wrote : | # |
241 +class WebappContainer
Can we re-use the test server already present in the tests for webbrowser-app, if it makes sense?
Olivier Tilloy (osomon) wrote : | # |
For consistency with the existing tests, can you rename the test methods to use only lowercase and underscores to separate words, like so: "test_loads_
Alexandre Abreu (abreu-alexandre) wrote : | # |
All done, besides reusing the test server since I don't want to add extra deps on this, and the commonalities at this point are slim imo,
Olivier Tilloy (osomon) wrote : | # |
166 +except:
Unqualified excepts should be avoided as much as possible, they make it hard to spot problems. Please replace with:
except CalledProcessError:
171 + LOCAL_BROWSER_
172 + CONTAINER_
any reason for not doing this outside the class declaration?
Alexandre Abreu (abreu-alexandre) wrote : | # |
> 166 +except:
>
> Unqualified excepts should be avoided as much as possible, they make it hard
> to spot problems. Please replace with:
>
> except CalledProcessError:
>
>
> 171 + LOCAL_BROWSER_
> 172 +
> CONTAINER_
>
> any reason for not doing this outside the class declaration?
agree, ... done
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:425
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:426
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 432. By Olivier Tilloy
-
Bump version to 0.23 in preparation for the next major release.
- 433. By Launchpad Translations on behalf of phablet-team
-
Launchpad automatic translations update.
Olivier Tilloy (osomon) wrote : | # |
178 + self.pointer = Pointer(
This fails on devices, where X11 is not available:
Traceback (most recent call last):
File "/usr/lib/
super(WebappCon
File "/usr/lib/
super(WebappCon
File "/usr/lib/
self.pointer = Pointer(
File "/usr/lib/
"Cannot create a Mouse on devices where X11 is not available."
RuntimeError: Cannot create a Mouse on devices where X11 is not available.
Olivier Tilloy (osomon) wrote : | # |
180 + def tearDown(self):
181 + super(WebappCon
If all the method does is call its parent implementation, then it can be removed.
Olivier Tilloy (osomon) wrote : | # |
Note for when this MR lands: we will need to update the CI job to also run the webapp_container test suite (currently only the webbrowser_app one is run).
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:427
http://
Executed test runs:
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
FAILURE: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:427
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Alexandre Abreu (abreu-alexandre) wrote : | # |
all done
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:428
http://
Executed test runs:
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
FAILURE: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 434. By Launchpad Translations on behalf of phablet-team
-
Launchpad automatic translations update.
- 435. By David Barth
-
Re-execute web application in the dedicated container (compatibility mode for legacy webapps).
Approved by PS Jenkins bot, Alexandre Abreu.
- 436. By PS Jenkins bot
-
Releasing 0.23+14.
04.20140115. 1-0ubuntu1 (revision 435 from lp:webbrowser-app). Approved by PS Jenkins bot.
- 437. By Launchpad Translations on behalf of phablet-team
-
Launchpad automatic translations update.
- 438. By Launchpad Translations on behalf of phablet-team
-
Launchpad automatic translations update.
- 439. By Olivier Tilloy
-
Work around a bug (regression?) in the UITK by replacing the use of Page by a simple Item. Fixes: https:/
/bugs.launchpad .net/bugs/ 1270848. Approved by PS Jenkins bot, Alexandre Abreu, Oliver Grawert.
- 440. By PS Jenkins bot
-
Releasing 0.23+14.
04.20140120- 0ubuntu1 (revision 439 from lp:webbrowser-app). Approved by PS Jenkins bot.
- 441. By Launchpad Translations on behalf of phablet-team
-
Launchpad automatic translations update.
- 442. By Ted Gould
-
Add URL Dispatcher configuration file.
Approved by PS Jenkins bot, Olivier Tilloy.
- 443. By Olivier Tilloy
-
Fix a memory leak when exiting the application.
Approved by Alexandre Abreu, PS Jenkins bot.
- 444. By Olivier Tilloy
-
Work around bug #1270848 in a different manner to avoid introducing another regression. Fixes: https:/
/bugs.launchpad .net/bugs/ 1271436. Approved by Łukasz Zemczak, PS Jenkins bot.
- 445. By PS Jenkins bot
-
Releasing 0.23+14.
04.20140122- 0ubuntu1 (revision 444 from lp:webbrowser-app). Approved by PS Jenkins bot.
- 446. By Launchpad Translations on behalf of phablet-team
-
Launchpad automatic translations update.
Alexandre Abreu (abreu-alexandre) wrote : | # |
ping?
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:428
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Olivier Tilloy (osomon) wrote : | # |
When running the tests on my device (with `phablet-test-run -o . webapp_container`), I’m getting 4 occurrences of the same failure:
<failure type="testtools
process-stdout
process-
process-stderr: {{{
/usr/bin/
/usr/bin/
/usr/bin/
/usr/bin/
/usr/bin/
/usr/bin/
/usr/bin/
/usr/bin/
/usr/bin/
/usr/bin/
/usr/bin/
/usr/bin/
/usr/bin/
QUbuntu: Could not create application instance
}}}
Traceback (most recent call last):
File "/usr/lib/
self.
File "/usr/lib/
raise MismatchError(
MismatchError: None == None
</failure>
Leo Arias (elopio) wrote : | # |
116 +# Copyright 2013 Canonical
130 +# Copyright 2013 Canonical
142 +# Copyright 2013 Canonical
265 +# Copyright 2013 Canonical
296 +# Copyright 2013 Canonical
Please update the copyright years to include 2014.
The other files you touched it might need this too.
124 === added directory 'tests/
125 === added file 'tests/
Why do you need this empty emulators module?
173 + ARGS = []
ARGS is not a constant, so it should be lowercase.
205 +class RequestHandler(
232 +class WebappContainer
To be consistent with what we are doing in other projects, I'd move this clases to a fake_servers.py module.
202 +HTTP_SERVER_PORT = 8383
236 + self.server = BaseHTTPServer.
If you pass 0 as the port, it will get a random free port, which is nice because the port is not released immediately after the server is shut down, so if tests are running too fast you might find that the port is occupied.
262 +++ tests/autopilot
The name of the modules should be all lowercase, so test_app_launch.py
281 + def test_container_
312 + def test_container_
180 + def launch_
I think it would be clearer if you don't catch the exception here, and just let it go it's way. Then, you can remove from the tests the
326 + self.assertThat
It will just fail if for some reason the app can't be launched.
Leo Arias (elopio) wrote : | # |
Take a look at how we are starting fake servers as fixtures:
http://
That's nice because it makes the code a little cleaner, but more important, you don't have to manually add the server stop on the tests, so you won't forget it. And, you will be able to test that your assumptions and preconditions are sane.
- 447. By Launchpad Translations on behalf of phablet-team
-
Launchpad automatic translations update.
- 448. By Launchpad Translations on behalf of phablet-team
-
Launchpad automatic translations update.
- 449. By Launchpad Translations on behalf of phablet-team
-
Launchpad automatic translations update.
- 450. By Launchpad Translations on behalf of phablet-team
-
Launchpad automatic translations update.
- 451. By Olivier Tilloy
-
Do not install the selection event handlers on certain domains known to interfere with touch events. Fixes: 1279903
- 452. By PS Jenkins bot
-
Releasing 0.23+14.
04.20140219- 0ubuntu1 - 453. By Launchpad Translations on behalf of phablet-team
-
Launchpad automatic translations update.
- 454. By Alexandre Abreu
-
Add online account support in the webapp container
- 455. By PS Jenkins bot
-
Releasing 0.23+14.
04.20140304- 0ubuntu1 - 456. By Launchpad Translations on behalf of phablet-team
-
Launchpad automatic translations update.
- 457. By Launchpad Translations on behalf of phablet-team
-
Launchpad automatic translations update.
- 458. By Launchpad Translations on behalf of phablet-team
-
Launchpad automatic translations update.
- 459. By Timo Jyrinki
-
Apply the revert that is in archives now, and rebuild against Qt 5.2.1
- 460. By PS Jenkins bot
-
Releasing 0.23+14.
04.20140313- 0ubuntu1
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:429
http://
Executed test runs:
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
FAILURE: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Alexandre Abreu (abreu-alexandre) wrote : | # |
done & fixed
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:431
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 461. By Olivier Tilloy
-
Do not register private types in the public plugin.
Register them in the webbrowser application scope instead.I have made sure that private types that were previously public are currently not being used by any application in the store, so this refactoring is safe.
- 462. By Leo Arias
-
Updated the copyright header on all the python files.
- 463. By Adnane Belmadiaf
-
Fix to open URL that start with / (local files)
- 464. By Olivier Tilloy
-
Refactor the test HTTP server to use a random port at startup.
- 465. By PS Jenkins bot
-
Releasing 0.23+14.
04.20140317- 0ubuntu1 - 466. By Colin Watson
-
Add multiarch annotations.
- 467. By PS Jenkins bot
-
Releasing 0.23+14.
04.20140317. 1-0ubuntu1 - 468. By Olivier Tilloy
-
Use the renderer only once when rendering a thumbnail.
This seems to fix the crash that was happening at destruction time. Fixes: 1294219 - 469. By PS Jenkins bot
-
Releasing 0.23+14.
04.20140319- 0ubuntu1 - 470. By Launchpad Translations on behalf of phablet-team
-
Launchpad automatic translations update.
- 471. By Alexandre Abreu
-
There are 2 ways for the webapp-container to receive a list of patterns to filter url browsing in a webapp container: through the manifest.json file that comes with a given (named) webapp, or through the command line.
At the moment, the 2 mechanisms are exclusive in the sense that from the webapp-container's perspective it only considers one or another when filtering navigation (the webapp manifest one being preferred) but they are NOT semantically equivalent. The list of url patterns in the manifest.json file is use as a mean to filter the urls that are being browsed to, but ALSO in the chromium & FF browsers to know if a webapp is to be installed/enabled when browsing in a given url.
For example, for Gmail, the hostname mail.google.com is used as a trigger to ask the user for an installation/
enablement of a webapp in the browser. It is also implicitely used as a filter for browser once in the container. The issue is that for applications like google services, the authentication mechanism is common. So when launched in the container, the user will be redirected to e.g. https:/
/accounts. google. com or https:/ /accounts. google. ca, etc. So, the manifest.json cannot be modified to account for those, since we dont want to install a webapp from those URLs but we need a way to add extra navigation url patterns to allow google service webapps to be redirected to e.g. https:/
/accounts. google. * etc. We provide here 2 things:
- an way for the url patterns passed down from the command line to be also considered in the navigation filtering,
- a way to simplify url patterns for google apps Fixes: 1288982 - 472. By PS Jenkins bot
-
Releasing 0.23+14.
04.20140324- 0ubuntu1 - 473. By Olivier Tilloy
-
Land the master Oxide support branch. See individual revisions for details. Fixes: 1271756, 1271759
- 474. By PS Jenkins bot
-
Releasing 0.23+14.
04.20140328. 3-0ubuntu1 - 475. By PS Jenkins bot
-
Resync trunk
- 476. By Launchpad Translations on behalf of phablet-team
-
Launchpad automatic translations update.
- 477. By Olivier Tilloy
-
Null-check to fix a segmentation fault when --help is passed to the executable.
- 478. By Alexandre Abreu
-
Small update to the --webapp flag documentation
- 479. By PS Jenkins bot
-
Releasing 0.23+14.
04.20140402- 0ubuntu1
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:477
http://
Executed test runs:
FAILURE: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:477
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
ABORTED: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:477
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
- 480. By Alexandre Abreu
-
merge trunk
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:480
http://
Executed test runs:
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
Olivier Tilloy (osomon) wrote : | # |
The copyright headers of the new python files need to be updated to match those of the existing files. See e.g. tests/autopilot
Olivier Tilloy (osomon) wrote : | # |
I’m getting 13 errors and warnings when running flake8 on tests/autopilot
Please fix them.
Olivier Tilloy (osomon) wrote : | # |
54 + else {
For consistency with the rest of the code, please keep the else on the same line as the preceding closing brace.
Olivier Tilloy (osomon) wrote : | # |
In RequestHandler.
Olivier Tilloy (osomon) wrote : | # |
For WebappContainer
Olivier Tilloy (osomon) wrote : | # |
It looks to me like test_container_
- 481. By Alexandre Abreu
-
update flake8
- 482. By Alexandre Abreu
-
better comment
- 483. By Alexandre Abreu
-
fixes
Alexandre Abreu (abreu-alexandre) wrote : | # |
all done
- 484. By Alexandre Abreu
-
fix typo
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:483
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:484
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:484
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Olivier Tilloy (osomon) wrote : | # |
199 + self.http_
instead of the above, for increased robustness (because if an exception happens, tearDown won’t be called), you should do the following in setUp, just after instantiating self.http_server:
self.
in which case the tearDown method becomes useless and can be removed.
Olivier Tilloy (osomon) wrote : | # |
194 + port = self.http_
to avoid surfacing an implementation detail of WebappContainer
class WebappContainer
[…]
@property
def port(self):
return self.server.
Alexandre Abreu (abreu-alexandre) wrote : | # |
all done
- 485. By Alexandre Abreu
-
fixes
Olivier Tilloy (osomon) wrote : | # |
265 + if self.server and self.server:
if True and True ?
self.server will never evaluate to False, as it is assigned in __init__. If the instantiation fails, then __init__ will most likely throw an exception, and the test will blow up anyway, so the 'port' property will never be queried. So I think it should be safe to remove this check.
- 486. By Alexandre Abreu
-
remove cruft
Alexandre Abreu (abreu-alexandre) wrote : | # |
ok done,
- 487. By Alexandre Abreu
-
remove cruft
Olivier Tilloy (osomon) wrote : | # |
Looks good now. Thanks!
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:485
http://
Executed test runs:
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
FAILURE: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:487
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
FAILURE: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:487
http://
Executed test runs:
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Preview Diff
1 | === modified file 'debian/control' |
2 | --- debian/control 2014-03-27 16:11:54 +0000 |
3 | +++ debian/control 2014-04-09 16:09:26 +0000 |
4 | @@ -98,3 +98,15 @@ |
5 | A lightweight web browser tailored for Ubuntu, based on the Webkit rendering |
6 | engine and using the Ubuntu UI components. This package contains autopilot |
7 | tests for it. |
8 | + |
9 | +Package: webapp-container-autopilot |
10 | +Architecture: all |
11 | +Depends: ${misc:Depends}, |
12 | + libautopilot-qt (>= 1.4), |
13 | + libqt5test5, |
14 | + ubuntu-ui-toolkit-autopilot, |
15 | + webapp-container (>= ${binary:Version}), |
16 | +Description: Ubuntu web applications container autopilot tests |
17 | + A lightweight webapps container tailored for Ubuntu, based on the Webkit |
18 | + rendering engine and using the Ubuntu UI components. This package contains autopilot |
19 | + tests for it. |
20 | |
21 | === added file 'debian/webapp-container-autopilot.install' |
22 | --- debian/webapp-container-autopilot.install 1970-01-01 00:00:00 +0000 |
23 | +++ debian/webapp-container-autopilot.install 2014-04-09 16:09:26 +0000 |
24 | @@ -0,0 +1,1 @@ |
25 | +usr/lib/python*/dist-packages/webapp_container/* |
26 | |
27 | === modified file 'src/app/webcontainer/WebApp.qml' |
28 | --- src/app/webcontainer/WebApp.qml 2014-03-28 16:05:11 +0000 |
29 | +++ src/app/webcontainer/WebApp.qml 2014-04-09 16:09:26 +0000 |
30 | @@ -26,6 +26,7 @@ |
31 | |
32 | BrowserView { |
33 | id: webapp |
34 | + objectName: "webappBrowserView" |
35 | |
36 | currentWebview: webview.currentWebview |
37 | |
38 | @@ -86,6 +87,7 @@ |
39 | |
40 | PanelLoader { |
41 | id: panel |
42 | + objectName: "panel" |
43 | |
44 | currentWebview: webview.currentWebview |
45 | chromeless: webapp.chromeless |
46 | |
47 | === modified file 'src/app/webcontainer/webapp-container.cpp' |
48 | --- src/app/webcontainer/webapp-container.cpp 2014-04-02 15:15:36 +0000 |
49 | +++ src/app/webcontainer/webapp-container.cpp 2014-04-09 16:09:26 +0000 |
50 | @@ -84,7 +84,9 @@ |
51 | QList<QUrl> urls = this->urls(); |
52 | if (!urls.isEmpty()) { |
53 | m_window->setProperty("url", urls.first()); |
54 | - } |
55 | + } else { |
56 | + return false; |
57 | + } |
58 | } |
59 | |
60 | m_component->completeCreate(); |
61 | |
62 | === modified file 'src/app/webcontainer/webapp-container.qml' |
63 | --- src/app/webcontainer/webapp-container.qml 2014-03-21 12:47:26 +0000 |
64 | +++ src/app/webcontainer/webapp-container.qml 2014-04-09 16:09:26 +0000 |
65 | @@ -21,6 +21,8 @@ |
66 | import Ubuntu.Components 0.1 |
67 | |
68 | Window { |
69 | + objectName: "webappContainer" |
70 | + |
71 | property alias developerExtrasEnabled: browser.developerExtrasEnabled |
72 | |
73 | property alias backForwardButtonsVisible: browser.backForwardButtonsVisible |
74 | |
75 | === modified file 'tests/autopilot/CMakeLists.txt' |
76 | --- tests/autopilot/CMakeLists.txt 2013-03-08 09:52:30 +0000 |
77 | +++ tests/autopilot/CMakeLists.txt 2014-04-09 16:09:26 +0000 |
78 | @@ -1,9 +1,7 @@ |
79 | -set(AUTOPILOT_DIR webbrowser_app) |
80 | - |
81 | execute_process(COMMAND python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()" |
82 | OUTPUT_VARIABLE PYTHON_PACKAGE_DIR OUTPUT_STRIP_TRAILING_WHITESPACE) |
83 | |
84 | -install(DIRECTORY ${AUTOPILOT_DIR} |
85 | - DESTINATION ${PYTHON_PACKAGE_DIR} |
86 | - ) |
87 | +install(DIRECTORY webbrowser_app webapp_container |
88 | + DESTINATION ${PYTHON_PACKAGE_DIR} |
89 | + ) |
90 | |
91 | |
92 | === added directory 'tests/autopilot/webapp_container' |
93 | === added file 'tests/autopilot/webapp_container/__init__.py' |
94 | --- tests/autopilot/webapp_container/__init__.py 1970-01-01 00:00:00 +0000 |
95 | +++ tests/autopilot/webapp_container/__init__.py 2014-04-09 16:09:26 +0000 |
96 | @@ -0,0 +1,16 @@ |
97 | +# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- |
98 | +# Copyright 2014 Canonical |
99 | +# |
100 | +# This program is free software: you can redistribute it and/or modify it |
101 | +# under the terms of the GNU General Public License version 3, as published |
102 | +# by the Free Software Foundation. |
103 | +# |
104 | +# This program is distributed in the hope that it will be useful, |
105 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
106 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
107 | +# GNU General Public License for more details. |
108 | +# |
109 | +# You should have received a copy of the GNU General Public License |
110 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
111 | + |
112 | +"""webapp_container autopilot tests and emulators - top level package.""" |
113 | |
114 | === added directory 'tests/autopilot/webapp_container/tests' |
115 | === added file 'tests/autopilot/webapp_container/tests/__init__.py' |
116 | --- tests/autopilot/webapp_container/tests/__init__.py 1970-01-01 00:00:00 +0000 |
117 | +++ tests/autopilot/webapp_container/tests/__init__.py 2014-04-09 16:09:26 +0000 |
118 | @@ -0,0 +1,82 @@ |
119 | +# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- |
120 | +# Copyright 2014 Canonical |
121 | +# |
122 | +# This program is free software: you can redistribute it and/or modify it |
123 | +# under the terms of the GNU General Public License version 3, as published |
124 | +# by the Free Software Foundation. |
125 | +# |
126 | +# This program is distributed in the hope that it will be useful, |
127 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
128 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
129 | +# GNU General Public License for more details. |
130 | +# |
131 | +# You should have received a copy of the GNU General Public License |
132 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
133 | + |
134 | +""" Autopilot tests for the webapp_container package """ |
135 | + |
136 | +import os |
137 | +import subprocess |
138 | + |
139 | +from autopilot.testcase import AutopilotTestCase |
140 | +from autopilot.platform import model |
141 | + |
142 | +from ubuntuuitoolkit import emulators as toolkit_emulators |
143 | +from webapp_container.tests import fake_servers |
144 | + |
145 | +BASE_FILE_PATH = os.path.dirname(os.path.realpath(__file__)) |
146 | +CONTAINER_EXEC_REL_PATH = '../../../../src/app/webcontainer/webapp-container' |
147 | +INSTALLED_BROWSER_CONTAINER_PATH_NAME = 'webapp-container' |
148 | +try: |
149 | + INSTALLED_BROWSER_CONTAINER_PATH_NAME = subprocess.check_output( |
150 | + ['which', 'webapp-container']).strip() |
151 | +except subprocess.CalledProcessError: |
152 | + pass |
153 | + |
154 | +LOCAL_BROWSER_CONTAINER_PATH_NAME = "%s/%s" % (BASE_FILE_PATH, |
155 | + CONTAINER_EXEC_REL_PATH) |
156 | + |
157 | + |
158 | +class WebappContainerTestCaseBase(AutopilotTestCase): |
159 | + def get_webcontainer_app_path(self): |
160 | + if os.path.exists(LOCAL_BROWSER_CONTAINER_PATH_NAME): |
161 | + return LOCAL_BROWSER_CONTAINER_PATH_NAME |
162 | + return INSTALLED_BROWSER_CONTAINER_PATH_NAME |
163 | + |
164 | + def launch_webcontainer_app(self, args): |
165 | + if model() != 'Desktop': |
166 | + args.append( |
167 | + '--desktop_file_hint=/usr/share/applications/' |
168 | + 'webbrowser-app.desktop') |
169 | + try: |
170 | + self.app = self.launch_test_application( |
171 | + self.get_webcontainer_app_path(), |
172 | + *args, |
173 | + emulator_base=toolkit_emulators.UbuntuUIToolkitEmulatorBase) |
174 | + except: |
175 | + self.app = None |
176 | + |
177 | + def get_webcontainer_proxy(self): |
178 | + return self.app |
179 | + |
180 | + def get_webcontainer_window(self): |
181 | + return self.app.select_single(objectName="webappContainer") |
182 | + |
183 | + def get_webcontainer_webview(self): |
184 | + return self.app.select_single(objectName="webappBrowserView") |
185 | + |
186 | + def get_webcontainer_panel(self): |
187 | + return self.app.select_single(objectName="panel") |
188 | + |
189 | + |
190 | +class WebappContainerTestCaseWithLocalContentBase(WebappContainerTestCaseBase): |
191 | + def setUp(self): |
192 | + super(WebappContainerTestCaseWithLocalContentBase, self).setUp() |
193 | + self.http_server = fake_servers.WebappContainerContentHttpServer() |
194 | + self.addCleanup(self.http_server.shutdown) |
195 | + self.base_url = "http://localhost:%d" % self.http_server.port |
196 | + |
197 | + def launch_webcontainer_app_with_local_http_server(self, args, path='/'): |
198 | + self.url = self.base_url + path |
199 | + args.append(self.url) |
200 | + self.launch_webcontainer_app(args) |
201 | |
202 | === added file 'tests/autopilot/webapp_container/tests/fake_servers.py' |
203 | --- tests/autopilot/webapp_container/tests/fake_servers.py 1970-01-01 00:00:00 +0000 |
204 | +++ tests/autopilot/webapp_container/tests/fake_servers.py 2014-04-09 16:09:26 +0000 |
205 | @@ -0,0 +1,68 @@ |
206 | +# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- |
207 | +# Copyright 2014 Canonical |
208 | +# |
209 | +# This program is free software: you can redistribute it and/or modify it |
210 | +# under the terms of the GNU General Public License version 3, as published |
211 | +# by the Free Software Foundation. |
212 | +# |
213 | +# This program is distributed in the hope that it will be useful, |
214 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
215 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
216 | +# GNU General Public License for more details. |
217 | +# |
218 | +# You should have received a copy of the GNU General Public License |
219 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
220 | + |
221 | +""" Autopilot tests for the webapp_container package """ |
222 | + |
223 | +import BaseHTTPServer |
224 | +import logging |
225 | +import threading |
226 | + |
227 | + |
228 | +class RequestHandler(BaseHTTPServer.BaseHTTPRequestHandler): |
229 | + def serve_content(self, content, mime_type='text/html'): |
230 | + self.send_header('Content-type', mime_type) |
231 | + self.end_headers() |
232 | + self.wfile.write(content) |
233 | + |
234 | + def basic_html_content(self): |
235 | + return """ |
236 | +<html> |
237 | +<head> |
238 | +<title>Some content</title> |
239 | +</head> |
240 | +<body> |
241 | +This is some content |
242 | +</body> |
243 | +</html> |
244 | + """ |
245 | + |
246 | + def do_GET(self): |
247 | + if self.path == '/': |
248 | + self.send_response(200) |
249 | + self.serve_content(self.basic_html_content()) |
250 | + else: |
251 | + self.send_error(404) |
252 | + |
253 | + |
254 | +class WebappContainerContentHttpServer(object): |
255 | + def __init__(self): |
256 | + super(WebappContainerContentHttpServer, self).__init__() |
257 | + self.server = BaseHTTPServer.HTTPServer(("", 0), RequestHandler) |
258 | + self.server.allow_reuse_address = True |
259 | + self.server_thread = threading.Thread(target=self.server.serve_forever) |
260 | + self.server_thread.start() |
261 | + logging.info("now serving on port {}".format(self.server.server_port)) |
262 | + |
263 | + @property |
264 | + def port(self): |
265 | + return self.server.server_port |
266 | + |
267 | + def run(self): |
268 | + self.server.serve_forever() |
269 | + |
270 | + def shutdown(self): |
271 | + self.server.shutdown() |
272 | + self.server.server_close() |
273 | + self.server_thread.join() |
274 | |
275 | === added file 'tests/autopilot/webapp_container/tests/test_app_launch.py' |
276 | --- tests/autopilot/webapp_container/tests/test_app_launch.py 1970-01-01 00:00:00 +0000 |
277 | +++ tests/autopilot/webapp_container/tests/test_app_launch.py 2014-04-09 16:09:26 +0000 |
278 | @@ -0,0 +1,36 @@ |
279 | +# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- |
280 | +# Copyright 2014 Canonical |
281 | +# |
282 | +# This program is free software: you can redistribute it and/or modify it |
283 | +# under the terms of the GNU General Public License version 3, as published |
284 | +# by the Free Software Foundation. |
285 | +# |
286 | +# This program is distributed in the hope that it will be useful, |
287 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
288 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
289 | +# GNU General Public License for more details. |
290 | +# |
291 | +# You should have received a copy of the GNU General Public License |
292 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
293 | + |
294 | +from __future__ import absolute_import |
295 | + |
296 | +from testtools.matchers import Equals |
297 | +from autopilot.matchers import Eventually |
298 | + |
299 | +from webapp_container.tests import WebappContainerTestCaseWithLocalContentBase |
300 | + |
301 | + |
302 | +class WebappContainerAppLaunchTestCase( |
303 | + WebappContainerTestCaseWithLocalContentBase): |
304 | + |
305 | + def test_container_does_not_load_with_no_webapp_name_and_url(self): |
306 | + args = ['--webapp'] |
307 | + self.launch_webcontainer_app(args) |
308 | + self.assertThat(self.get_webcontainer_proxy(), Equals(None)) |
309 | + |
310 | + def test_loads_with_url(self): |
311 | + args = ['--enable-addressbar'] |
312 | + self.launch_webcontainer_app_with_local_http_server(args) |
313 | + self.assertThat(lambda: self.get_webcontainer_window().url, |
314 | + Eventually(Equals(self.url))) |
315 | |
316 | === added file 'tests/autopilot/webapp_container/tests/test_chrome_setup.py' |
317 | --- tests/autopilot/webapp_container/tests/test_chrome_setup.py 1970-01-01 00:00:00 +0000 |
318 | +++ tests/autopilot/webapp_container/tests/test_chrome_setup.py 2014-04-09 16:09:26 +0000 |
319 | @@ -0,0 +1,48 @@ |
320 | +# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- |
321 | +# Copyright 2014 Canonical |
322 | +# |
323 | +# This program is free software: you can redistribute it and/or modify it |
324 | +# under the terms of the GNU General Public License version 3, as published |
325 | +# by the Free Software Foundation. |
326 | +# |
327 | +# This program is distributed in the hope that it will be useful, |
328 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
329 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
330 | +# GNU General Public License for more details. |
331 | +# |
332 | +# You should have received a copy of the GNU General Public License |
333 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
334 | + |
335 | +from __future__ import absolute_import |
336 | + |
337 | +from testtools.matchers import Equals, NotEquals |
338 | + |
339 | +from webapp_container.tests import WebappContainerTestCaseWithLocalContentBase |
340 | + |
341 | + |
342 | +class WebappContainerChromeSetupTestCase( |
343 | + WebappContainerTestCaseWithLocalContentBase): |
344 | + |
345 | + def test_default_to_chromeless(self): |
346 | + self.launch_webcontainer_app_with_local_http_server([]) |
347 | + self.assertThat(self.get_webcontainer_proxy(), NotEquals(None)) |
348 | + self.assertThat(self.get_webcontainer_webview().chromeless, |
349 | + Equals(True)) |
350 | + |
351 | + def test_enable_chrome_back_forward(self): |
352 | + args = ['--enable-back-forward'] |
353 | + self.launch_webcontainer_app_with_local_http_server(args) |
354 | + self.assertThat(self.get_webcontainer_webview().chromeless, |
355 | + Equals(False)) |
356 | + panel = self.get_webcontainer_panel() |
357 | + self.assertThat(panel.backForwardButtonsVisible, |
358 | + Equals(True)) |
359 | + |
360 | + def test_enable_chrome_address_bar(self): |
361 | + args = ['--enable-addressbar'] |
362 | + self.launch_webcontainer_app_with_local_http_server(args) |
363 | + self.assertThat(self.get_webcontainer_proxy(), NotEquals(None)) |
364 | + self.assertThat(self.get_webcontainer_webview().chromeless, |
365 | + Equals(False)) |
366 | + self.assertThat(self.get_webcontainer_panel().addressBarVisible, |
367 | + Equals(True)) |
PASSED: Continuous integration, rev:424 jenkins. qa.ubuntu. com/job/ webbrowser- app-ci/ 568/ jenkins. qa.ubuntu. com/job/ generic- mediumtests- trusty/ 1733 jenkins. qa.ubuntu. com/job/ generic- mediumtests- trusty- touch/1657 jenkins. qa.ubuntu. com/job/ webbrowser- app-trusty- amd64-ci/ 70 jenkins. qa.ubuntu. com/job/ webbrowser- app-trusty- armhf-ci/ 70 jenkins. qa.ubuntu. com/job/ webbrowser- app-trusty- armhf-ci/ 70/artifact/ work/output/ *zip*/output. zip jenkins. qa.ubuntu. com/job/ webbrowser- app-trusty- i386-ci/ 70 jenkins. qa.ubuntu. com/job/ autopilot- testrunner- otto-trusty/ 1532 jenkins. qa.ubuntu. com/job/ generic- mediumtests- builder- trusty- amd64/1733 jenkins. qa.ubuntu. com/job/ generic- mediumtests- builder- trusty- amd64/1733/ artifact/ work/output/ *zip*/output. zip jenkins. qa.ubuntu. com/job/ generic- mediumtests- builder- trusty- armhf/1657 jenkins. qa.ubuntu. com/job/ generic- mediumtests- builder- trusty- armhf/1657/ artifact/ work/output/ *zip*/output. zip jenkins. qa.ubuntu. com/job/ generic- mediumtests- runner- mako/4164 s-jenkins. ubuntu- ci:8080/ job/touch- flash-device/ 2370
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild: s-jenkins. ubuntu- ci:8080/ job/webbrowser- app-ci/ 568/rebuild
http://