# Acceptance tests with ember-paper

**URL:** <https://discuss.emberjs.com/t/acceptance-tests-with-ember-paper/13896>\
**Category:** Uncategorized\
**Created:** [November 20, 2017, 1:10pm UTC](https://discuss.emberjs.com/t/acceptance-tests-with-ember-paper/13896 "2017-11-20T13:10:55Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![GELight](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/gelight/32/12902_2.png) [@GELight](https://discuss.emberjs.com/u/GELight)\
**Post date:** [November 20, 2017, 1:10pm UTC](https://discuss.emberjs.com/t/acceptance-tests-with-ember-paper/13896/1 "2017-11-20T13:10:55Z")

</div>

Hi,

I try to write an acceptance test for our login. When I try to use the test method **click(myButtonElement)** nothing happens.

My tests:

```
click(myButtonElement)
click(find('[data-test-submit]"))

```

What is the correct way to make a click on an element? This is the snippet from my test:

```
...

andThen(function() {
    assert.equal(find('[data-test-loggedin-profile]').length, 0);
    click(find('[data-test-login-form-submit]')); // After this line nothing happens ...?!?
});

andThen(function() {
    assert.equal(currentURL(), '/');
    assert.equal(find('[data-test-loggedin-profile]').length, 1);
});

...

```

Greetings, Mario

---

<div class="post-metadata">

**Author:** ![dknutsen](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/dknutsen/32/16471_2.png) [@dknutsen](https://discuss.emberjs.com/u/dknutsen)\
**Post date:** [November 20, 2017, 2:48pm UTC](https://discuss.emberjs.com/t/acceptance-tests-with-ember-paper/13896/2 "2017-11-20T14:48:52Z")

</div>

Hey Mario, one thing I noticed just looking at the code you posted is that a click helper is asynchronous, so you should always use it **outside** of any `andThen` block. So I would rewrite the one snippet like so:

```auto
andThen(function() {
    assert.equal(find('[data-test-loggedin-profile]').length, 0);
});

click(find('[data-test-login-form-submit]'));

andThen(function() {
    assert.equal(currentURL(), '/');
    assert.equal(find('[data-test-loggedin-profile]').length, 1);
});

```

Another thing which I’d highly recommend is using [ember-cli-page-object](https://github.com/san650/ember-cli-page-object). The examples on [their docs site](http://ember-cli-page-object.js.org/docs/v1.12.x/) are really the best way to get a handle on how it’s used, but… essentially you create these “Page Objects” which are an abstract representation of the page and all the jquery selectors and test selectors, then give them functions. Then in your test instead of writing ‘find’ and ‘click’ a bunch along with a lot of repeated jquery selectors, you just reference the page object. It saves code repetition, makes the tests look a lot cleaner, and the page objects are reusable across tests. It’s a great addon and I can’t recommend it highly enough.

---

<div class="post-metadata">

**Author:** ![GELight](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/gelight/32/12902_2.png) [@GELight](https://discuss.emberjs.com/u/GELight)\
**Post date:** [November 28, 2017, 10:47am UTC](https://discuss.emberjs.com/t/acceptance-tests-with-ember-paper/13896/3 "2017-11-28T10:47:02Z")

</div>

Hi @dknutsen

Thanks again for this tipp. I have adapt my test by your tipp with the async methods.

Greetings Mario

---

<div class="post-metadata">

**Author:** ![dknutsen](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/dknutsen/32/16471_2.png) [@dknutsen](https://discuss.emberjs.com/u/dknutsen)\
**Post date:** [November 28, 2017, 3:10pm UTC](https://discuss.emberjs.com/t/acceptance-tests-with-ember-paper/13896/4 "2017-11-28T15:10:24Z")

</div>

Awesome! Glad you got it working. Good luck with all your embering!
