def test_local_suite(self): element = ElementState(locators=[Locator(by=By.NAME, value="q")]) element.save() state1 = State(elements=[], url="") state2 = State(elements=[element], url="http://www.google.com") state1.save() state2.save() params = {} params["url"] = "http://www.google.com/" params["search"] = "Something" commands = [ Command(command=Command.NAVIGATE, config_key="url"), Command(command=Command.SENDKEYS, element=element, config_key="search") ] action = Action(name="Some Action", steps=commands, start_state=state1, end_state=state2) action.save() test = Test(name="Some test", actions=[action]) test.save() suite = TestSuite(tests=[test], url="http://www.google.com/") config1 = RunConfig(browser="Firefox", params=params) config2 = RunConfig(browser="Chrome", params=params) configs = SuiteConfig(configs=[config1, config2], suite=suite) configs.save() suite.suite_config = configs suite.save() executor = SuiteExecutor(suite) executor.execute()
def test_fail_for_wrong_device_type(self): generator = SuiteGenerator(["ipad"]) suite = generator.generate_suite("http://www.percolate.com/") suite.suite_config.configs[0].device_name = "Apple iPhone 4" SuiteExecutor(suite).execute() result = suite.suite_results[-1] assert not result.passed, result.message print "Test was successful : %s" % result.message
def test_sauce_suite(self): element = ElementState(locators=[Locator(by=By.NAME, value="q")]) element.save() state1 = State(elements=[], url="") state2 = State(elements=[element], url="http://www.google.com") state1.save() state2.save() params = {} params["url"] = "http://www.google.com/" params["search"] = "Something" commands = [ Command(command=Command.NAVIGATE, config_key="url"), Command(command=Command.SENDKEYS, element=element, config_key="search") ] action = Action(name="Some Action", steps=commands, start_state=state1, end_state=state2) action.save() test = Test(name="Some test", actions=[action]) test.save() suite = TestSuite(tests=[test], url="http://www.google.com/") config1 = RunConfig(browser="iphone", sauce_user="******", host="sauce", sauce_key="c479e821-57e7-4b3f-8548-48e520585187", params=params) config2 = RunConfig(browser="ipad", sauce_user="******", shost="sauce", auce_key="c479e821-57e7-4b3f-8548-48e520585187", params=params) configs = SuiteConfig(configs=[config1], suite=suite) configs.save() suite.suite_config = configs suite.save() executor = SuiteExecutor(suite) executor.execute()
def test_generate_ipad_test(self): generator = SuiteGenerator(["ipad"]) suite = generator.generate_suite("http://www.percolate.com/") SuiteExecutor(suite).execute() result = suite.suite_results[-1] assert result.passed, result.message