GithubHelp home page GithubHelp logo

stories's Introduction

Stories

Simple and easy way how to write WebDriver tests - with Stories!

The motion behind this project is to simplify writing of WebDriver tests. WebDriver itself is useful tool but most of the time it requires a lot of writing to perform simple operations.

Tests are most of the time supplied in a form of a user story (sentence). This tools allows to rewrite the story into a test with necessity knowing only the selector of the element.

Example

A simple user story:

User John Doe enters administration site, logs in and publishes new article.

would be transformed as follows:

new Story(webdriver, "http://www.example.com/admin")
    .perform(new LoginAction("jdoe", "password")
    .ready()
    .click(By.xpath("a[text()='Create article']"))
    .ready()
    .perform(new CreateArticleAction())
    .ready()
    .verify(new Story.Verification() {
        public void verify(WebDriver driver) {
            // perform verification that article was created succesfully
        }
    });

Most of the UI tests come down to filling forms. Stories offer simple way not only to handle and submit them, but also to extend them to your own implementation.

To create new form you will need a WebDriver instance and selector for the form.

Form form = new Form(driver, By.xpath("form[@id='login']"));

To operate basic elements you will need name of the field and perform appropriate action on the form instance.

form.type(fieldname, text);

form.check(fieldname); // single checkbox form.uncheck(fieldname); // single checkbox

form.check(fieldname, value); // group of checkboxes or radio buttons form.uncheck(fieldname, value); // group of checkboxes

form.select(fieldname, option);

form.click(By); // to test label connections to right fields or to click on form button

form.submit(); // submit by using first submit button available form.submit(name); // submit by submit button name;

form.reset(); // reset form using form reset button if available otherwise throws exception

form.field(By, Class<? extends AbstractField>); // retrieve special implementation of the form field

stories's People

Contributors

hrax avatar

Watchers

James Cloos avatar  avatar

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.