How to fix a few Autopilot Issues

There are changes in Autopilot and with these changes you will need to upgrade your test scripts.

Issue 1: AttributeError: type object ‘AutopilotTestCase’ has no attribute ‘register_known_application’

To fix this we need to modify the test script from something like this:

from autopilot.testcase import AutopilotTestCase
from autopilot.matchers import Eventually
from testtools.matchers import Equals, Contains

#register firefox as an application so we can call it
AutopilotTestCase.register_known_application("Firefox", "firefox.desktop", "firefox")

class FirefoxTests(AutopilotTestCase):

def setUp(self):
super(FirefoxTests, self).setUp()
self.app = self.start_app_window("Firefox")

To this:

from autopilot.testcase import AutopilotTestCase
from autopilot.matchers import Eventually
from testtools.matchers import Equals, Contains

class FirefoxTests(AutopilotTestCase):

def setUp(self):
super(FirefoxTests, self).setUp()

       if "Firefox" not in self.process_manager.KNOWN_APPS:
            self.process_manager.register_known_application("Firefox", "firefox.desktop", "firefox")

#make sure firefox is up and loaded
self.app.set_focus()
self.assertTrue(self.app.is_focused)

Issue 2: AttributeError: ‘FirefoxTests’ object has no attribute ‘start_app_window’

We need to change something like the following:

self.app = self.start_app_window("Firefox")

to

self.app = self.process_manager.start_app_window("Firefox")

 

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload the CAPTCHA.