August 2013
Intermediate to advanced
200 pages
5h 26m
English
Objects aren’t instances manufactured out of class templates by the runtime like in Objective-C. In JavaScript, objects are built on the fly and share behavior based on prototypes. In this section, we’re going to leverage this to simplify how we define our screen objects.
Let’s pull out all the common methods we want into a generic Screen object:
| 04-OrganizingTestCode/step11/automation/lib/screens/Screen.js | |
| | var Screen = { |
| | |
| | target: function() { |
| | return UIATarget.localTarget(); |
| | }, |
| | app: function() { |
| | return this.target().frontMostApp(); |
| | }, |
| | window: function() { |
| | return this.app().mainWindow(); |
| | }, |
| | navigationBar: function() { |
| | return this.app().navigationBar(); |
| | }, |
| | toolbar: ... |
Read now
Unlock full access