ember testing Error Adapter operation failed

元气小坏坏 提交于 2020-01-13 07:06:49

问题


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"
  ],

来源:https://stackoverflow.com/questions/32670533/ember-testing-error-adapter-operation-failed

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!