Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save AbidKhairyAK/1760a27813b50b0cef9d38ebadc07f1f to your computer and use it in GitHub Desktop.

Select an option

Save AbidKhairyAK/1760a27813b50b0cef9d38ebadc07f1f to your computer and use it in GitHub Desktop.
Setup WebDriverIO WDIO with Appium for Mobile Testing

Setup project

mkdir your_folder
cd your_folder
npm init -y
npm i @wdio/cli appium@next ts-node typescript
npx wdio config
npx appium driver install uiautomator2

Configure wdio.conf.js

const path = require('path')

exports.config = {
	// ... another code ...
	port: 4723,
	specs: ['./test/specs/**/*.js'],
	capabilities: [{
		platformName: 'Android',
		'appium:deviceName': 'your_device_name',
		'appium:automationName': 'UiAutomator2',
		'appium:app': path.join(process.cwd(), './your/application/location/app.apk')
	}],
	services: ['appium'],
	// ... another code ...
}

Check prerequisites

npm i -g appium-doctor
appium-doctor

Create sample test in ./test/specs/sample.js

describe('test wrapper', () => {
	it('test title', () => {
		expect(1).toBe(1)
	})
})

Open your emulator/device and Run the test

npx wdio
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment