ubuntu-touch-coreapps-reviewers team mailing list archive
-
ubuntu-touch-coreapps-reviewers team
-
Mailing list archive
-
Message #02623
[Merge] lp:~carla-sella/ubuntu-docviewer-app/remove-single-file into lp:ubuntu-docviewer-app
Carla Sella has proposed merging lp:~carla-sella/ubuntu-docviewer-app/remove-single-file into lp:ubuntu-docviewer-app.
Commit message:
Remove single file autopilot test for Ubuntu Docviewer app.
Requested reviews:
Stefano Verzegnassi (verzegnassi-stefano)
Related bugs:
Bug #1428043 in Ubuntu Document Viewer App: "Autopilot Testcase Needed: remove document(s) from disk"
https://bugs.launchpad.net/ubuntu-docviewer-app/+bug/1428043
For more details, see:
https://code.launchpad.net/~carla-sella/ubuntu-docviewer-app/remove-single-file/+merge/261143
New test for deleting a file for Ubuntu Docviewer App.
--
Your team Ubuntu Document Viewer Developers is subscribed to branch lp:ubuntu-docviewer-app.
=== modified file 'po/com.ubuntu.docviewer.pot'
--- po/com.ubuntu.docviewer.pot 2015-05-19 12:06:27 +0000
+++ po/com.ubuntu.docviewer.pot 2015-06-04 20:25:08 +0000
@@ -8,7 +8,7 @@
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2015-05-19 14:05+0200\n"
+"POT-Creation-Date: 2015-06-04 22:10+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@xxxxxx>\n"
@@ -33,8 +33,8 @@
msgstr ""
#: ../src/app/docviewer-application.cpp:171
-#: ../src/app/qml/documentPage/DocumentPage.qml:25
-#: /home/stefano/tmp/build-sdcard-read-support-Desktop-Default/po/com.ubuntu.docviewer.desktop.in.in.h:1
+#: ../src/app/qml/documentPage/DocumentPage.qml:26
+#: /home/letozaf/autopilot-tests/build-ubuntu-docviewer-app-Desktop-Default/po/com.ubuntu.docviewer.desktop.in.in.h:1
msgid "Document Viewer"
msgstr ""
@@ -214,23 +214,23 @@
msgid "dd-MM-yyyy hh:mm"
msgstr ""
-#: ../src/app/qml/documentPage/DocumentListView.qml:136
+#: ../src/app/qml/documentPage/DocumentListView.qml:138
msgid "Today"
msgstr ""
-#: ../src/app/qml/documentPage/DocumentListView.qml:139
+#: ../src/app/qml/documentPage/DocumentListView.qml:141
msgid "Yesterday"
msgstr ""
-#: ../src/app/qml/documentPage/DocumentListView.qml:142
+#: ../src/app/qml/documentPage/DocumentListView.qml:144
msgid "Earlier this week"
msgstr ""
-#: ../src/app/qml/documentPage/DocumentListView.qml:145
+#: ../src/app/qml/documentPage/DocumentListView.qml:147
msgid "Earlier this month"
msgstr ""
-#: ../src/app/qml/documentPage/DocumentListView.qml:147
+#: ../src/app/qml/documentPage/DocumentListView.qml:149
msgid "Even earlier..."
msgstr ""
@@ -319,6 +319,6 @@
msgid "Open"
msgstr ""
-#: /home/stefano/tmp/build-sdcard-read-support-Desktop-Default/po/com.ubuntu.docviewer.desktop.in.in.h:2
+#: /home/letozaf/autopilot-tests/build-ubuntu-docviewer-app-Desktop-Default/po/com.ubuntu.docviewer.desktop.in.in.h:2
msgid "documents;viewer;pdf;reader;"
msgstr ""
=== modified file 'src/app/qml/documentPage/DocumentListView.qml'
--- src/app/qml/documentPage/DocumentListView.qml 2015-04-29 15:58:13 +0000
+++ src/app/qml/documentPage/DocumentListView.qml 2015-06-04 20:25:08 +0000
@@ -23,6 +23,7 @@
MultipleSelectionListView {
id: documentListView
+ objectName: "documentListView"
anchors { fill: parent; margins: units.gu(0.5) }
clip: true
@@ -50,6 +51,7 @@
listDelegate: DocumentListDelegate {
id: delegate
+ objectName:"delegate" + index
property var removalAnimation
=== modified file 'src/app/qml/documentPage/DocumentPage.qml'
--- src/app/qml/documentPage/DocumentPage.qml 2015-05-13 14:22:36 +0000
+++ src/app/qml/documentPage/DocumentPage.qml 2015-06-04 20:25:08 +0000
@@ -21,6 +21,7 @@
Page {
id: documentPage
+ objectName:"documentPage"
title: i18n.tr("Document Viewer")
flickable: null
=== modified file 'tests/autopilot/ubuntu_docviewer_app/__init__.py'
--- tests/autopilot/ubuntu_docviewer_app/__init__.py 2015-05-08 18:59:03 +0000
+++ tests/autopilot/ubuntu_docviewer_app/__init__.py 2015-06-04 20:25:08 +0000
@@ -22,7 +22,9 @@
from autopilot.introspection import dbus
import ubuntuuitoolkit
-
+import os
+import shutil
+from time import sleep
class DocviewerException(ubuntuuitoolkit.ToolkitException):
@@ -73,6 +75,12 @@
return self.wait_select_single(objectName="PdfViewGotoDialog")
@autopilot_logging.log_action(logger.info)
+ def get_DocumentPage(self):
+ """Return Document page"""
+ sleep(5)
+ return self.wait_select_single(DocumentPage)
+
+ @autopilot_logging.log_action(logger.info)
def go_to_page_from_dialog(self, page_no):
""" Go to page from get_PfdViewGotoDialog """
textfield = self.wait_select_single(
@@ -81,12 +89,18 @@
go_button = self.wait_select_single("Button", objectName="GOButton")
self.pointing_device.click_object(go_button)
- @autopilot_logging.log_action(logger.info)
+
def click_go_to_page_button(self):
"""Click the go_to_page header button."""
header = self.get_header()
header.click_action_button('gotopage')
+ @autopilot_logging.log_action(logger.info)
+ def copy_files_to_fake_home(self, fake_home):
+ files_dir = os.path.join(os.path.dirname(__file__), 'files')
+ files = os.listdir(files_dir)
+ for file_name in files:
+ shutil.copy(os.path.join(files_dir, file_name), fake_home)
class Page(ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase):
@@ -181,3 +195,21 @@
self.pointing_device.drag(start_x, start_y,
start_x, stop_y, rate=2)
action_item.moving.wait_for(False)
+
+
+class DocumentPage(Page):
+ """Autopilot helper for Document page."""
+
+ @autopilot_logging.log_action(logger.info)
+ def get_DocumentListView(self):
+ self.wait_select_single(
+ "DocumentListView", objectName="documentListView")
+
+ @autopilot_logging.log_action(logger.info)
+ def get_DocumentListDelegate(self, index):
+ self.wait_select_single("DocumentListDelegate{}".format(index))
+
+ @autopilot_logging.log_action(logger.info)
+ def long_press_document(self, document):
+ self.pointing_device.click_object(document, press_duration=0.3)
+
=== modified file 'tests/autopilot/ubuntu_docviewer_app/tests/__init__.py'
--- tests/autopilot/ubuntu_docviewer_app/tests/__init__.py 2014-12-11 01:13:20 +0000
+++ tests/autopilot/ubuntu_docviewer_app/tests/__init__.py 2015-06-04 20:25:08 +0000
@@ -40,7 +40,18 @@
"""
def get_launcher_and_type(self):
- if os.path.exists(self.local_location_binary):
+ if self.filepath == None and \
+ os.path.exists(self.local_location_binary):
+ launcher = self.launch_test_local_faked_home
+ test_type = 'local-faked-home'
+ elif self.filepath == None and \
+ os.path.exists(self.installed_location_binary):
+ launcher = self.launch_test_installed_faked_home
+ test_type = 'deb-faked-home'
+ elif self.filepath == None:
+ launcher = self.launch_test_click_faked_home
+ test_type = 'click-faked-home'
+ elif os.path.exists(self.local_location_binary):
launcher = self.launch_test_local
test_type = 'local'
elif os.path.exists(self.installed_location_binary):
@@ -102,6 +113,30 @@
"com.ubuntu.docviewer",
emulator_base=ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase)
+ @autopilot_logging.log_action(logger.info)
+ def launch_test_local_faked_home(self):
+ return self.launch_test_application(
+ self.local_location_binary,
+ "--documents-dir=" + self.home_dir,
+ app_type='qt',
+ emulator_base=ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase)
+
+ @autopilot_logging.log_action(logger.info)
+ def launch_test_installed_faked_home(self):
+ return self.launch_test_application(
+ self.installed_location_binary,
+ "--documents-dir=" + self.home_dir,
+ app_type='qt',
+ emulator_base=ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase)
+
+ @autopilot_logging.log_action(logger.info)
+ def launch_test_click_faked_home(self):
+ return self.launch_click_package(
+ "com.ubuntu.docviewer",
+ "--documents-dir=",
+ self.home_dir,
+ emulator_base=ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase)
+
def _copy_xauthority_file(self, directory):
""" Copy .Xauthority file to directory, if it exists in /home
"""
@@ -136,6 +171,7 @@
self._copy_xauthority_file(temp_dir)
self.useFixture(fixtures.EnvironmentVariable('HOME',
newvalue=temp_dir))
+ return temp_dir
logger.debug("Patched home to fake home directory %s" % temp_dir)
=== added file 'tests/autopilot/ubuntu_docviewer_app/tests/test_content_in_fake_home.py'
--- tests/autopilot/ubuntu_docviewer_app/tests/test_content_in_fake_home.py 1970-01-01 00:00:00 +0000
+++ tests/autopilot/ubuntu_docviewer_app/tests/test_content_in_fake_home.py 2015-06-04 20:25:08 +0000
@@ -0,0 +1,29 @@
+# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
+# Copyright 2013 Canonical
+#
+# This program is free software: you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 3, as published
+# by the Free Software Foundation.
+
+"""Docviewer app autopilot tests."""
+
+from autopilot.matchers import Eventually
+from testtools.matchers import Equals, GreaterThan
+
+from ubuntu_docviewer_app.tests import DocviewerAppTestCase
+
+
+class TestInFakeHome(DocviewerAppTestCase):
+
+ def setUp(self):
+ self.filepath = None
+ super(TestInFakeHome, self).setUp()
+
+ def test_remove_single_file(self):
+ self.launch_app()
+ self.app.main_view.copy_files_to_fake_home(self.home_dir)
+ document_page = self.app.main_view.get_DocumentPage()
+ initial_no_of_files = document_page.get_DocumentListView().count
+ index = 0
+ document = document_page.get_DocumentListDelegate(index)
+ document_page.long_press_document(document)
=== modified file 'tests/autopilot/ubuntu_docviewer_app/tests/test_docviewer.py'
--- tests/autopilot/ubuntu_docviewer_app/tests/test_docviewer.py 2015-05-02 10:25:56 +0000
+++ tests/autopilot/ubuntu_docviewer_app/tests/test_docviewer.py 2015-06-04 20:25:08 +0000
@@ -16,6 +16,7 @@
class TestMainWindow(DocviewerAppTestCase):
def setUp(self):
+ self.filepath = ""
super(TestMainWindow, self).setUp()
def go_to_page_no(self, page_no):
=== modified file 'tests/autopilot/ubuntu_docviewer_app/tests/test_toc.py'
--- tests/autopilot/ubuntu_docviewer_app/tests/test_toc.py 2015-05-06 19:00:26 +0000
+++ tests/autopilot/ubuntu_docviewer_app/tests/test_toc.py 2015-06-04 20:25:08 +0000
@@ -27,8 +27,8 @@
]
def setUp(self):
+ self.filepath = 'ubuntu_docviewer_app/files/serverguide.pdf'
super(TestMainWindow, self).setUp()
- self.filepath = 'ubuntu_docviewer_app/files/serverguide.pdf'
def test_go_to_chapters_in_toc(self):
"""" Testing going to chapters from Table Of Contents """
References