Ember Integration test simulate transition to another route and then back


#1

Let me explain the issue first: We have an Ember based dirty form checker that should reset the isDirty flag if the user transitions to another page and confirms the transition when there are changes on the page. We had a bug where, if the user transitioned with changes, confirmed the change, then returned, made no changes and navigated away again, the confirmation dialog appeared again. Simple fix, just reset the flag on the initial confirmation. Now, I’m trying to write an integration test for that, but I can find no clear documentation on how to test this. What I would like to do is programmatically alter the form, transition away, then back, then away again. How can I accomplish this? This is Ember 2.3.0, using Mocha

Here’s something I’ve tried:

this.render(hbs {{#mycomp invokeDialog=invokeDialog on-dirty=formDirtyEvent on-confirm=dialogConfirmEvent on-cancel=dialogCancelEvent}} {{mytextfield id=id label="dummy-form-fullName" type="text" inputBindValue="Paul Ryan"}} {{/mycomp}});

        Ember.$("#textfield-" + this.get('id')).val("Paul Ryana");
        fillIn(Ember.$('#textfield-' + this.get('id')), 'Paul Ryanna');


        visit("/").then(function() {

         });

This generates the error: “Error: Assertion Failed: You cannot use the same root element (#ember-testing) multiple times in an Ember.Application”

Please help.