qunit

Qunit test alternates between pass and fail on page refresh

点点圈 提交于 2019-12-05 03:12:30
I have a two tests that are causing side effects with each other. I understand why as I am replacing a jQuery built-in function that is being called internally in the second test. However what I don't understand is why the test alternately passes and fails. This question is similar However, I am not doing anything directly on the qunit-fixture div. Here are my tests test('always passing test', function() { // Always passes var panelId = '#PanelMyTab'; var event = {}; var ui = { tab: { name: 'MyTab', }, panel: panelId, }; $('<div id="' + panelId + '">') .append('<a href="#" class="export">Test<

Trying to set up Grunt to automate some testing, testing works fine in the browser but not at the command line

喜夏-厌秋 提交于 2019-12-05 00:35:53
问题 I'm currently trying to incorporate GruntJS with a few plugins (PhantomJS Qunit and Connect plugins). However, setting up a simple test is throwing me errors and I can't find the solution despite a few days of searching. I'm using a local web server (MAMP) and the website is running on a CMS. Running the tests by accessing the test template in a browser works fine, but when trying to access the same tools via the command line using sudo grunt test PhantomJS return an odd error: Running "qunit

Waiting in QUnit tests

為{幸葍}努か 提交于 2019-12-04 23:14:54
I have jQuery code that when I click on a link it first hides and then removes some HTML, like so: $(this).parent().parent().hide('slow', function () { $(this).remove(); }); I want to make a QUnit test that makes sure that the HTML in question was deleted: $(thelink).click(); // Check that it is gone, by finding the first item in the list entity = input.form.find('.recurrenceinput_occurrences .occurrence span.action a')[0]; // And make sure it's NOT the deleted one: ok(entity.attributes.date.value !== "20110413T000000"); The problem is of course that the ok() test is run before the hide

ember testing Error Adapter operation failed

懵懂的女人 提交于 2019-12-04 21:38:46
My test is pretty simple. It was working before but now I have facing a new issue I am getting failure message Adapter operation failed at http://localhost:4200/assets/test-support.js:4578:13 at exports.default._emberTestingAdaptersAdapter.default.extend.exception ( http://localhost:4200/assets/vendor.js:52460:34 ) at onerrorDefault ( http://localhost:4200/assets/vendor.js:43162:24 ) at Object.exports.default.trigger ( http://localhost:4200/assets/vendor.js:67346:11 ) at Promise._onerror ( http://localhost:4200/assets/vendor.js:68312:22 ) at publishRejection ( http://localhost:4200/assets

How to add project and create jobs in TestSwarm

烂漫一生 提交于 2019-12-04 16:48:42
I am trying setting up TestSwarm, but not able to create project and jobs. When cloning TestSwarm from github some files are missing like /run etc. Please suggest your thoughts! You create a project using php scripts/manageProject.php --create=true --id="yourtestid" --display-title="your display title here" This script creates a project and requires an id and a display title, and also has optional options for site-url and password. The create flag tells the script to create the project if it doesn't already exist. The script will return an auth token (which can be re-created with scripts

How can we execute Unit Tests against DOM manipulation?

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-04 16:34:59
问题 The introduction to QUnit over at netTuts.com spawns an interesting exchange (never resolved) over how to apply unit tests against actions that manipulate the DOM. The following quote (Alex York) gets to the crux: What would be nice is that if you had a function like this: function add(a, b) { var result = a + b; $(“input#ResultTestBox”).val(result); In the above test, I would love to test two things: the addition of a and b, and the result correctly being put into a DOM element. I would love

Ember - Return a promise from beforeModel not working with Qunit

孤者浪人 提交于 2019-12-04 10:43:47
In my ApplicationRoute I implement a beforeModel hook that does a server call to see if a valid session exists. If it does, then the app navigates to the 'dashboard' route, otherwise it goes to the 'login' route. I am trying to implement some tests and I can't seem to get it to work with QUnit. I keep getting: Assertion failed: You have turned on testing mode, which disabled the run-loop's autorun. You will need to wrap any code with asynchronous side-effects in an Ember.run Here is a plunker http://plnkr.co/edit/e0Q4qz?p=preview I have simulated a server call by creating a doLater method that

QUnit with Ajax, QUnit passes the failing tests

假如想象 提交于 2019-12-04 09:10:51
问题 I am looking into QUnit for JavaScript unit testing. I am in a strange situation where I am checking against the value returned from the Ajax call. For the following test I am purposely trying to fail it. // test to check if the persons are returned! test("getPersons", function() { getPersons(function(response) { // persons = $.evalJSON(response.d); equals("boo", "Foo", "The name is valid"); }); }); But it ends up passing all the time. Here is the getPersons method that make the Ajax call.

QUnit, assert not OK?

懵懂的女人 提交于 2019-12-04 04:30:41
问题 Sorry if this is obvious, but is there a notOK or equivalent function in QUnit, if we want to assert that a method returns false? I can't see a way to negate OK in the documentation. I tried: !ok... but that didn't work. 回答1: You could use: ok(!method_expected_to_be_false) 回答2: According to the documentation : The most basic assertion in QUnit, ok() requires just one argument. If the argument evaluates to true, the assertion passes; otherwise, it fails. You can verify that a method return a

Getting QUnit to run tests in order

北城以北 提交于 2019-12-04 04:09:20
I've used qunit to write a series of tests for javascript code I have. Right now for some reason, the first test in my list will run, and then the LAST test in the list runs, followed by the 2nd to last, 3rd to last, 4th to last, etc... It's crucial for my tests that things run in the order that I have them in. I tried turning off that option where qunit runs tests that failed last time first, but it's still doing this. Is there any way to fix this? First, figure out why your tests MUST run in a specific order. The whole point of unit testing is that the tests are atomic and it should be