Giter Site home page Giter Site logo

mathieubigorne / waitfor Goto Github PK

View Code? Open in Web Editor NEW

This project forked from wesjones/waitfor

0.0 2.0 0.0 105 KB

Angular Scenario Runner for Testacular Additional API WaitFor. This makes it so you don't have to use element which grabs items that are not yet available. WaitFor will wait a specified amont of time while searching for them making the test execution faster because you don't need to use sleeps.

JavaScript 100.00%

waitfor's Introduction

WaitFor

WaitFor is a an additional API for Testacular's Angular Scenario Runner.

Why do we need this additional API.

When using Testacular's Angular Scenario Runner I constantly ran into this scenario.

it("Should click on the button", function() {
	sleep(1);
	element('.myButton', 'Click My Button').click();
});

The reason I kept running into this scenario would be transitions, or waiting for services to load, or any number of other reasons that the element was not ready yet.

So wouldn't it be nice if you could do this.

it("Should click on the button", function() {
	waitFor('.myButton', 'Click My Button').click();
});

Then as soon as the button is available which it could be in 0.1 seconds instead of 1 second and the waitFor would exectute as soon as it is ready. This process completely replaces the "element" api so that you can use waitFor.

Features

Completely replace element api so we don't have to use sleep any more.

Have the optional 3rd parameter that we can pass that will tell it how long to wait (defaut is 10 seconds) before it times out.

it("Should click on the button", function() {
	waitFor('.myButton', 'Click My Button', 60).click(); // make it wait 60 seconds before timing out because our services are VERY slow.
});

Have the option of some addional features like focus, blur, etc... and be able to chain them. You can chain on functions that don't return a value.

it("Should click on the button", function() {
	waitFor('.myInput', 'My Name Input').focus().val("Wes");
	waitFor('.myInput', 'My Name Input to blur').blur();
});

How to use it.

In order to use this you just need to include this file in your testacular.config.js file just after you angular scenario runner.

// list of files / patterns to load in the browser
files = [
    ANGULAR_SCENARIO,
    ANGULAR_SCENARIO_ADAPTER,
    'tests/shared/angular-scenario-waitFor.js',
    'tests/shared/e2eSetup.js'
];

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.