feature: support IDOMElementDescriptors#2087
Conversation
|
This PR does change existing error messages, as can be seen from the tests, which isn't an explicit goal of this change. Here's the explanation. If an assertion couldn't find its element (whether because of a non-matching selector or because it was passed |
PageObjects are IDOMElementDescriptors, as described in emberjs/rfcs#726 This includes temporarily patching `qunit-dom` to include mainmatter/qunit-dom#2087 so we can test the full integration.
There was a problem hiding this comment.
qunit-dom attempts to stay lean and it also promotes a way of testing without using page-objects. I understand the need and how its useful for some use cases.
I'd like us to look for a way for dom-element-descriptors to depend on qunit-dom instead and not the other way .around.
It seems like qunit-dom at the very minimum would need to provide a way to extend the element lookup and descriptions if they're required. and the assert.dom method.
Then what users of dom-element-descriptors would need to do is swap out qunit-dom setup with dom-element-descriptors setup.
// tests/test-helper.js
import * as QUnit from 'qunit';
import { setup } from 'dom-element-descriptors';
//...
setup(QUnit.assert);
setApplication(Application.create(config.APP));
start();
//...Some pseudo code for potential qunit-dom extension could be:
import { setup, DOMHandler } from 'qunit-dom'
// A class or anything that implements similar interface
class DOMElementDescriptorHandler implements DOMHandler {
findElement(selector, rootElement)
findElements(selector, rootElement)
description(selector)
resultMessage()
}
setup(QUnit.assert, [new DOMElementDescriptorHandler()])Draft #2101
|
Drafted #2101 as per feedback, would this help |
d9f77d2 to
587d4d9
Compare
|
@BobrImperator this is rebased and, pending your decision on the assertion messages change or any other feedback you might have, ready to merge! |
Extend qunit.dom() to accept IDOMElementDescriptors. See emberjs/rfcs#726.
587d4d9 to
d393fef
Compare
Now that mainmatter/qunit-dom#2087 is released, test against the released `qunit-dom` rather than our patched version. Also dedupe some dependencies.
Now that mainmatter/qunit-dom#2087 is released, test against the released `qunit-dom` rather than our patched version. Also dedupe some dependencies.
Implement support for RFC #726