All Projects → goodeggs → Chai Webdriver

goodeggs / Chai Webdriver

Licence: mit
Build more expressive integration tests with webdriver sugar for chai.js

Programming Languages

coffeescript
4710 projects

Projects that are alternatives of or similar to Chai Webdriver

chai
BDD / TDD assertion framework for node.js and the browser that can be paired with any testing framework.
Stars: ✭ 7,842 (+6026.56%)
Mutual labels:  assertions, chai
Postman Bdd
A BDD test framework for Postman and Newman
Stars: ✭ 139 (+8.59%)
Mutual labels:  assertions, chai
Enzyme
JavaScript Testing utilities for React
Stars: ✭ 19,781 (+15353.91%)
Mutual labels:  assertions, chai
Redux Actions Assertions
Simplify testing of redux action and async action creators
Stars: ✭ 177 (+38.28%)
Mutual labels:  assertions, chai
Aws Testing Library
Chai (https://chaijs.com) and Jest (https://jestjs.io/) assertions for testing services built with aws
Stars: ✭ 52 (-59.37%)
Mutual labels:  assertions, chai
Binding.scala
Reactive data-binding for Scala
Stars: ✭ 1,539 (+1102.34%)
Mutual labels:  dom
Femtojs
femtoJS - Really small JavaScript (ES6) library for DOM manipulation.
Stars: ✭ 122 (-4.69%)
Mutual labels:  dom
Chai
ERC20 wrapper over the Dai Savings Rate
Stars: ✭ 118 (-7.81%)
Mutual labels:  chai
Jsx Dom
Use JSX to create DOM elements.
Stars: ✭ 117 (-8.59%)
Mutual labels:  dom
Verify
BDD Assertions for PHPUnit and Codeception
Stars: ✭ 127 (-0.78%)
Mutual labels:  assertions
Dom I18n
Provides a very basic HTML multilingual support using JavaScript
Stars: ✭ 125 (-2.34%)
Mutual labels:  dom
Test State
Scala Test-State.
Stars: ✭ 119 (-7.03%)
Mutual labels:  dom
Webdrivermanager
WebDriverManager (Copyright © 2015-2021) is a project created and maintained by Boni Garcia and licensed under the terms of the Apache 2.0 License.
Stars: ✭ 1,808 (+1312.5%)
Mutual labels:  selenium-webdriver
Scrivener
Validation frontend for models.
Stars: ✭ 123 (-3.91%)
Mutual labels:  assertions
Marionette
Selenium alternative for Crystal. Browser manipulation without the Java overhead.
Stars: ✭ 119 (-7.03%)
Mutual labels:  selenium-webdriver
Learnvue
Vue.js 源码解析
Stars: ✭ 11,516 (+8896.88%)
Mutual labels:  dom
Seleniumcrawler
An example using Selenium webdrivers for python and Scrapy framework to create a web scraper to crawl an ASP site
Stars: ✭ 117 (-8.59%)
Mutual labels:  selenium-webdriver
Grappa
Behavior-oriented, expressive, human-friendly Python assertion library for the 21st century
Stars: ✭ 119 (-7.03%)
Mutual labels:  assertions
Scott
Never debug a test again: Detailed failure reports and hassle free assertions for Java tests - Power Asserts for Java
Stars: ✭ 125 (-2.34%)
Mutual labels:  assertions
Dom7
Minimalistic JavaScript library for DOM manipulation, with a jQuery-compatible API
Stars: ✭ 119 (-7.03%)
Mutual labels:  dom

chai-webdriver Build Status Dependency Status NPM version

Provides selenium-webdriver sugar for the Chai assertion library. Allows you to create expressive integration tests:

expect('.frequency-field').dom.to.contain.text('One time')
expect('.toggle-pane').dom.to.not.be.visible()

What sorts of assertions can we make?

All assertions start with a Sizzle-compatible css selector, for example:

  • expect('.list')
  • expect('div > h1')
  • expect('a[href=http://google.com]')

Then we add the dom flag, like so:

  • expect(selector).dom

Finally, we can add our assertion to the chain.

  • expect(selector).dom.to.have.text('string') - Test the text value of the dom against supplied string. Exact matches only.
  • expect(selector).dom.to.contain.text('string') - Test the text value of the dom against supplied string. Partial matches allowed.
  • expect(selector).dom.to.match(/regex/) - Test the text value of the dom against the regular expression.
  • expect(selector).dom.to.have.text(/regex/) - Test the text value of the dom against the regular expression. (Same as match above).
  • expect(selector).dom.to.be.visible() - Check whether or not the element is being rendered
  • expect(selector).dom.to.be.disabled() - Check whether or not the form element is disabled
  • expect(selector).dom.to.have.count(number) - Test how many elements exist in the dom with the supplied selector
  • expect(selector).dom.to.have.style('property', 'value') - Test the CSS style of the element. Exact matches only, unfortunately, for now.
  • expect(selector).dom.to.have.value('string') - Test the value of a form field against supplied string.
  • expect(selector).dom.to.have.htmlClass('warning') - Tests that the element has warning as one of its class attributes.
  • expect(selector).dom.to.have.attribute('attribute', 'value') - Test an element's attribute against value as an exact match. By omitting value test simply checks for existance of attribute.
  • expect(selector).dom.to.have.attribute('attribute', /regex/) - Test an element's attribute against a regular expresssion.

You can also always add a not in there to negate the assertion:

  • expect(selector).dom.not.to.have.style('property', 'value')

Asynchronous flow

Note that all these assertions are presumed to be asynchronous (using selenium-webdriver's promise chain). They can all take callbacks, or be chained with promises. For example:

  • expect(selector).dom.to.have.text('string', function(){...})
  • expect(selector).dom.to.have.text('string').then(function(){...})

Setup

Setup is pretty easy. Just:

// Start with a webdriver instance:
var sw = require('selenium-webdriver');
var driver = new sw.Builder()
  .withCapabilities(sw.Capabilities.chrome())
  .build()

// And then...
var chai = require('chai');
var chaiWebdriver = require('chai-webdriver');
chai.use(chaiWebdriver(driver));

// And you're good to go!
driver.get('http://github.com');
chai.expect('#site-container h1.heading').dom.to.not.contain.text("I'm a kitty!");

Contributing

so easy.

npm install           # download the necessary development dependencies
npm run-script build  # compile coffee-script into javascript
npm test              # build and run the specs

License

MIT.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].