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_confirm_callback(self): self.robot.open("%salert" % base_url) with confirm(self.robot, callback=lambda: False): self.robot.click('id=confirm-button') msg = self.robot.wait_for_alert() self.assertEqual(msg, 'you denied!')
def test_confirm(self): self.robot.open("%salert" % base_url) with confirm(self.robot): self.robot.click('id=confirm-button') msg = self.robot.wait_for_alert() self.assertEqual(msg, 'you confirmed!')
def test_confirm_callback(self): self.robot.open("%salert" % base_url) with confirm(self.robot, callback=lambda: False): self.robot.click( 'id=confirm-button') msg = self.robot.wait_for_alert() self.assertEqual(msg, 'you denied!')
def test_no_confirm(self): self.robot.open("%salert" % base_url) with confirm(self.robot,False): self.robot.selenium('click','id=confirm-button') msg = self.robot.wait_for_alert() self.assertEqual(msg, 'you denied!')