← Back to team overview

ubuntu-touch-coreapps-reviewers team mailing list archive

[Merge] lp:~ahayzen/ubuntu-calculator-app/app-welcome-wizard-autopilot into lp:~ubuntu-calculator-dev/ubuntu-calculator-app/ubuntu-calculator-app-welcome-wizard

 

Andrew Hayzen has proposed merging lp:~ahayzen/ubuntu-calculator-app/app-welcome-wizard-autopilot into lp:~ubuntu-calculator-dev/ubuntu-calculator-app/ubuntu-calculator-app-welcome-wizard.

Commit message:
* Add Skip Label to SlideBase.qml
* Add Walkthrough, Page, click_object helpers
* Skip the walkthrough for every test

Requested reviews:
  Ubuntu Calculator Developers (ubuntu-calculator-dev)

For more details, see:
https://code.launchpad.net/~ahayzen/ubuntu-calculator-app/app-welcome-wizard-autopilot/+merge/282163

* Add Skip Label to SlideBase.qml
* Add Walkthrough, Page, click_object helpers
* Skip the walkthrough for every test

Note that it appears when 1 test fails in the test suite that then the skipping doesn't work as it doesn't press the button, note sure what is going on here - possibly things aren't loading fully but I tried putting in long waits.
-- 
Your team Ubuntu Calculator Developers is requested to review the proposed merge of lp:~ahayzen/ubuntu-calculator-app/app-welcome-wizard-autopilot into lp:~ubuntu-calculator-dev/ubuntu-calculator-app/ubuntu-calculator-app-welcome-wizard.
=== modified file 'app/ui/Walkthrough.qml'
--- app/ui/Walkthrough.qml	2016-01-09 15:53:49 +0000
+++ app/ui/Walkthrough.qml	2016-01-11 11:47:02 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright 2015 Nekhelesh Ramananthan (UCS)
+ * Copyright 2015, 2016 Nekhelesh Ramananthan (UCS)
  *
  * This file is part of Ubuntu Calculator App
  *
@@ -86,6 +86,7 @@
     // Label to skip the walkthrough. Only visible on the first slide
     Label {
         id: skipLabel
+        objectName: "skipLabel"
 
         visible: enabled
         enabled: listView.currentIndex !== listView.count-1

=== modified file 'app/welcomewizard/WelcomeWizard.qml'
--- app/welcomewizard/WelcomeWizard.qml	2016-01-07 21:27:18 +0000
+++ app/welcomewizard/WelcomeWizard.qml	2016-01-11 11:47:02 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2015 Canonical Ltd
+ * Copyright (C) 2015, 2016 Canonical Ltd
  *
  * This file is part of Ubuntu Calculator App
  *
@@ -24,6 +24,7 @@
 Walkthrough {
     id: walkthrough
     appName: "Calculator"
+    objectName: "walkthroughPage"
     onFinished: {
         console.log("[LOG]: Welcome tour complete")
         settings.firstRun = false

=== modified file 'debian/changelog'
--- debian/changelog	2015-11-28 21:35:19 +0000
+++ debian/changelog	2016-01-11 11:47:02 +0000
@@ -8,6 +8,9 @@
   * Run Calculator in Landscape mode for Desktop (LP: #1468663)
   * Add instruction how to enable profiling (workaround for LP: #1520551) 
 
+  [ Andrew Hayzen ]
+  * Add skip label to walkthrough, and skip when running tests
+
  -- Bartosz Kosiorek <gang65@xxxxxxxxxxxxxx>  Thu, 12 Nov 2015 13:28:29 +0100
 
 ubuntu-calculator-app (2.0.233) vivid; urgency=medium

=== modified file 'tests/autopilot/ubuntu_calculator_app/__init__.py'
--- tests/autopilot/ubuntu_calculator_app/__init__.py	2015-11-15 01:07:55 +0000
+++ tests/autopilot/ubuntu_calculator_app/__init__.py	2016-01-11 11:47:02 +0000
@@ -1,6 +1,6 @@
 # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
 #
-# Copyright (C) 2013 Canonical Ltd.
+# Copyright (C) 2013, 2016 Canonical Ltd.
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU Lesser General Public License as published by
@@ -20,6 +20,14 @@
 import ubuntuuitoolkit
 
 
+def click_object(func):
+    """Wrapper which clicks the returned object"""
+    def func_wrapper(self, *args, **kwargs):
+        return self.pointing_device.click_object(func(self, *args, **kwargs))
+
+    return func_wrapper
+
+
 class CalculatorApp(object):
     """Autopilot helper object for the calculator application."""
 
@@ -155,6 +163,10 @@
         return self.wait_select_single('TextField',
                                        objectName='textInputField').displayText
 
+    def get_walkthrough_page(self):
+        return self.wait_select_single(Walkthrough,
+                                       objectName="walkthroughPage")
+
     def show_scientific_keyboard(self):
         self._scientific_keyboard()
 
@@ -193,3 +205,22 @@
 
         """
         ubuntuuitoolkit.get_keyboard().press_and_release(keyToPress, delay=0.1)
+
+
+class Page(ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase):
+    """Autopilot helper for Pages."""
+    def __init__(self, *args):
+        super(Page, self).__init__(*args)
+
+
+class Walkthrough(Page):
+    """ Autopilot helper for the walkthrough page """
+    def __init__(self, *args):
+        super(Walkthrough, self).__init__(*args)
+
+        self.visible.wait_for(True)
+        sleep(0.5)
+
+    @click_object
+    def skip(self):
+        return self.wait_select_single("UCLabel", objectName="skipLabel")

=== modified file 'tests/autopilot/ubuntu_calculator_app/tests/test_main.py'
--- tests/autopilot/ubuntu_calculator_app/tests/test_main.py	2015-11-27 23:40:21 +0000
+++ tests/autopilot/ubuntu_calculator_app/tests/test_main.py	2016-01-11 11:47:02 +0000
@@ -4,7 +4,6 @@
 
 from autopilot.matchers import Eventually
 from testtools.matchers import Equals
-
 from ubuntu_calculator_app.tests import CalculatorAppTestCase
 
 
@@ -13,6 +12,8 @@
     def setUp(self):
         super(MainTestCase, self).setUp()
 
+        self.app.main_view.get_walkthrough_page().skip()
+
     def test_simple_calculation_via_keyboard(self):
         self.app.main_view.enter_text_via_keyboard('.9')
         self._assert_result_is(u'0.9')