22from autopilot.matchers
import Eventually
23from testtools.matchers
import Equals
24from lomiriuitoolkit
import lomiri_scenarios
29logger = logging.getLogger(__name__)
34 """Tests for the lock screen."""
36 scenarios = lomiri_scenarios.get_device_simulation_scenarios()
39 """Must be able to unlock the PIN entry lock screen."""
45 if not greeter.tabletMode:
51 self.assertThat(greeter.shown, Eventually(Equals(
False)))
54 """Must be able to unlock the passphrase entry screen."""
56 self.
_environment[
'LIBLIGHTDM_MOCK_MODE'] =
"single-passphrase"
60 if not greeter.tabletMode:
66 self.assertThat(greeter.shown, Eventually(Equals(
False)))
69 """Entering the wrong pin code must not dismiss the lock screen."""
74 if not greeter.tabletMode:
78 pinentryField = self.
main_window.get_pinentryField()
79 self.assertThat(pinentryField.text, Eventually(Equals(
"")))
82 prompt = self.
main_window.get_greeter().get_prompt()
83 self.assertThat(prompt.text, Eventually(Equals(
"")))
84 self.assertThat(greeter.shown, Eventually(Equals(
True)))
87 """Entering the wrong password must not dismiss the lock screen."""
88 self.
_environment[
'LIBLIGHTDM_MOCK_MODE'] =
"single-passphrase"
92 if not greeter.tabletMode:
96 pinentryField = self.
main_window.get_pinentryField()
97 self.assertThat(pinentryField.text, Eventually(Equals(
"")))
100 prompt = self.
main_window.get_greeter().get_prompt()
101 self.assertThat(prompt.text, Eventually(Equals(
"")))
102 self.assertThat(greeter.shown, Eventually(Equals(
True)))
105 """Wait for the lock screen to load, and return it."""
107 self.assertThat(pinPadLoader.progress, Eventually(Equals(1)))
109 self.assertThat(lockscreen.shown, Eventually(Equals(
True)))
113 """Enter the password specified in 'passphrase' into the password entry
114 field of the pin lock screen.
116 :param passphrase: The string you want to enter.
117 :raises: TypeError if passphrase is not a string.
120 if not isinstance(passphrase, str):
122 "'passphrase' parameter must be a string, not %r."
126 pin_entry_field = self.
main_window.get_pinentryField()
128 self.keyboard.type(passphrase)
129 logger.debug(
"Typed passphrase: %s", pin_entry_field.text)
130 self.assertEqual(pin_entry_field.text, passphrase)
131 self.keyboard.type(
"\n")
134 """Enter the password specified in 'passphrase' into the password entry
135 field of the main user list's prompt.
137 :param passphrase: The string you want to enter.
138 :raises: TypeError if passphrase is not a string.
141 if not isinstance(passphrase, str):
143 "'passphrase' parameter must be a string, not %r."
147 prompt = self.
main_window.get_greeter().get_prompt()
148 prompt.write(passphrase)
149 logger.debug(
"Typed passphrase: %s", prompt.text)
150 self.keyboard.type(
"\n")
launch_lomiri(self, mode="full-greeter", *args)
test_can_unlock_passphrase_screen(self)
test_can_unlock_pin_screen(self)
test_passphrase_screen_wrong_password(self)
_wait_for_lockscreen(self)
_enter_pin_passphrase(self, passphrase)
_enter_prompt_passphrase(self, passphrase)
test_pin_screen_wrong_code(self)