Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect scope in steps #76

Open
lukeclewlow opened this issue Jun 14, 2018 · 1 comment
Open

Incorrect scope in steps #76

lukeclewlow opened this issue Jun 14, 2018 · 1 comment

Comments

@lukeclewlow
Copy link

Hi there,

I've recently upgraded a project to the new testing format, and followed the instructions in the README, however, the scope of this inside my step file is wrong as it does not have a this.element as the docs suggest it should.

Below is a simplified version of my steps file, have put it all in steps.js for brevity.

// steps.js
import { visit, click, currentURL } from '@ember/test-helpers';
import yadda from '../../helpers/yadda';

export default function(assert) {
  return yadda.localisation.default.library()
  .given('I am on the dashboard', async function() {
    await visit('/');
  })
  .when('I click the learning link', async function() {
    await click('a.learning');
  })
  .then('I should see a list of learning activities', async function() {
    // this.element is undefined here
    assert.equal(this.element.querySelector('ul.posts li').textContent, 'My new post');
  })
}

I'm not sure if some of my setup is wrong or if this is a bug. Any help greatly appreciated.

Thanks!

@simonihmig
Copy link
Member

@lukeclewlow sorry for the late response here! Have you added the @setupApplicationTest annotation?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants