Skip to content
Page Object Pattern for Appium and Mocha.
Find file
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


Dependency Status NPM version

Page Object Pattern for Appium and Mocha.


It can be a bit complicated to explain, so please take a look at the example (todo) to have a better idea of how to set everything up.

  • Add a file called drivers.settings.js to your project root and configure it based on this example:
module.exports = {
  screensDir      : 'test/screen',        // DEFAULT
  remote          : ['localhost', 4723 ], // DEFAULT

  capabilities    : {
    ios           : {
      device      : 'iPhone Simulator',
      app         : require('path').resolve(__dirname, 'build', '')
  • Create a directory to hold your screen objects under test/screen.
  • Require screen.object in your mocha options. If you are using mocha.opts you can just add --require screen.object to it.
  • Write your Mocha describes as the following example and you'll have the screens required from your screen directory.
describe('Home', withScreen('HomeScreen', function(screen) {

Running the Appium server automatically

If you want screen.object to run the Appium server automatically, you can --require screen.object/appium in your mocha options. And just like mocha.opts you can specify a appium.opts under your test directory with the options you want your server to start with.


This is licensed under the feel-free-to-do-whatever-you-want-to-do license.

Something went wrong with that request. Please try again.