Ember Hello Word-http:// localhost:4200 / tests中的测试错误,但在命令行中没有

杰德西尔维奥

我正在按照本教程尝试构建一个hello world Ember.js应用程序...我已经到达测试关于页面的链接的那一部分。

我的设置是:

QUnit 1.18.0; Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.157 Safari/537.36
Ember version: 1.13.8
node: 0.12.7
npm: 2.13.4
os: darwin x64

我的router.js是:

import Ember from 'ember';
import config from './config/environment';

var Router = Ember.Router.extend({
  location: config.locationType
});

Router.map(function() {
  this.route('about');
});

export default Router;

我的application.hbs是:

<h2 id="title">Welcome to Boston Ember</h2>

{{link-to 'About' 'about'}}

{{outlet}}

我的about.hbs是:

<h3>About</h3>

<p>Boston Ember is the monthly meetup where awesome people get together

做很棒的Ember相关事情!

我的about-page-test.js是:

import Ember from 'ember';
import startApp from 'bostonember/tests/helpers/start-app';

var App;

module('Integration - About Page', {
  beforeEach: function() {
    App = startApp();
  },
  afterEach: function() {
    Ember.run(App, 'destroy');
  }
});

test('Should navigate to the About page', function() {
  visit('/').then(function(assert) {
    click("a:contains('About')").then(function(assert) {
      assert.equal(find('h3').text(), 'About');
    });
  });
});

该页面将正常运行,并且命令行不会返回任何错误:

file changed templates/application.hbs

Build successful - 691ms.

但是当我去的时候,http://localhost:4200/tests我看到了很多错误...

Integration - About Page: Should navigate to the About page (1, 0, 1)Rerun210 ms
TypeError: Cannot read property 'equal' of undefined@ 190 ms
Expected:   true
Result:     false
Diff:   trufalse
Source:     
    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)

JSHint - integration: integration/about-page-test.js should pass jshint (1, 0, 1)Rerun1 ms
integration/about-page-test.js should pass jshint.
integration/about-page-test.js: line 6, col 1, 'module' is not defined.
integration/about-page-test.js: line 15, col 1, 'test' is not defined.
integration/about-page-test.js: line 16, col 28, 'assert' is defined but never used.

3 errors@ 0 ms
Expected:   true
Result:     false
Diff:   trufalse
Source:     
    at Object.<anonymous> (http://localhost:4200/assets/bostonember.js:337:12)
    at Object.Test.run (http://localhost:4200/assets/test-support.js:3566:28)
    at http://localhost:4200/assets/test-support.js:3695:11
    at process (http://localhost:4200/assets/test-support.js:3254:24)
    at begin (http://localhost:4200/assets/test-support.js:3299:2)
    at http://localhost:4200/assets/test-support.js:3315:4

我尝试使用一些不同的变体,this.route('about');尽管我认为这很好,因为该功能有效。我还在测试中尝试了一些不同的方法,但没有摆脱浏览器错误的方法。

杰德西尔维奥

好像我将asserts放在错误的位置。通过了以下内容:

import Ember from 'ember';
import { module, test } from 'qunit';
import startApp from '../helpers/start-app';

var App;

module('Integration - About Page', {
  beforeEach: function() {
    App = startApp();
  },
  afterEach: function() {
    Ember.run(App, 'destroy');
  }
});

test('Should click About link', function(assert) {
  visit('/').then(function() {
    click("a:contains('About')").then(function() {
      assert.equal(find('h3').text(), 'About');
    });
  });
});

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

在开发中如何从https:// localhost:4200提供ember-cli

“http://localhost/app/hello”和“http://localhost/app/hello/”有什么区别?

如何在谷歌浏览器中连接到Angle,Node.js http:// localhost:4200

chrome日志中的“导航到http:// localhost:4200 /”之后的问号是什么意思?

Angular7中的CORS策略已阻止源'http:// localhost:4200'

在 Angular 中获取 http://localhost:4200/[object%20Blob] 404(未找到)

使用angular-cli在angular2中获取http:// localhost:4200 / null 404(未找到)

错误GET http:// localhost:4200 / styles.css,但是我可以使用这些样式。这是怎么回事?

Ember Server:没有端口在4200上运行时,“端口4200已在使用中”

CORS 策略阻止了对源“http://localhost:4200”的 XMLHttpRequest 的访问

GET http:// localhost:4200 / resource 404(未找到)

POST http:// localhost:4200 / contact / send 404(未找到)

GET http://localhost:3000/hello 404(未找到)

Angular2和节点js中的POST http:// localhost:4200 / addTask 404(未找到),但值已在控制台中打印

PhantomJS 2.1 - 全局错误:ReferenceError:找不到变量:Ember at http://localhost:4221/1400/tests/index.html?hidepassed

angular 应用程序适用于 http://localhost:4200,但我想要 https://localhost:44325

從源“http://localhost:4200”訪問“localhost:8088/user/”的 XMLHttpRequest 已被 CORS 策略阻止

从路由器链接中删除localhost:4200 / xxx

在AWS的Claudiajs Hello Word示例中未加载凭据

使用JavaFX在Eclipse中执行“ Hello Word”程序时出错

CORS策略已阻止访问源为“ http:// localhost:4200”的“ http:// ....”处的XMLHttpRequest

请求http:// localhost:4080 / testAPI / rest / hello后找不到HTTP状态404

(404未找到)正在加载http:// localhost:4200 / angular2-datatable / datatable

从CORS策略阻止从源“ http:// localhost:4200”访问“ URL”处的XMLHttpRequest:

在組件 service.ts url: "http://localhost:4200/data/products.json" not found

Angular 8:POST http:// localhost:4200 / assets / data / students.json 404(未找到)

GET http://localhost:4200/src/app/ficheros/nacionalidades.json 404(未找到)

snap和gitlab-CI:错误:无法与服务器通信:发布http:// localhost / v2 / snaps / hello-world

yii2.0在运行http://localhost/~name/yii2hello/backend/web/index.php?r = site / say时给出403错误