For the web-ui test, you must request the shadow dom or xtag (this) of the web component that you want to test instead of the "classic" dom.
Based on TodoMVC sample code
With code:
The working version of this test is:
main() { useShadowDom = true; test('Inline element is initially present.', () { var story = () => expect(query('#hdr'), isNotNull); Timer.run(expectAsync0(story)); }); test('Component is loaded.', () { var root = query("span[is=x-app]").shadowRoot; var story = () => expect(root.query('#globe'), isNotNull); Timer.run(expectAsync0(story)); }); }
and the test version without expectAsync should be:
main() { useShadowDom = true; Timer.run(() { test('Header element is initially present.', () { var hdr = query('#hdr'); expect(hdr, isNotNull); }); test('EchapApp component is loaded.', () { var root = query("span[is=x-app]").shadowRoot; var globe = root.query('#globe'); expect(globe, isNotNull); }); }); }
and complete the version without shadow dom:
main() { //useShadowDom = true; Timer.run(() { test('Header element is initially present.', () { var hdr = query('#hdr'); expect(hdr, isNotNull); }); test('EchapApp component is loaded.', () { var root = query("span[is=x-app]").xtag; var globe = root.query('#globe'); expect(globe, isNotNull); }); }); }
For me, these 3 codes are 100% passed on Dartium with
Dart Editor Version 0.5.20_r24275
Dart SDK version 0.5.20.4_r24275
source share