Giter VIP home page Giter VIP logo

blue-ridge's People

Contributors

coreyhaines avatar gdagley avatar jasonrudolph avatar karnowski avatar mrowe avatar rsanheim avatar rsim 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  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  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

blue-ridge's Issues

Clicking radio buttons does not seem to work

I have a ScrewUnit test which interacts with a radio button and passes in browser but fails in blueridge. It appears that clicking a radio button does not yet work in env.js. I'm using jQuery("input.radio").click() to click it, if that matters.

Tests do not run in super-fast JavaScript engines (Safari 4 & Chrome)

Chad Humphries and I spent a day trying to track this down, and we haven't found it yet, but it looks like the timing of Screw.Unit, jQuery, and the BlueRidge requires are in such an order that Safari never fires the jQuery ready function. So your Screw.Unit specs never run. (Actually, it might be firing the ready function, just before BlueRidge and Screw.Unit are ready for it.)

Still more work to do, any ideas welcome.

Prototype.js Element#down doesn't work

With a simple html fixture, and a test like this:

it("has a problem with prototype?", function(){
  $('available').down('label').down('a');
  expect($('available').down('label')).to_not(be_undefined);
});

all is well when run in FF3. When running 'rake spec:javascripts':

Running people_chooser_spec.js with fixture 'fixtures/people_chooser.html'...

FAILED: PeopleChooser - has a problem with prototype?
          TypeError: Cannot find function down in object Element #22 DIV => available.

"Calling eval()" warning mesages

Per Britt Crawford:

I see these warnings before every test:
js: warning: "../..//vendor/plugins/blue-ridge/lib/screw.builder.js#5(Function)", line 17: Calling eval() with anything other than a primitive string value will simply return the value. Is this what you intended?

Recommendation for browser testing

Do you store your dev apps on a network and access the fixtures directly from the network or do you configure web sharing to view files via ip address?

Any suggestions would be much appreciated.

In browser runner

Since I'm experiencing tests that fail in blueridge using rhino but pass in browser, I'm working on adding an in browser test runner using selenium rc. The plan is to make running it as running it headless, eg. a rake task which starts selenium rc, runs test, shuts down selenium rc. Is there any interest in this, or is this already being done by someone else? I'll fork and check it in once I get it working.

Cannot call method appendChild of null - jQuery 1.3.2 error

here is backtrace:

 ERROR: [Mon Jul 27 2009 10:39:50 GMT+0200 (CEST)] {ENVJS} Fatal Error: Element: must be nested correctly
Line: 9
Column: 8
 Line: (line ?)
 ERROR: [Mon Jul 27 2009 10:39:50 GMT+0200 (CEST)] {ENVJS}
 ERROR: [Mon Jul 27 2009 10:39:50 GMT+0200 (CEST)] {ENVJS} [object Object] Line: (line ?)
 ERROR: [Mon Jul 27 2009 10:39:50 GMT+0200 (CEST)] {ENVJS}
Running location_spec.js with fixture 'fixtures/location.html'...
js: "/home/drogus/projekty/gastronauci/vendor/plugins/blue-ridge/lib/jquery-1.3.2.js", line 3204: uncaught JavaScript runtime exception: TypeError: Cannot call method "appendChild" of null
        at /home/drogus/projekty/gastronauci/vendor/plugins/blue-ridge/lib/jquery-1.3.2.js:3204
        at /home/drogus/projekty/gastronauci/vendor/plugins/blue-ridge/lib/jquery-1.3.2.js:3032
        at /home/drogus/projekty/gastronauci/vendor/plugins/blue-ridge/lib/jquery-1.3.2.js:691
        at /home/drogus/projekty/gastronauci/vendor/plugins/blue-ridge/lib/jquery-1.3.2.js:3031
        at /home/drogus/projekty/gastronauci/vendor/plugins/blue-ridge/lib/jquery-1.3.2.js:2693
        at /home/drogus/projekty/gastronauci/vendor/plugins/blue-ridge/lib/jquery-1.3.2.js:2467
        at /home/drogus/projekty/gastronauci/vendor/plugins/blue-ridge/lib/jquery-1.3.2.js:2641
        at /home/drogus/projekty/gastronauci/vendor/plugins/blue-ridge/lib/jquery-1.3.2.js:2919
        at /home/drogus/projekty/gastronauci/vendor/plugins/blue-ridge/lib/jquery-1.3.2.js:691
        at /home/drogus/projekty/gastronauci/vendor/plugins/blue-ridge/lib/jquery-1.3.2.js:155
        at /home/drogus/projekty/gastronauci/vendor/plugins/blue-ridge/lib/jquery-1.3.2.js:2918
        at /home/drogus/projekty/gastronauci/vendor/plugins/blue-ridge/lib/test_runner.js:54

