Git Product home page Git Product logo

ember-cli-acceptance-test-helpers's People

Contributors

alexdiliberto avatar amyrlam avatar backspace avatar bantic avatar bryancrotaz avatar ember-tomster avatar eriktrom avatar givanse avatar iezer avatar jelhan avatar notmessenger avatar psbanka avatar tundal45 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ember-cli-acceptance-test-helpers's Issues

expectComponent does not work with hbs rendering

expectElement works:

test('it renders', function (assert) {
  assert.expect(1);

  this.render(hbs`
    {{#my-component class="my-component"}}
      Some text here
    {{/my-component}}
  `);

  expectElement(".my-component", 1);
});

We would prefer to use expectComponent to write this as

test('it renders', function (assert) {
  assert.expect(1);

  this.render(hbs`
    {{#my-component}}
      Some text here
    {{/my-component}}
  `);

  expectComponent("my-component", 1);
});

but this fails in Component.detectInstance.

Update for ember-cli 2.10

While upgrading to ember-cli 2.10, I noticed the addon is incompatible as it relies on globally available ok (see https://github.com/201-created/ember-cli-acceptance-test-helpers/blob/master/test-support/helpers/201-created/utils/wrap-in-expectation.js).

I could not find how to get access to assertions from the test helper registration functions, and moreover, the Ember docs state that assert and other must be passed explicitly to the helper (see https://guides.emberjs.com/v2.10.0/testing/acceptance/#toc_custom-test-helpers).

As far as I understand and in order to have this addon work with the latest ember-cli, a change in API seems necessary, either as:

  • rename expectComponent (and others) to findComponents and use it as assert.ok(findComponents("my-component")) or assert.equal(findComponents("my-component").length, 3)
  • prepend assert as the first parameter to the existing components expectComponents(assert, "my-component")

Obviously, more options are available, pros and cons will be discussed, please bare in mind the two above are just a way to kickstart the discussion.

What do you think?

expectElement is not defined.

when firing up a new app with ``ember-cli": "2.3.0-beta.2" "ember": "2.3.0"`

 ReferenceError: expectElement is not defined
    at tests.js:286
    at andThen (vendor.js:72476)
    at vendor.js:73183
    at isolate (vendor.js:73384)
    at vendor.js:73368
    at tryCatch (vendor.js:85803)
    at invokeCallback (vendor.js:85818)
    at publish (vendor.js:85786)
    at vendor.js:64297
    at Queue.invokeWithOnError (vendor.js:32039) 

Add Pause Helper

From @stefanpenner 's coment in #26: "Something I have found useful in async tests, is the ability to pause and resume tests. At work we are using this, and its quite nice. This differs from a debugger, in that you can still use and interact with the paused application, and differs from the existing pauseTest helper, because it can be resumed."

example:

import pause from './helpers/pause';

test("fooo", async () => {

  await visit('/foo');

  await pause(); // will pause here, but can be resumed by typing `resume`
  await click('#bar');

  // some assertions
})

codez: https://gist.github.com/stefanpenner/0baadd08d0733f9e8ae0

expectElement greater than a certain count?

Maybe I'm missing something, but is it possible to use the expectElement method to test if there is at least a certain number of elements, instead of exactly the number of elements defined in count? I want to test that a list of models are returned, but I'm not sure how many will be there.

Thanks!

feature request: add a message to the options hash

We'd like to be able to add a message to options that are passed to expectElement. This is useful because sometimes we have synchronous helpers for finding an element. Example:

// helper
findButton(app, buttonText) {
  return find(`button:contains(${buttonText})`);
}

// test
  expectElement(findButton('Save Profile')); 

If this fails, we get a cryptic message like found 0 of false but expected 1 or found 0 of [Object] but expected 1

We'd like to be able to do expectElement(findButton('Save Profile'), 1, options: { message: { 'Save Profile Button' }}) and see found 0 of Save Profile Button

Now that I'm looking at this example we can probably think of a better syntax but the general idea applies.

@bantic appreciate your thoughts.
CC @amyrlam @tundal45

Using Mocha

I made a fork of your project for use with Mocha, which wasn’t too difficult because of your clever wrap-in-expectation isolation.

Do you think it’s at all feasible to merge these and configure with a flag in config/environment.js? My amateur suspicion is that it’s not feasible because of the different dependencies in bower.json and package.json.

minimatch security vulnerability

npm audit with a dependency on ember-cli-acceptance-test-helpers@^1.0.0 currently yields

┌───────────────┬──────────────────────────────────────────────────────────────┐
│ High          │ Regular Expression Denial of Service                         │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package       │ minimatch                                                    │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Patched in    │ >=3.0.2                                                      │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ ember-cli-acceptance-test-helpers [dev]                      │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path          │ ember-cli-acceptance-test-helpers > ember-cli-babel >        │
│               │ broccoli-babel-transpiler > babel-core > minimatch           │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info     │ https://nodesecurity.io/advisories/118                       │
└───────────────┴──────────────────────────────────────────────────────────────┘

Similarly, running ember build or ember serve emits

DEPRECATION: ember-cli-babel 5.x has been deprecated. Please upgrade to at least ember-cli-babel 6.6. Version 5.2.8 located: myapp -> ember-cli-acceptance-test-helpers -> ember-cli-babel

Please release a new version with ember-cli-babel upgraded.

`clickComponent` lookupFactory of undefined error

Anytime I call clickComponent, I get the following error. I even created a dummy app locally in its most pared down form to reproduce.

TypeError: Cannot read property 'lookupFactory' of undefined
    at lookupComponent (lookup.js:11)
    at clickComponent (async.js:6)
    at ember.debug.js:40913
    at isolate (ember.debug.js:41114)
    at ember.debug.js:41098
    at tryCatch (ember.debug.js:53543)
    at Object.invokeCallback (ember.debug.js:53558)
    at ember.debug.js:55684
    at ember.debug.js:32082
    at Queue.invoke (ember.debug.js:333)

The issue stems from the following commit 2cfc1b8

Where now in v0.4.0+ app.container will be undefined https://github.com/201-created/ember-cli-acceptance-test-helpers/blob/v0.4.0/test-support/helpers/201-created/async.js#L5

I believe something like the following which you're already doing would fix the issue: https://github.com/201-created/ember-cli-acceptance-test-helpers/blob/v0.4.0/test-support/helpers/201-created/raw/expect-component.js#L8-L12

feature request: expectLinkTo(pathName)

Add the ability to assert that the page contains a link to the given path or url.
Assuming this makes sense, this could be used in a clickLinkTo helper also

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.