Unverified Commit 9872cedf authored by Giovane Liberato's avatar Giovane Liberato
Browse files

Assert message was sent

parent 6cbd52bf
......@@ -5,6 +5,7 @@ import time
from dogtail.config import config
from dogtail.rawinput import pressKey, typeText
from dogtail.predicate import GenericPredicate
from dogtail.procedural import click, focus, select, type
from dogtail.tree import root
from dogtail.utils import run
......@@ -18,25 +19,37 @@ def start_pidgin():
def open_conversation_with(buddy):
click.tableCell(buddy)
pressKey("Enter")
focus.frame(buddy)
time.sleep(1)
focus.window(buddy)
time.sleep(2)
def start_private_conversation():
click.menu('OTR')
click.menuItem("Start private conversation")
def send_message(buddy, message):
focus.frame(buddy)
focus.window(buddy)
focus.text()
time.sleep(1)
type(message)
pressKey("Enter")
def assert_otr_status(expected):
# TODO remove this space from pidgin UI, probably used for formating
focus.frame.button(' ' + expected)
try:
# TODO remove this space from pidgin UI, probably used for formating
focus.window.button(' ' + expected)
except:
assert False
def assert_message_was_sent_by(sender, message):
chat_tab = focus.window.findChild(GenericPredicate(name=sender, roleName='page tab'))
chat_box = chat_tab.findChild(GenericPredicate(roleName='text'))
message_len = len(message)
assert message == chat_box.text[-message_len:]
if __name__ == '__main__':
config.searchCutoffCount = 3
config.defaultDelay = 1.5
config.blinkOnActions = True
config.fatalErrors = True
pid = start_pidgin()
......@@ -46,6 +59,8 @@ if __name__ == '__main__':
start_private_conversation()
assert_otr_status('Unverified')
send_message('bob@localhost', 'Hi bob!')
assert_message_was_sent_by('bob@localhost', 'Hi bob!')
raw_input("End?\n")
pid.terminate()
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment