Giter Site home page Giter Site logo

wesjones / waitfor Goto Github PK

View Code? Open in Web Editor NEW
6.0 6.0 4.0 214 KB

Angular Scenario Runner for Karma 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 People

Contributors

fidian avatar gudujarlson avatar mathieubigorne avatar wesjones avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

waitfor's Issues

Fails when using it with karma

I included the file-reference inside of my files-array, like this:

files: [
    'test/scenarios/angular-scenario-waitfor.js',
    'test/browser/**/*.js',
    'app/components/jquery/jquery.min.js'
],

Sadly I'm getting ReferenceError: Can't find variable: waitFor

The karma-configs differ from the testacular-configs, eg. you don't have the ANGULAR_SCENARIO inside of the files-array anymore.
Any clues how to get it work with Karma?

waitFor never returns

I am trying to use this with the e2e runner as included with the angular phonecat project. The issue is that once I call waitFor, it never returns or even times out. I'm not sure how to debug this. I have triple checked that the page being shown in e2e does contain this id. I've tried with and without a chained method like .click().

waitFor('#tag-detail', 'Tag Detail', 3);

Solution for url matching

Is there a solution to wait for a url to match a pattern, as in expect(browser().window().hash()).toBe('/transactions');?

Thanks

Element label default is equal to timeout

When the label parameter is not passed to waitFor(), how about using the selector for the element label instead of the timeout? It seems more descriptive to me and also follows the convention used by AngularJS's element()

diff --git a/angular-scenario-waitFor.js b/angular-scenario-waitFor.js
index cf8f170..04d94ab 100644
--- a/angular-scenario-waitFor.js
+++ b/angular-scenario-waitFor.js
@@ -141,7 +141,7 @@
                 self = this;
             if (isNaN(timeout)) {
                 timeout = 10;
-                label = label || timeout; // in case they forgot to pass the timeout. make it still work.
+                label = label || selector; // in case they forgot to pass the timeout. make it still work.
             }
             this.label = label;
             this.addFutureAction("wait for element '" + label + "'", function ($window, $document, done) {

Selectors on html, head, and body do not work

Selectors on html, head, and body do not work. Here is a fix:

*** angular-scenario-waitFor.js 2013-05-13 22:23:39.707066462 +0000
--- /home/gudu/homeconnections_ui/debug/angular-scenario-waitFor.js 2013-05-13 22:19:56.892857003 +0000
***************
*** 146,152 ****
              this.label = label;
              this.addFutureAction("wait for element '" + label + "'", function ($window, $document, done) {
                  var interval = $window.setInterval(function () {
!                     var length = $document.elements().find(selector).length;
                      if (length) {
                          $window.clearInterval(interval);
                          self.dsl.using(selector, label);
--- 146,152 ----
              this.label = label;
              this.addFutureAction("wait for element '" + label + "'", function ($window, $document, done) {
                  var interval = $window.setInterval(function () {
!                     var length = $document.find(selector).length;
                      if (length) {
                          $window.clearInterval(interval);

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.