Need Guidance with ember and puppeteer

Hi, I’m a QE attempting to apply a cucumberjs / puppeteer solution. I’m very green when it comes to ember. I can’t seem to page.click on an ember computed properties:

			<p class="ao-label" data-test-upload="true">Drag and Drop Files or 
				{{#file-upload 
					name="transactions"
					class="ao-file-uploader__file"
					multiple=false
					onfileadd=(action "validateFile")
					accept=allowFileTypeString 
				}}
					<a class="ao-button ao-button--link">Click to Browse</a>
				{{/file-upload}}
			</p>

but when i attempt to click on the element:

await   this.page.click('[data-test-upload="true"]');

Cucumber.js complains that the selector can’t be found. Does anyone know how I can create element selectors for ember computed properties so that puppeteer can select it with a page.click? please?

Desperately yours, Huckleberry

Most likely that template hasn’t actually rendered by the time you’re trying to find the selector. Like any clientside Javascript framework, the actual HTML isn’t present until data loading and rendering have finished, so waiting for DOMREady or some other built-in browser event is not going to work reliably.

While it’s possible to test Ember using puppetteer the same way you could test any Javascript application, that’s going to be harder and less robust than using Ember’s own testing infrastructure. The build in test capability is really good.

You can generate a new acceptance test by running ember generate acceptance-test my-first-test, and then update that test to read like:

await visit('/some-page-in-the-app');
await click('[data-test-upload]');

Start here in the docs to get a feel for if this is going to work for you.

Is there a way to run ember test via a command line? My hope is that I could create the ember test file and just call it from my cucumber.js code.

Yes, it’s just ember test.

I use it to click on a single element?

No, ember test would run all the tests you’ve defined in your app. I’m suggesting that you could call that once from whatever other test suite you have, in order to delegate a chunk of testing to Ember where you’re testing things that are easiest to test within Ember.

Can ember test be used to kick off other js functions? (say a function/test to check a data base value)