def yourtest(): this = nightwatch_utils.driver(driver_path) #This should always be present #start your commands here #each command requires specific arguments that need to get passed in. For the most part, you'll need to use 'this' as an argument. Refer to commands.py to see what objects are returned browser.getURL(this, 'http://www.yourtestsite.com') browser.quit() #Each test should quit the browser.
def parse(commands): _command = commands[0] if _command == 'help': # Done command.help() elif _command == 'add': # Done command.add(commands[1:]) elif _command == 'display': # All done # TODO: Date # sort [date|cost] command.display() elif _command == 'delete': # Done command.delete(commands[1]) elif _command == 'find': # TODO if len(commands) == 1: print('please enter criteria') return True command.find(commands[1:]) elif _command == 'clear': command.clear() elif _command == 'quit': # Done command.quit() return False return True
def googletest(): this = nightwatch_utils.driver(driver_path) browser.getURL(this, 'http://www.google.com') browser.refresh(this) browser.assertElementPresent(this, 'body') browser.clickClearAndType(this, '#lst-ib', 'automated testing') browser.clickRetry(this, '.lsb[value="Search"]') browser.pause(5) # pause for 5 seconds browser.snapshot(this, 'google-results.png') browser.quit(this)
def yelptest(): this = nightwatch_utils.driver(driver_path) #This should always be present #start your commands here browser.getURL(this, 'http://www.yelp.com') browser.assertElementPresent(this,'body') browser.assertElementPresent(this,'#find_desc[name=find_desc]') browser.clickClearAndType(this, '#find_desc[name=find_desc]', 'sushi') browser.clickRetry(this,'#header-search-submit[title=Search]') browser.pause(5) # pause for 5 seconds browser.snapshot(this,'yelp-results.png') browser.quit(this)
def quit_app(data=None): Gtk.main_quit() commands.quit()
run = False else: run = bf.ask_to_play() while run: command = input( 'What would you like to do? Type help for options. ').lower() if command == 'help': commands.help() elif command == 'give': hotbar = commands.give(hotbar) elif command == 'quit': run = commands.quit() elif command == 'remove': hotbar = commands.remove(hotbar) elif command == 'see': for s in hotbar: print(s) elif command == 'add': hotbar = commands.add(hotbar) elif command == 'creeper': aww = 'AWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW' man = 'MANNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN' print(f'{aww}\n{man}!!!!!!!!')
def end(): browser.quit(this) return this