Decouple blue-ridge from Rails

Latey I've been doing a lot of homework evaluating alternatives to blue-ridge because like many shops javascript and other like "assets" often reside outside of a singular Rails stack. At this point I think it is fairly common to have multiple frameworks, languages, etc under one roof.

Anyway, I stumbled across JSpec and really appreciated how they made it a gem thereby making it application framework agnostic (of course if you want it to be, there is a Rails option).

Has there been any consideration to decoupling blue-ridge from Rails? I thought I'd ask before I go and fork something and do a one-off. I think the benefits outweigh the cons, just to think of a couple
It could shield the project from Rails core changes and direct dependencies
Lead to wider adoption if it wasn't Rails specific

Thoughts?

Problems with jQuery "val()" function

Per Britt Crawford:

I'm having some problems getting the val function to work properly with select boxes. val() always seems to return null and val('value') properly sets the selected option but val() still returns null. It looks like the selectedIndex is not updated. I don't know whether this has to do with Blue Ridge or env.js or what.

Correctly output nested describes.

Nested describes are currently output out of order.

With my changes in tristandunn@191e585901b5303a99035ba17653c3f2c4eb55d1

FAILED: when the element is an imgwhen given an elementPrint - prints out the img src attribute

becomes

FAILED: Print when given an element when the element is an img prints out the img src attribute

Make it work with ZenTest autotest

Blue-Ridge does a great job with testing JavaScript (even from command line) but it would be awesome if it would work with ZenTest's autotest, so the tests will automatically re-run when .js files will be edited.
Is it possible?

Blue-Ridge spawns a new JVM for each test file

It would be nice if it could run in a single instance of the JVM since startup time is a big issue.
gleneivey has a branch that did this but it seems his latest merge from relevance/blue-ridge broke that behavior.
Thanks!

rake js:shell won't work without lib/env.rhino.js

It seems this file is missing in the repository. Is the documentation simply out of date? I get this when I run the rake task:

js: "/vendor/plugins/blue-ridge/lib/shell.js", line 14: Couldn't read source file "/vendor/plugins/blue-ridge/lib/env.rhino.js: /vendor/plugins/blue-ridge/lib/env.rhino.js (No such file or directory)".
 - loaded env.js
js: "/vendor/plugins/blue-ridge/lib/shell.js", line 17: uncaught JavaScript runtime exception: ReferenceError: "window" is not defined.
    at /vendor/plugins/blue-ridge/lib/shell.js:17
    at /vendor/plugins/blue-ridge/lib/shell.js:1

jQuery.ready is not called

I have a script with a code like this:

$.ready(function() {
...
})

After I updated Blue Ridge, the code is not called anymore and some tests that verify an initial behaviour began to fail.

To make them pass again I had to do something like this:

require("...", {'onload': jQuery.ready})

Stubbing global method (setTimeout) seems to stop test execution.

If I place the following override in a before call:
before(function(){
setTimeout = function () {print('setTimeout stub');};
});

Then, the following tests do not execute as I would expect. The first following test runs, but then all the rest of the tests do not run.

  it("should...", function(){
    print('start test1');
  });

  it("should...", function(){
    print('start test2');
  });

  it("should...", function(){
    print('start test3');
  });

My test output looks like this:
.......start test1
.setTimeout stub

As you can see, test2 and test3 are never executed. Am I don't something wrong here?

Thanks!

jQuery effects hang tests running under rhino

A test which includes multiple jQuery effects calls will cause rhino to hang after executing that test. The test may run and report that it completed successfully but since that rhino instance does not terminate the rest of the test suite will not execute.

For example:
Screw.Unit(function() {
describe("should not hang when applying multiple fade effects", function() {
it("should fade multiple elements", function() {
$("#element1").fadeTo('slow', 0);
$("#element2").fadeTo('slow', 1);
});
});
});

Starting to cover blue-ridge with cucumber integration tests

I've started writing integration tests for the rake tasks. Specifically there are scenarios for running 'rake test:javascripts' on: a rails project, a non-rails project, and on blue-ridge itself. With integration tests this will allow us to explore alternate compositions of technology (say trialling htmltest instead of env.js + rhino, or switching out screw.unit for jspec or whatever), but make sure that the core generators and headless test rake tasks keep working.

This work is in a "features" branch (http://github.com/drnic/blue-ridge/tree/features) though this branch also includes all my other commits and merged commits from other people's branches.

If you want the cucumber specific changes only, let me know, else hopefully you can pull in all the changes (some which solve other issues such as #14)

loadInlineScript disabled?

Specs running on the command line under env.js don't execute inline <script></script> tags in the fixture body. Even if this is supposed to be the default behavior, there should be a way to re-enable inline script loading without modifying test_runner.js. We monkey-patched to fix this issue just by commenting out line 57 in test_runner.js ("loadInlineScript: function(){},").

Looks like there was a recent commit that changed the way test_runner is loading fixtures ( http://github.com/relevance/blue-ridge/commit/7617cd85fb71e5cfe0e6e54d9d8f5281e31079ea ). Just wondering what the rationale behind that particular change was...

Using Spidermonkey?

I've started using this recently, but I have a very long build cycle on my CI server (Hudson) -- mostly due to using RJB and metric_fu -- so I am always looking to speed up any parts of the process. For my javascript, I use jslint with spidermonkey and have seen excellent performance improvements. Has anyone tried to use spidermonkey rather than rhino with this, and, if so, any tips on how you did it?

patch: automatically create fixutres from templates

NOTE: For details see commit message in link below

I've ported a gist (http://gist.github.com/148947) from Jonas Nicklas into the blue_ridge + javascript_spec generators.

http://github.com/drnic/blue-ridge/commit/0d425952e40fec35b48e6d2a29c00f92c95b2247 (subsequent commit has patch to README for contributors)

If you're using rspec + pass a relative path to a rails template (e.g. accounts/new.html.rb) then the fixture file will be automatically rendered from the template.

Just run "spec spec/javascripts/accounts_new_spec.rb" (after setting up what data you want for the template).

It's only available for rspec since it uses rspec's view render mechanism.

Does blue-ridge support cookie test?

I use jquery.cookies to do something, when I test it in blue-ridge, it throws this exception:
FAILED: History should empty
TypeError: Cannot call method "get" of undefined

...

soon, I found "document.cookie" return "undefined" in blue-ridge test.

example like this:

require("spec_helper.js");
require("../../public/javascripts/application.js");

Screw.Unit(function() {
  describe("Your application javascript", function() {
    it("does something", function() {
      expect(document.cookie).to(equal, "some cookie");
    });
  });
});

any help?
thanks.

Upgrading blue-ridge removes Array#reduce on command-line

Strange.

After upgrading blue-ridge, suddenly my tests are reporting
Cannot find function reduce in object

FAILED: #set_percentages No units entered sets percentages to 0
TypeError: Cannot find function reduce in object 0,0,0,0.

This happens when running the rake task or trying to use Array#reduce in the js shell. I'm working on stripping as much as I can out of the loading of the shell to narrow it down.

Anyone seen this?

reloading fixture for each spec

Would it be possible to reload the HTML fixture before each spec? I'm having problems because one spec will modify the dom, affecting the state for all other specs.

Can't find hasClassName when loading lowpro and prototype together

Loading lowpro.js and prototype.js alongside each other gives this error when running the default spec file:

FAILED: Your application javascript - accesses the DOM from fixtures/application.html
TypeError: Cannot find function hasClassName in object Element #1 HTML.

This is how I have them chained:

require("../../public/javascripts/prototype.js", {onload: function()   
    require("../../public/javascripts/lowpro.js", {onload: function() {
        require("../../public/javascripts/application.js");
    }});
}});

Spec files with syntax errors do not fail command-line builds

If a spec file has a failing test, it'll fail when ran from the command-line. But if it has an in-your-face flat-out wrong JavaScript syntax error, Rhino spits out an error to stderr but does not report a failure. The overall build reports success.

The problem here is that Rhino's "load()" function swallows JavaScript exceptions due to syntax errors. We'll have to patch Rhino or more likely write a different Java load function that correctly reports errors.

Rails 3

Update install instructions for Rails 3

Feaure: Cloning the DOM to ensure transactions

I just watched Dr. Nics talk on Blue Ridge. He said what was missing was a way to clone the DOM before each test. Couldn't you just use the Javascript DOM method: Node.cloneNode(true) to clone the node and all its children?

$.print unavailable/incorrect

The $.print function is alternately unavailable / underpowered. If you just add a call to $.print in the middle of a test, it fails (even though the jquery.print.js appears to have been included.)

If you call $.print from within a screw.matcher, it prints but not the value you would expect. For an array of ints I am seeing [{}] instead of [1,2,3]. This might be cause by smoke.core incorrectly trying to autodetect $.print availability

Matchers are too loose

in javascript: 0, 0.0, null, undefined, '', ' ', etc. all evaluate to false when cast to a boolean, and almost everything else evaluates to true. the be_true and be_false method should not just check actual and !actual, but (actual === true) and (actual === false).

A similar issue is present with be_null, be_undefined and equal, (false == 0, false !== 0, null == undefined, but null !== undefined).

New gem version?

Can we push out a new gem to include the jquery 1.3.2 headless patch etc?

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.