1.1.7 • Published 6 years ago

screen-pill v1.1.7

Weekly downloads
5
License
MIT
Repository
github
Last release
6 years ago

screen-pill Build Status GitHub Coverage Status Dependencies

library for creating page objects in javascript

inpsired by cheezy's ruby implementation

check out the cucumber demo

install

npm install screen-pill

usage

declare a function to encapsulate a web page

// google-search.js

const ScreenPill = require('screen-pill')

function GoogleSearch(driver) {

  this.setDriver(driver)

  this.directUrl('http://www.google.com')

  this.textField('terms', {name: 'q'})
  this.submit('google')
  this.submit('feelingLucky', {index: 1})

  this.query = async function(query) {
    await this.terms.waitUntilPresent()
    await this.terms.set(query)
    await this.google.waitUntilPresent()
    return this.google.click()
  }

  return this
}

module.exports = ScreenPill(GoogleSearch)

instantiate with driver and use methods

const webdriver = require('selenium-webdriver')
const driver = new webdriver.Builder().forBrowser('chrome').build()
const GoogleSearch = require('google-search')

let searchPage = new GoogleSearch(driver)

async function search() {
  await searchPage.visit()
  return searchPage.query('cats')
}

search()

documentation

see /test for examples using cucumber and chai

see wiki for api and usage

under active development (contributions welcome)

contributors

  • sean gregory
  • phil jordan

special thanks

  • jesse keane
1.1.7

6 years ago

1.1.6

6 years ago

1.1.5

6 years ago

1.1.4

6 years ago

1.1.3

6 years ago

1.1.2

6 years ago

1.1.1

6 years ago

1.1.0

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago