derby-webdriverio
Webdriver.io for Derby.js
Last updated 4 years ago by cray0000 .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install derby-webdriverio 
SYNC missed versions from official npm registry.

derby-webdriverio

Webdriver.io for Derby.js

Installation

npm i --save derby-webdriverio

Usage

In your derby app index file:

# app/index.coffee

app = require('derby').createApp 'foobar', __filename

window.app = app if window? # app must be accessible from the client
app.use require('derby-webdriverio/renderReady')

Create wdio.conf.js in project's root folder:

// wdio.conf.js
exports.config = require('derby-webdriverio')({
  // Specify multiple browsers to run.
  // If it's 1 then will be created a single 'remote' instance.
  // If it's >=2 then 'multiremote' will be created; the whole group will be
  // called with the specified name; and each browser in this group will
  // have a singular form of that name + number, i.e. 'student0', 'student1', ...
  // http://webdriver.io/guide/usage/multiremote.html
  browsers: {
    browser: 1,
    prof: 1,
    students: 10
  },
  // selenium settings to use for each browser specified above
  desiredCapabilities: {
    browserName: 'chrome'
  },
  // base url which will be used for .url() methods
  baseUrl: 'http://localhost:3003',
  // timeout to wait until test fails
  waitforTimeout: 30000,
  // path to save screenshots (by default it's /test/screenshots/, don't forget
  // to add it to your .gitignore)
  screenshotPath: __dirname + '/test/screenshots/',
  // files with tests
  specs: [
    './test/e2e/**/*.js',
    './test/e2e/**/*.coffee'
  ],
  // files to ignore
  exclude: [
    './test/e2e/**/_*.js',
    './test/e2e/**/_*.coffee'
  ]
})

To run your tests:

./node_modules/.bin/wdio

If you want to run it as npm test you can add the following script to your package.json:

"scripts": {
  "test": "wdio",
},

.*AndWait()

These methods accept the same arguments as the original methods. They do the same action and wait for derby page to fully load after that.

.urlAndWait()
.clickAndWait()
.submitFormAndWait()

model

All racer get- and set- methods are available.

Couple of examples:

.modelGet()
browser
.modelGet '_session.userId'
.then (userId) ->
  @urlAndWait '/profile/' + userId
.modelSet()
it 'check title', ->
  newTitle = 'New Title'
  prevTitle = yield browser.modelSet '_page.title', newTitle
  browser.getTitle()
  .then (title) ->
    title.should.not.equal prevTitle
    title.should.equal newTitle
all other get/set methods are supported -- .modelAdd, .modelPop, etc.

history

.historyPush(path)

Do app.history.push on the client and wait for the page to fully load.

browser
.historyPush '/profile'
.getTitle()
.should.eventually.equal 'My Profile'
.historyRefresh()

Refresh the page using app.history.refresh on the client.


Chai shorthands

A bunch of useful shorthand methods to test things. All of them accept the arguments which will be passed to X() function.

shouldExist()
browser
# Note that the arguments passed here are `X()` function arguments
.shouldExist 'form.main button *= Submit'
.shouldExist '*= Welcome to my Website'
shouldNotExist()
shouldBeVisible()
shouldNotBeVisible()
shouldExecute

Accepts the same arguments as .execute() and checks that its return value equals true

Current Tags

  • 5.0.0                                ...           latest (2 years ago)

44 Versions

  • 5.0.0                                ...           2 years ago
  • 4.0.1                                ...           2 years ago
  • 3.3.6                                ...           3 years ago
  • 3.3.5                                ...           3 years ago
  • 3.3.4                                ...           3 years ago
  • 3.3.3                                ...           3 years ago
  • 3.3.2                                ...           3 years ago
  • 3.3.1                                ...           3 years ago
  • 3.3.0                                ...           4 years ago
  • 3.2.0                                ...           4 years ago
  • 3.1.0                                ...           4 years ago
  • 4.1.1                                ...           4 years ago
  • 4.1.0                                ...           4 years ago
  • 4.0.0                                ...           4 years ago
  • 3.0.2                                ...           4 years ago
  • 3.0.0                                ...           4 years ago
  • 2.0.1                                ...           4 years ago
  • 2.0.0                                ...           5 years ago
  • 1.1.1                                ...           5 years ago
  • 1.1.0                                ...           5 years ago
  • 1.0.2                                ...           5 years ago
  • 1.0.1                                ...           5 years ago
  • 1.0.0                                ...           5 years ago
  • 0.0.21                                ...           5 years ago
  • 0.0.20                                ...           5 years ago
  • 0.0.19                                ...           5 years ago
  • 0.0.18                                ...           5 years ago
  • 0.0.17                                ...           5 years ago
  • 0.0.16                                ...           5 years ago
  • 0.0.15                                ...           5 years ago
  • 0.0.14                                ...           5 years ago
  • 0.0.13                                ...           5 years ago
  • 0.0.12                                ...           5 years ago
  • 0.0.11                                ...           5 years ago
  • 0.0.10                                ...           5 years ago
  • 0.0.9                                ...           5 years ago
  • 0.0.8                                ...           5 years ago
  • 0.0.7                                ...           5 years ago
  • 0.0.6                                ...           5 years ago
  • 0.0.5                                ...           5 years ago
  • 0.0.4                                ...           5 years ago
  • 0.0.3                                ...           5 years ago
  • 0.0.2                                ...           5 years ago
  • 0.0.1                                ...           5 years ago
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (7)
Dev Dependencies (1)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |