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

ember-test-helpers' Click() is not waiting for MakeRequest #265

Closed
tpetrone opened this issue Aug 4, 2019 · 9 comments
Closed

ember-test-helpers' Click() is not waiting for MakeRequest #265

tpetrone opened this issue Aug 4, 2019 · 9 comments
Labels

Comments

@tpetrone
Copy link

tpetrone commented Aug 4, 2019

We are facing a timing issue during an acceptance test that performs a login. Sometimes it works, sometimes it does not.

In our code, clicking a button triggers an action that calls authenticate() method and upon resolution, the user gets transitioned to an authenticated route - a pretty common login flow. The application is configured to use jwt authenticator.

During the test execution, sometimes it reaches settledness before actually resolving the promise. In other words, before authenticate.then. Further investigations led me to understand that there is a potencial problem at makeRequest method (token.js).
The tests do always wait for the completion of fetch but it doesn't necessarily wait for response.text() promise.

Is this an expected behaviour?

@tpetrone tpetrone changed the title ember-test-helpers is not waiting for MakeRequest ember-test-helpers' Click() is not waiting for MakeRequest Aug 5, 2019
@tpetrone
Copy link
Author

tpetrone commented Aug 5, 2019

It may be related to emberjs/ember-test-helpers#339

@tpetrone
Copy link
Author

tpetrone commented Aug 5, 2019

Definitely related to ember-cli/ember-fetch#204

@fenichelar
Copy link
Owner

@tpetrone Thanks for reporting this! I'm slammed at work right now so it may be a day or two before I can dig in. It looks like you are working on it. Right now, does this appear to be an issue we need to resolve in the library? Thanks.

@tpetrone
Copy link
Author

tpetrone commented Aug 6, 2019

Hi @fenichelar!
AFAIK using the option below is a valid workaround.

'ember-fetch': {
  preferNative: true
}

@fenichelar
Copy link
Owner

@tpetrone Is this something we should add to the package.json of this library or add a note in the documentation about adding to the project using this libraries package.json?

@tpetrone
Copy link
Author

tpetrone commented Aug 9, 2019

@fenichelar I think it would be enough to mention in the docs. I forgot to mention but this is a build option. That piece of code should go in ember-cli-build.js of the client app.

@fenichelar
Copy link
Owner

Okay, I'll add it to the testing section of the readme: https://github.com/jpadilla/ember-simple-auth-token#testing-configuration.

@stale
Copy link

stale bot commented Oct 8, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Oct 8, 2019
@stale stale bot closed this as completed Oct 15, 2019
@fenichelar fenichelar reopened this Oct 15, 2019
@stale stale bot removed the wontfix label Oct 15, 2019
@stale
Copy link

stale bot commented Dec 14, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Dec 14, 2019
@stale stale bot closed this as completed Dec 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants