question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`click()` helper is not reliable

See original GitHub issue
// in my new ember acceptance tests

await click('[data-test-username-button]');

assert.equal(currentURL(), '/izelnakri'); // this doesn't pass!

click helper doesnt wait for url transition. It could be either due to fact that ember click selector ignore attribute selectors [data-test-username-button] or its waiter is simply buggy.

Unfortunately I already removed a branch in my project where I was refactoring my application tests one by one to new ember application test/qunit modules. I succeeded with unit + integration tests but failed on application tests.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:17 (10 by maintainers)

github_iconTop GitHub Comments

2reactions
ggayowskycommented, Feb 12, 2019

I will add my two cents here, however, I believe this is more of a problem with settled() than it is click.

I have a link-to component which transitions routes, and the click (settled) is returning control to the test between model and afterModel.

I tried to create an ember-twiddle to show my problem, however, twiddle is not properly loading the visit function from @ember/test-helpers

templates/my-route.hbs

{{#link-to "failing-route" class="failing-route-link"}}

routes/failing-route/view.js

model() {
  const myModel = {};
  return new EmberPromise((resolve) => {
    setTimeout(() => { resolve(model); }, 1);
  });
}

afterModel() {
  // Do stuff in after model
}

tests/acceptance/failing-route-test.js

test('transition to failing route', async function(assert) {
  await visit('/my-route');
  await click('.failing-route-link');
  assert.equal(currentRouteName(), 'failing-route.view', 'Should be at the failing route'); // This fails with currentRouteName return 'failing-route.loading'
});

If I change the model hook to return the model directly, or return Promise.resolve(model) the test passes. Otherwise, it fails.

2reactions
viniciussbscommented, Jul 23, 2018

You people still have this issue? @Turbo87 @rwjblue the Ember Twiddle posted by @raphaelns-developer reproduces the issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

[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 ......
Read more >
EmberJS - Click() helper doesn't work as expected
I'm trying to write a simple acceptance test where an element with an id and an href gets clicked and the URL changes,...
Read more >
click not working - Data Queries & Synthetic Scripts
I am trying to click on SET APPOINTMENT. Once clicked it should take to next page but that is not happening. Below is...
Read more >
WebDriver - click on non-clickable element - Cookbook
So we had to find a workaround and what we found out is good way to click on non-clickable element, so we created...
Read more >
jQuery .click(function(e){} not working on lightning component
Just for the record, this issue was happening due to JQuery version. I was using 1.11.3 and according to this post, it has...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found