Skip to content

Incorrect scope in steps #76

Description

@lukeclewlow

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions