Git Product home page Git Product logo

spun's Introduction

spun NPM version Downloads Build Status Coveralls Status

Rapid Selenium Testing

spun is a command line tool that compiles spun files down to selenium code.

A spun file contains a very terse format for authoring Selenium tests. We've authored a DSL (Domain Specific Languge) that we feel handles most use cases. The language of spun looks like this:

get "https://google.com"
type "query" in "[name=q]"
click "a"
quit

Contents

## Why the name? A google search for `spun definition` resulted in this:

Webster:

  past or present of spin.

Not very cool.

Urban:

  1. A state of mind that exists because of using an amphetamine for a prolonged amount of time through repeated ingestion.
  2. To be under the influence of almost any stimulant, such as meth, straight speed...

  Usage: "Man I'm spun out on crack..."

Not very cool either.

A goole search for selenium definition resulted in this:

  the chemical element of atomic number 34, a gray crystalline nonmetal with semiconducting properties.

Hmm, a chemical element. Eureka! spun let's you get spun out on selenium!

Still not very cool ;)

## Options

Run spun -h for usage.

## How does it work?

spun relies on strategy providers to convert a spun file down to a languge. The output may be anything from node to java to ruby.

spun will search package.json for the first dependency prefixed with spun-. Because a strategy provider is likely to include spun-util, spun-util is ignored in this search.

spun also assumes that by default your language compiles down to node. By default spun will attempt to run the results using node. You an override this behavior using the options.

The default provider is spun-selenium-webdriver

##LICENSE

The MIT License (MIT)

Copyright (c) 2014 Joseph Spencer

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

spun's People

Contributors

jsdevel avatar bifodus avatar

Stargazers

 avatar Eugene Datsky avatar  avatar  avatar

Watchers

James Cloos avatar  avatar  avatar

Forkers

lenchan139

spun's Issues

Needs better error reporting

spun --verbose test.spun
[spun] No --browsers given, defaulting to chrome.
[spun] Using the default provider spun-selenium-webdriver
[spun] Attempting to load provider at /usr/lib/node_modules/spun/node_modules/spun-selenium-webdriver
[spun] FAILED: /home/eric/test.spun
[spun] Spec /home/eric/test.spun exited with code 8
[spun]

function(){console.log({"command":"get","file":"/home/eric/test.spun","inc
^
SyntaxError: Unexpected token (
at Object. (stdin-wrapper:6:22)
at Module._compile (module.js:456:26)
at evalScript (node.js:532:25)
at Socket. (node.js:154:11)
at Socket.EventEmitter.emit (events.js:117:20)
at _stream_readable.js:910:16
at process._tickCallback (node.js:415:13)

Provide an easier way for providers to access arguments.

Instead of looking at line.tokens, it would be really nice if the providers could access line.args. Ideally, and string value in line.args would not have double quotes.

get could have:

{
  command: "get",
  args: {
    query: "http://google.com"
  }
}

type could have:

{
  command: "type",
  args: {
    text: "foo",
    query: "#id"//optional
  }
}

Ideally the args property would be added to lines at the compile phase before interacting with the provider.

ValidationError

get "http://google.com"
type "spun authoring" in "[name=q]"
submit
find "#search li h3"
assert "spun" in text
quit

i am getting following response

[spun] No --browsers given, defaulting to chrome.
[spun] Using the default provider  spun-selenium-webdriver
[spun] Attempting to load provider at /usr/local/lib/node_modules/spun/node_modules/spun-selenium-webdriver
[spun] ValidationError: Expected a command but saw variable column 1 line 5
[spun] FINISHED!  0 passed 0 failed

Support assert

Here are some possibilities:

assert 5 in text
assert 5 or 6 in text or 7 or 8 in title
assert "foo" equals text
assert "boo" begins text
assert "zoo" ends text
assert "foo" or 5 equals text or "coo" and "foo" in text

Change the default provider?

webdriver-sync is kind of a pain in terms of compiling. And it requires windows users to install VisualStudio and python. I'm thinking it may be better if we create another provider that doesn't need compilation.

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.