Jquery EmberJS-Click()助手不';I don’我没有按预期工作

Jquery EmberJS-Click()助手不';I don’我没有按预期工作,jquery,ember.js,ember-testing,acceptance,Jquery,Ember.js,Ember Testing,Acceptance,在测试时,将JQuery选择器传递给emberjs中的click()方法时,不会单击元素。 我正在尝试编写一个简单的验收测试,其中一个id和href元素被单击,URL发生更改,然后我断言页面发生了更改 我将id添加到元素id=“侧栏用户配置文件”中,当我尝试单击($(“#侧栏用户配置文件”)时,我得到错误“error:element[object]not found.”。我在Chrome的控制台上尝试了同样的方法,在页面上键入$(“#侧栏用户配置文件”),它选择了确切的元素 在过去的两个星期里,

在测试时,将JQuery选择器传递给emberjs中的click()方法时,不会单击元素。 我正在尝试编写一个简单的验收测试,其中一个id和href元素被单击,URL发生更改,然后我断言页面发生了更改

我将id添加到
元素id=“侧栏用户配置文件”中,当我尝试
单击($(“#侧栏用户配置文件”)
时,我得到错误“error:element[object]not found.”。我在Chrome的控制台上尝试了同样的方法,在页面上键入
$(“#侧栏用户配置文件”)
,它选择了确切的元素

在过去的两个星期里,我一直在努力让它发挥作用,但我别无选择

编辑:以下是出现错误的测试:

test('exists and works/home/user profile',函数(assert){
断言。期望(1);
单击(“#侧边栏用户配置文件”);
第四(函数(){
等于(currentURL(),'/home/user profile');
});

});单击获取选择器而不是jquery对象,您的测试将类似于:

click('#sidebar-user-profile');
andThen(() => {
  assert.equal(currentURL(), `/myurl/new`, 'Should go to new route');
});
编辑:

test('exists and works /home/user-profile', function(assert) {
  visit('/home'); // route where your link-to is located
  click('#sidebar-user-profile');
  andThen(function() {
    assert.equal(currentURL(), '/home/user-profile');
  });
});

单击(“#侧栏用户配置文件”)记住将断言包装在
中,然后
确定,现在错误不是“error:Element[object object]not found.”,而是“error:Element#sidebar user profile not found.”你能添加模板代码吗?测试运行时,您是否在正确的路线上?添加一个
返回pauseTest()
单击并检查您是否在正确的位置之前,您可能需要在测试开始时添加一个
访问('/home')
,如果链接在那里。