def test_popup_messages_collection(self): self.robot.open("%salert" % base_url) def _test(): self.assertIn('this is a confirm', self.robot.popup_messages) return True with confirm(self.robot, True, callback=_test): self.robot.click( 'id=confirm-button') self.robot.wait_for_alert() with prompt(self.robot, confirm=False): self.robot.click( 'id=prompt-button') self.assertIn('Prompt ?', self.robot.popup_messages) self.robot.click( 'id=alert-button') self.assertIn('this is an alert', self.robot.popup_messages)
def test_prompt_callback(self): self.robot.open("%salert" % base_url) with prompt(self.robot, callback=lambda: 'another value'): self.robot.click('id=prompt-button') value = self.robot.evaluate('promptValue') self.assertEqual(value, 'another value')
def test_prompt(self): self.robot.open("%salert" % base_url) with prompt(self.robot, 'my value'): self.robot.click('id=prompt-button') value = self.robot.evaluate('promptValue') self.assertEqual(value, 'my value')
def test_prompt_callback(self): self.robot.open("%salert" % base_url) with prompt(self.robot, callback=lambda: 'another value'): self.robot.click( 'id=prompt-button') value = self.robot.evaluate('promptValue') self.assertEqual(value, 'another value')
def test_prompt(self): self.robot.open("%salert" % base_url) with prompt(self.robot, 'my value'): self.robot.click( 'id=prompt-button') value = self.robot.evaluate('promptValue') self.assertEqual(value, 'my value')