ember testing Error Adapter operation failed

2020-08-04 10:32发布

问题:

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/vendor.js:66619:15)

TEST

test('test characters', function(assert) {
  server.create('character',{name: "Telly Tubby"});
  visit('/characters');
  fillIn('.search',"Telly Tubby");
  click('#search-btn');
  andThen(function() {  
    var results = find('.character-item');
    assert.equal(results.length,1);
  });
});

I dont remember doing anything fancy. I am not sure what is breaking.

yes my start-app.js helper is pretty standard

I went through the document and i feel it has something to do with Ember.Test.Adapter set to QunitAdapter by default.

import Ember from 'ember';
import Application from '../../app';
import config from '../../config/environment';
// import initializeTestHelpers from 'simple-auth-testing/test-helpers';
// initializeTestHelpers();

export default function startApp(attrs) {
  var application;

  var attributes = Ember.merge({}, config.APP);
  attributes = Ember.merge(attributes, attrs); // use defaults, but you can override;

  Ember.run(function() {
    application = Application.create(attributes);
    application.setupForTesting();
    application.injectTestHelpers();
  });

  return application;
}

Updates. It has something to do with click helper. when i comment it out I dont get error.

my .jshintrc has click exposed

 "predef": [
    "authenticateSession",
    "invalidateSession",
    "currentSession",
    "server",
    "document",
    "window",
    "location",
    "setTimeout",
    "$",
    "-Promise",
    "define",
    "console",
    "visit",
    "exists",
    "fillIn",
    "click",
    "keyEvent",
    "triggerEvent",
    "find",
    "findWithAssert",
    "wait",
    "DS",
    "andThen",
    "currentURL",
    "currentPath",
    "currentRouteName"
  ],