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

Convert more tests to modern testing style #2054

Merged
merged 78 commits into from
Jul 9, 2019

Conversation

clekstro
Copy link
Contributor

No description provided.

@clekstro clekstro force-pushed the ce-convert-more-tests-contd branch from 9de57b7 to e95504d Compare June 26, 2019 12:48
@clekstro clekstro force-pushed the ce-convert-more-tests-contd branch from 26722bb to 89d1f1d Compare July 8, 2019 10:37
clekstro added 19 commits July 8, 2019 13:27
Hoping based on https://engineering.linkedin.com/blog/2018/01/ember-timer-leaks that it will help us identify some leakage that is causing some annoying test flappiness.
Was just an experiment, removing for now.

This reverts commit 9e434c4.
This is now built-in as `waitFor` within @ember/test-helpers.
It appears that these tests are very flaky, so need to figure out a way to permanently fix them. I do not want them, however, to hold up this chunk of work.
This does lose a single assertion that we are calling the auth service correctly, but I would argue that this should be a unit test on the auth service if it is needed at all.
This was causing a super weird error regarding `window.wait`.
We no longer use `withFeature` but rather import `enableFeature` directly in any test that needs it
@clekstro clekstro force-pushed the ce-convert-more-tests-contd branch from 16898ce to a0d9ee8 Compare July 8, 2019 12:42
clekstro added 2 commits July 8, 2019 15:11
This will automatically sign a user out and clear browser state, ensuring every test starts off with the same state
@clekstro
Copy link
Contributor Author

clekstro commented Jul 9, 2019

This does skip a few tests that were giving trouble (mainly sync tests that were leveraging setTimeout), but overall should get us cut over to the new testing APIs.

@clekstro clekstro requested a review from artursmirnov July 9, 2019 14:42
test('app does not request feature flags on boot if available in local storage', function (assert) {
assert.expect(1);
test('app does not request feature flags on boot if available in local storage', async function (assert) {
assert.expect(1);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure, but it seems like this test should expect 2 assertions, shouldn't it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this test is probably just a bit too clever. Instead of the normal assert.ok(true), we assert the opposite (assert.ok(false)) so that the test would fail if the request were ever made. This isolates the failure from someone accidentally deleting the expectation that a certain amount of assertions are made, but it's definitely not the most intuitive thing to read...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, that makes sense! I didn't get the idea, it just catched my eye so I thought to mention. Thanks for the clarification!

Copy link
Contributor

@artursmirnov artursmirnov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@clekstro it's amazing! Thanks for taking care of this! I just noticed one tiny thing with expect, everything else looks great.

clekstro added 2 commits July 9, 2019 20:52
This already happens within `setupApplicationTest`.
I have left it in place for now (in case it has some use later), but we reset the local/session storage anyway before each acceptance test, and our only uses of it right now were essentially duplicating that work.
@clekstro clekstro merged commit d03fa1f into master Jul 9, 2019
@clekstro clekstro deleted the ce-convert-more-tests-contd branch July 9, 2019 21:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants