Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save jeremypele/8ed50278aab405c2df73e788391c863d to your computer and use it in GitHub Desktop.
Save jeremypele/8ed50278aab405c2df73e788391c863d to your computer and use it in GitHub Desktop.
nativescript-appium-wd-driver-example.ts
import { AppiumDriver, createDriver, SearchOptions } from 'nativescript-dev-appium'
import { runType } from 'nativescript-dev-appium/lib/parser'
import { Direction } from 'nativescript-dev-appium/lib/direction'
import { assert } from 'chai'
describe('E2E Specs', () => {
let driver: AppiumDriver
before(async () => (driver = await createDriver()))
after(async () => await driver.quit())
/*
* WD Examples
*/
describe('Webdriver Examples', async () => {
/*
* Orientation
*/
it('Changes device orientation', () => {
driver.driver.setOrientation('landscape')
// SPEC HERE
})
/*
* Device modes
*/
it('Toggles airplace mode (and test the offline mode)', () => {
driver.driver.toggleAirplaneModeOnDevice()
// SPEC HERE
})
/*
* Geolocation
*/
it('Sets Montreal Location', () => {
driver.driver.setGeoLocation(45.5, 73.5, 0)
// SPEC HERE
})
/*
* Dialogs
*/
it('Accepts any alert', () => {
await driver.driver.acceptAlert()
// SPEC HERE
})
it('Fills a prompt and submit it', () => {
await driver.driver.alertKeys('FOO')
await driver.driver.acceptAlert()
// SPEC HERE
})
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment