Every repository with this icon (
Every repository with this icon (
| Fork of jgehtland/javascript_testing | |
| Description: | Framework for JavaScript Testing (currently a Rails Plugin) edit |
-
considering using rsim's fork which added this functionality:
Comments
-
rake js:shell won't work without lib/env.rhino.js
1 comment Created 2 months ago by aiwilliamsIt 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:1Comments
-
Use of $ in test_runner.js a problem when using jQuery.noConfict()
2 comments Created 2 months ago by aiwilliamsSee http://github.com/relevance/blue-ridge/blob/master/lib/test_runner.js#L39
That $.trim works better as window.jQuery.trim when I'm using prototype.js. Once I do, I get a different problem:
"test_runner.js", line 39: uncaught JavaScript runtime exception: TypeError: Cannot find function children in object Element #182 LI.
Comments
aiwilliams
Tue Oct 06 13:37:10 -0700 2009
| link
As you likely know almost immediately, until all '$' references in that file are replaced with window.jQuery (or whatever), the runner does not work too with with prototype.js.
-
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.Comments
saberma, this would be an issue in env.js. I recommend posting this on their Lighthouse ticket-tracking page: http://envjs.lighthouseapp.com/projects/21590-envjs/overview
Since this isn't strictly a Blue Ridge issue, I'm marking this as closed. (Thanks for the feedback, though!)
-
3 comments Created 4 months ago by pelargirCan't find hasClassName when loading lowpro and prototype togetherenv.jsxLoading 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 <a href="/relevance/blue-ridge/issues/#issue/1" class="internal">#1</a> 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"); }}); }});Comments
@pelargir: Is this failing only from the command-line? Does it work okay when ran via the browser?
Yes, it passes in Firefox. (In Safari, the page loads but nothing happens, no output is printed, and no JS errors occur.) Still failing on the command line and in TextMate.
@pelargir: This feels like an env.js issue. I just updated Blue Ridge to use the latest env.js (1.0rc7), so it might be fixed. If it doesn't, we should bring this up on the env.js Lighthouse: http://envjs.lighthouseapp.com/projects/21590-envjs/overview
-
Cannot call method appendChild of null - jQuery 1.3.2 error
1 comment Created 4 months ago by drogushere 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:54Comments
-
Nested describes are currently output out of order.
With my changes in tristandunn@191e585
FAILED: when the element is an imgwhen given an elementPrint - prints out the img src attributebecomes
FAILED: Print when given an element when the element is an img prints out the img src attributeComments
-
6 comments Created 4 months ago by bartazfeaturexMake it work with ZenTest autotestsuggestionxBlue-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?Comments
jasonrudolph
Sun Jul 26 06:57:17 -0700 2009
| link
We don't have any immediate plans to add this feature, but I agree that this type of functionality would be nice to have.
If/when we do add this kind of functionality, it's more likely that we'll add support for beholder. We'd welcome a patch that provides ZenTest autotest support, but we use beholder, so it's unlikely that we'd build ZenTest autotest support for ourselves.
You could try using rstakeout to trigger "rake test:js TEST=..." if any files change
@jasonrudolph - what is your setup for beholder? Perhaps put this in a wiki page?
jasonrudolph
Mon Jul 27 15:59:54 -0700 2009
| link
@drnic - We don't use beholder for Blue Ridge yet. If/when we do use beholder with Blue Ridge, we'll be sure to add some docs so that others can do the same.
@drnic - Thanks for a tip, I tried rstakeout and it works like a charm! I even got it giving me nice notifications when tests fail or pass.
-
7 comments Created 5 months ago by drnicpatch: automatically create fixutres from templatessuggestionxNOTE: 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.
Comments
Added a css() helper to insert css tags into fixtures, like the require() helper inserts
http://github.com/drnic/blue-ridge/commit/e085508f296cf5d55473e769a0ef34a20550b5f8
The subsequent commit adds css() stub method to test_runner
dan-manges
Mon Jul 20 07:25:42 -0700 2009
| link
I'm doing something similar to generate fixtures but with one additional step - I'm also extracting the javascript from the HTML to generate the javascript file that is included in the spec. Doing this removed duplication that I originally had between the javascript specs and the javascript that was on the HTML page. Code: https://gist.github.com/87926f378ef0c6a72b71
(my smart-arse comment assumed you were pulling inline >script> tags; I noticed you're also pulling >script src=''> tags)
Is it better/different to explicitly require those script assets etc from the top of the xxx_spec.js file?
dan-manges
Mon Aug 03 21:55:24 -0700 2009
| link
I don't think it makes much of a difference. I like extracting the Javascript because it removes the duplication. Rather than the spec being responsible for knowing which JS files the page needs, the page has that responsibility, and the spec reads it from the page.
But it's common to combine multiple JS files into one, so the re-declaration of JS dependencies should usually be minimal.
This is definitely a direction I want to follow, but I'm a little concerned about requiring Rspec. My goal for the next few months is to allow "plugins" to BlueRidge for letting folks better integrate with Rspec, Cucumber, and even Selenium, without affecting BlueRidge's core functionality. I'm marking this ticket as closed, but will follow up when we get the plugin architecture ready.
-
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.
Comments
-
Can we push out a new gem to include the jquery 1.3.2 headless patch etc?
Comments
Nic, at this point Blue Ridge is only a Rails plugin. Making it a gem is a goal, however. For now you can just install the plugin from GitHub to get the jQuery 1.3.2 support.
-
1 comment Created 6 months ago by karnowskirhinoxSpec files with syntax errors do not fail command-line buildswontfixxIf 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.
Comments
-
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
Comments
I too am not seeing the $.print function in either command-line or in-browser tests. It's missing when using Firebug's console too. jQuery's internals are clearly using it, though, and Firebug shows the jquery.print.js is clearly loaded. Not sure what's going on.
This may be related to issue #5 where JavaScript libraries seem to be loaded twice.
-
4 comments Created 6 months ago by aiwilliamsenv.jsxPrototype.js Element#down doesn't workfixxWith 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 <a href="/relevance/blue-ridge/issues/#issue/22" class="internal">#22</a> DIV => available.Comments
env.js is having problems with Prototype. I'll open this as a ticket in their Lighthouse.
I opened the following env.js Lighthouse ticket to track this problem:
http://envjs.lighthouseapp.com/projects/21590-envjs/tickets/69-prototypes-down-method-is-unavailableAdam, env.js has been updated and greatly improved. Could you please retest this and reopen if it's still an issue? Thanks!
aiwilliams
Fri Aug 28 08:51:52 -0700 2009
| link
Sure will! Thanks for the heads up.
-
3 comments Created 6 months ago by aiwilliamsMultiple copies of js files included by browserfixxIt seems that, out of the box, two copies of the js files are being loaded into the browser.
http://img.skitch.com/20090521-d7hp4seqseft9wubugf67g5wqf.jpg
Comments
Adam, thanks for pointing this out. Looks like we need to cleanup our imports.
This seems to be only a Firebug issue. I've viewed the source and the "generated source" using the web developer Firefox plugin, and there is definitely only one version of each file being loaded. Moreover, we're not seeing any of the negative behavior we've seen in the past from loading multiple copies of the files.
I think it's this old Firebug bug come back to haunt us: http://code.google.com/p/fbug/issues/detail?id=440 Basically, since we're using relative paths, Firebug gets confused.
I'm closing this issue until some negative behavior associated with multiple file loads is experienced.
-
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.
Comments
I think screw-unit-server does something similar to this. I'd be interested in seeing the code, maybe making it optional Blue Ridge plugin that could be turned on/off via configuration. To be honest, however, I'm more interested in making env.js better rather.
-
3 comments Created 7 months ago by superchrisenv.jsxClicking radio buttons does not seem to workfixxI 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.
Comments
That sounds like a problem in env.js. We'll see if we can get it fixed.
-
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?
Comments
-
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.
Comments
Britt, the last version of env.js I updated to last week explicitly fixed this bug. I've tested before and after saw the following work:
describe("training wheels", function(){ it("handles select boxes properly", function(){ expect($("#some-select").val()).to(equal, "2"); expect($("#some-select :selected").val()).to(equal, "2"); expect($("#some-select :selected").text()).to(equal, "Two"); }); });against the following HTML fixture:
<select id="some-select"> <option value="1">One</option> <option value="2" selected="selected">Two</option> <option value="3">Three</option> </select>
- env.js▾
- feature▾
- fix▾
- google chrome▾
- rhino▾
- safari▾
- screw.unit▾
- smoke▾
- suggestion▾
- wontfix▾
- Apply to Selection
-
Change Color…
Preview:preview
- Rename…
- Delete












Thanks for the feedback. Note that I've talked with rsim and suggested he submit his patch to Screw.Unit and/or Smoke. Note that Blue Ridge vendors those toolkits as components, but we don't take patches directly to those component. Thanks!