[SOLVED] Cannot run acceptance tests 'click' helper not defined

My issue is very similar to ReferenceError: andThen is not defined in that when trying to follow the emberjs.com tutorial and going through sections on acceptance tests I am getting a problem with a helper method.

As with the other post, I had an issue with ‘andThen’, however I looked up async/await as suggested and the first test is now passing.

My second test though is not, because there is no ‘click’ method available:

  test('should link to information about the company.', async function (assert) {
    await visit('/');
    await click('a:contains("About")');
    assert.equal(currentURL(), '/contact', 'should navigate to contact');

Any ideas would be most appreciated!

Did you try importing it from @ember/test-helpers like in the second example in the guide?


import { module, test } from 'qunit';
import { click, fillIn, visit } from '@ember/test-helpers';
import { setupApplicationTest } from 'ember-qunit';

module('Acceptance | posts', function(hooks) {

  test('should add new post', async function(assert) {
    await visit('/posts/new');
    await fillIn('input.title', 'My new post');
    await click('button.submit');
    assert.equal(this.element.querySelector('ul.posts li').textContent, 'My new post');

Important part on line 2

I did not!

Rookie mistake, thanks for the assist :slight_smile:

I do that stuff all the time :smile: good luck!