Esempio n. 1
0
    def setUp(self):
        self.touch_event = TouchEvent(50, 50)
        intent = Intent(prefix="start", suffix="com.android.settings")
        self.intent_event = IntentEvent(intent=intent)
        self.long_touch_event = LongTouchEvent(50, 50)
        self.key_event = KeyEvent("HOME")
        self.emulator_event = EmulatorEvent(
            event_name="call", event_data={"phone":"1234567"})
        self.drag_event = DragEvent(50, 50, 100, 100)

        self.activity_context = ActivityNameContext("dummy")
        self.window_context = ActivityNameContext("dummy")
        self.context_event1 = ContextEvent(context=self.activity_context, event=self.touch_event)
        self.context_event2 = ContextEvent(context=self.window_context, event=self.touch_event)
Esempio n. 2
0
    def test_context(self):
        device = Device("emulator-5554")
        self.assertFalse(self.activity_context.assert_in_device(device))
        self.assertFalse(self.window_context.assert_in_device(device))

        settings_activity_context = ActivityNameContext("com.android.settings/.Settings")
        settings_window_context = WindowNameContext("com.android.settings/com.android.settings.Settings")
        device.start_app("com.android.settings")
        time.sleep(2)
        self.assertTrue(settings_activity_context.assert_in_device(device))
        self.assertTrue(settings_window_context.assert_in_device(device))

        device.disconnect()