Code Monkey home page Code Monkey logo

cabbie's Introduction

Cabbie

A synchronous and asynchronous webdriver client for node.js. This client is completely standalone so you can use your choice of test framework: jest, mocha, jasmine, tap.......you decide!

Build Status Dependency Status NPM version

Installation

To write async tests:

npm install cabbie-async

To write sync tests:

npm install cabbie-sync

Usage

To write async tests, see https://cabbiejs.org/async

To write sync tests, see https://cabbiejs.org

License

MIT

cabbie's People

Contributors

capaj avatar forbeslindesay avatar maxnachlinger avatar xotabu4 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

cabbie's Issues

Errors that should be special cased

Errors that should trigger entire test to re-run

Sauce Labs:

Invalid request (404):
ERROR The test with session id eea669797cfa493aa923ad4d574bfd79 has already finished, and can't receive further commands.
You can learn more at https://saucelabs.com/jobs/eea669797cfa493aa923ad4d574bfd79
For help, please check https://wiki.saucelabs.com/display/DOCS/Common+Error+Messages (while navigating to url)

SendKeys to password input.

If I understand correctly, the proper way to fill form is element.sendKeys().

However on password field I run into an issue.
Some kind of password autofill menu appears and keys get lost. (Ie only two of five characters are typed)

First using element.click() on the input mitigate the issue for me.

startChromedriver won't work

I keep on getting:

Error: connect ECONNREFUSED 127.0.0.1:9515
    at doRequestWith (/Users/joscha/Development/canva/web/node_modules/sync-request/index.js:87:11)
    at doRequest (/Users/joscha/Development/canva/web/node_modules/sync-request/index.js:20:10)
    at Connection.request (/Users/joscha/Development/canva/web/node_modules/cabbie-sync/lib/connection.js:154:52)
    at createSession (/Users/joscha/Development/canva/web/node_modules/cabbie-sync/lib/driver.js:385:24)
    at Driver (/Users/joscha/Development/canva/web/node_modules/cabbie-sync/lib/driver.js:201:20)
    at createCabbieDriver (/Users/joscha/Development/canva/web/node_modules/cabbie-sync/lib/index.js:221:29)
    at Object.<anonymous> (/Users/joscha/Development/canva/web/src/pages/editor/happy-path.js:9:16)
    at Module._compile (module.js:571:32)
    at loader (/Users/joscha/Development/canva/web/node_modules/babel-register/lib/node.js:144:5)
    at Object.require.extensions.(anonymous function) [as .js] (/Users/joscha/Development/canva/web/node_modules/babel-register/lib/node.js:154:7)

After googling, this is presumably a problem with the startChromedriver method.
It happens both with cabbie-sync and cabbie-async.

Cabbie and kommando

Just wanted to let you know that I've integrated cabbie into a project called kommando today (uxebu/kommando@ecf44a0) and cabbie makes writing / reading selenium tests much easier than any other (async) webdriver libraries I've used before. You can find the same selenium tests written with different webdriver libraries here.

kommando is meant to take over the tedious task to download / launch / configure the various webdriver servers that are out there and executing selenium tests against those servers with a test framework you prefer to use.

I see a lot of potential that both projects could benefit from each other and I currently have the following questions:

  • how much of the JSONWireProtocol is currently supported and what API support do you target initially?
  • which test-runner / assertion framework do you plan to use on top of cabbie? Would like to know that, so that I can rethink the current choice (mocha, jasmine, chai) within kommando.
  • would you be interested in bug reports in regards to the varying selenium server implementations? Found some small glitches when cabbie is used in conjuction with Ghostdriver. Seems the JSONWireProtocol spec is not 100% clear how the REST API should be written.
  • do you see potential using kommando (I hope the current documentation in the README is sufficient to get a highlevel picture) or do you miss an important feature? Maybe you have other use-cases in mind that I did not think about.

If you would like to play with cabbie within kommando you can use the following test:

// cabbie-kommando-example.js
var assert = require('assert');

module.exports = function(callback) {
  var browser = kommando.browser;

  browser.navigateTo('https://github.com');
  assert.equal(
    browser.getElement('.heading').text(),
    'Build software better, together.'
  );

  console.log('Found heading');

  callback();
};

and execute that test using kommando (installable via npm install kommando):

# execute test against phantomjs
kommando --client cabbie --runner plain cabbie-kommando-example.js
# execute test against chrome, firefox and phantomjs
kommando --browser chrome --browser firefox --browser phantomjs \
--client cabbie --runner plain cabbie-kommando-example.js
# execute test against chrome using chromedriver
kommando --browser chrome --driver chromedriver --client cabbie \
--runner plain cabbie-kommando-example.js

getting an error

My code is -

var assert = require('C:/slimerTest/node_modules/assert');
var {startChromedriver} = require('C:/slimerTest/node_modules/cabbie-sync');
var cabbie = require ('C:/slimerTest/node_modules/cabbie');

// Start the chromedriver server, this provides a local selenium server
// You must install chromedriver to use this.
startChromedriver();

// connect to chromedriver, adding {debug: true} makes cabbie log each method call.
const driver = cabbie('chromedriver', {debug: true});

try {
  // navigate to a url in the currently active window
  driver.activeWindow.navigateTo('http://example.com');

  // get an element, and check that its text equals some expected value
  assert.equal(
    driver.activeWindow.getElement('h1').getText(),
    'Example Domain',
  );
} finally {
  // whether tests pass or fail, dispose of the driver
  //driver.dispose();
}

But im getting an error when i run through node command
const driver = cabbie('chromedriver', {debug: true});
^

TypeError: cabbie is not a function

why is this?

Release

You wanted to spent some time to look through the code before releasing it. Any updates on that? Here at Yahoo, we are in the process of releasing some projects that have a dependency on the unreleased code, and we are currently using the git repository directly.
Please let me know what the plan is.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.