Skip to content

Instantly share code, notes, and snippets.

@Mon-Ouie
Created July 20, 2010 11:34
Show Gist options
  • Select an option

  • Save Mon-Ouie/482845 to your computer and use it in GitHub Desktop.

Select an option

Save Mon-Ouie/482845 to your computer and use it in GitHub Desktop.
string = Instruments.translate do
self.view = main_window.find_table_view("test")
self.cell = self.view.find_cell(0)
self.elem = self.cell.find_element("Chocolate Cake")
self.but = self.navigation_bar.find_button("Add")
but.tap
self.name = "Turtle Pie"
find_text_field(0).value = name
self.button_name = tab_bar.selected_button.name
self.if (button_name != "Unit Conversion") do
tab_bar.find_button("Unit Conversion").tap
end
find_table_view(0).scroll_to("name beginsWith 'TurtlePie'")
test = "Does the cell exist?"
start_test(test)
screenshot "screenshot1"
self.cell = find_talble_view(0).cells.first_with("name beginsWith 'TurtlePie'")
self.if (cell.valid?) do
pass_test(test)
end
self.else do
fail_test(test)
end
function "addRecipe", 'name' do
log var('name')
end
add_recipe!("Test")
end
puts string
var view = UIATarget.localTarget().frontMostApp().mainWindow().tableViews()["test"];
var cell = view.cells()[0];
var elem = cell.elements()["Chocolate Cake"];
var but = UIATarget.localTarget().frontMostApp().navigationBar().buttons()["Add"];
but.tap();
var name = "Turtle Pie";
UIATarget.localTarget().frontMostApp().mainWindow().textFields()[0].setValue(name);
var buttonName = UIATarget.localTarget().frontMostApp().tabBar().selectedButton().name();
if ((buttonName != "Unit Conversion")) {
UIATarget.localTarget().frontMostApp().tabBar().buttons()["Unit Conversion"].tap();
}
UIATarget.localTarget().frontMostApp().mainWindow().tableViews()[0].scrollToElementWithPredicate("name beginsWith 'TurtlePie'");
UIALogger.logStart("Does the cell exist?");
UIATarget.localTarget().captureScreenWithName("screenshot1");
var cell = UIATarget.localTarget().frontMostApp().mainWindow().talbleViews()[0].cells().firstWithPredicate("name beginsWith 'TurtlePie'");
if (cell.isValid()) {
UIALogger.logPass("Does the cell exist?");
}
else {
UIALogger.logFail("Does the cell exist?");
}
function addRecipe(name) {
UIALogger.logStart(name);
}
addRecipe("Test");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment