Skip to content
This repository has been archived by the owner on Oct 29, 2024. It is now read-only.

Overhaul Testing Infrastructure #246

Open
1 of 4 tasks
pzuraq opened this issue Mar 27, 2020 · 4 comments
Open
1 of 4 tasks

Overhaul Testing Infrastructure #246

pzuraq opened this issue Mar 27, 2020 · 4 comments

Comments

@pzuraq
Copy link
Member

pzuraq commented Mar 27, 2020

There are a few things about the testing infrastructure that need to be addressed moving forward:

  • Currently render() and settled() return a string containing the HTML output. This is a good way to get started with many types of tests, doesn't give us much flexibility. A better solution would be to incorporate QUnit.dom so that we can make assertions based on the output of a render, without having to worry about details like finding the QUnit render element.

  • render() should instead return the result of the call to renderComponent(). Currently, this is void, but we should add an API to control the rendered output with at least one method: destroy(). This would be useful for the embedding use cases, but also for simplifying tests, since it would allow us to manually destroy the component tree instead of using existing hacks like wrapping it in an {{#if}} and toggling the property.

  • We should add better DOM interaction functions. Ideally, we would genericize @ember/test-helpers and make it so they can work anywhere, then just use those.

  • We should rewrite the existing tests to use the new tracked() helper. Currently there are a number of tests that capture the instance of a component and try to manipulate it directly to ensure updates. This is a lot of boilerplate, and not really necessary in many cases.

@rahilvora
Copy link

Hey @pzuraq, I am new to Glimmer.js and would like to contribute to it. Can I pick this issue for my first contribution?

@pzuraq
Copy link
Member Author

pzuraq commented Apr 16, 2020

Yep, this would be great for a first issue 😄 I would recommend tackling each issue one at a time with separate PRs, so we can review them individually. Happy to help discuss the path for each change, in particular genericizing @ember/test-helpers might be a bit tricky.

@rahilvora
Copy link

rahilvora commented Apr 18, 2020

Hey @pzuraq,

PR to refactor tests to use tracked utility. #283

@pzuraq
Copy link
Member Author

pzuraq commented Apr 23, 2020

Meeting notes on 4/23:

  • First item, we need a strategy here long term, but it's going to be tricky so we are going to wait for the time being.

  • Second item, we need to discuss this in the Glimmer.js team and make a decision about what we want to do here. Could just return the component instance.

  • Third item, we're going to move forward with breaking out ember-test-helpers into two packages, a normal node package that exports the test helpers as is, and a thin Ember addon wrapper.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants