Verifying that the Test Does What It Says

Now that we know our test will fail properly if the app doesn’t behave, let’s finish by tidying up our script to make it easier for us to identify and verify what it’s doing. Switch back to the script editor and add log messages to help explain each step as it happens:

02-Behavior/step04/remove_search_term.js
 
var​ target = UIATarget.localTarget();
 
var​ app = target.frontMostApp();
 
var​ window = app.mainWindow();
 
var​ tableView = window.tableViews()[0];
 
var​ cells = tableView.cells();
 
*
UIALogger.logMessage(​"Turn on edit mode"​);
 
var​ navigationBar = app.navigationBar();
 
var​ editButton = navigationBar.leftButton();
 
editButton.tap();
 
*
UIALogger.logMessage(​"Delete cell named 'coffee'" ...

Get Test iOS Apps with UI Automation now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.