Error running acceptance test


#1

I have a registration form and I would like to test it using an acceptance test. When I run 'ember test --filter “acceptance”, I get an error and I’m not sure how to fix it. All of my dependencies are updated which is the only solution I’ve seen thus far. This is my error:

Log: |
        { type: 'error',
          testContext: {},
          text: 'Uncaught Error: Could not find module `customer-portal/app` imported from `customer-portal/tests/test-helper` at http://localhost:7357/assets/vendor.js, line 252\n' }
...


not ok 2 Chrome 67.0 - Global error: Uncaught Error: Assertion Failed: The tests file was not loaded. 
Make sure your tests index.html includes "assets/tests.js". at http://localhost:7357/assets/vendor.js, 
line 24781
   ---

         Log: |
        { type: 'error',
          testContext: { state: 'complete' },
          text: 'Uncaught Error: Assertion Failed: The tests file was not loaded. Make sure your tests index.html includes "assets/tests.js". at http://localhost:7357/assets/vendor.js, line 24781\n' }

sign-up test

    import { visit, currentURL, fillIn, click } from '@ember/test-helpers';
    import { setupApplicationTest } from 'ember-qunit';

    module('Acceptance | sign up', function(hooks) {
    setupApplicationTest(hooks);

    test('should sign up user', async function(assert) {
    visit('/sign-up');

    fillIn('input.organization', 'test1');
    fillIn('input.dentist-first-name', 'test1');
    fillIn('input.dentist-last-name', 'test1');
    fillIn('input.dentist-email', 'test1@ww.com');
    fillIn('input.officeContact-first-name', 'test1');
    fillIn('input.officeContact-last-name', 'test1');
    fillIn('input.officeContact-email', 'test2@aa.com');
    fillIn('input.country', 'test1');
    fillIn('input.phone1', 'test1');
    fillIn('input.phone2', 'test1');
    fillIn('input.zip', 'test1');
    fillIn('input.address', 'test1');
    fillIn('input.address2', 'test1');
    fillIn('select.type', 'Bill');
    click('button.submit')


    assert.equal(currentURL(), '/sign-up');
     });
 });

sign-up-form


  <div class="form-group has-feedback has-success">
    <label class="col-md-2 control-label">Organization*</label>
    <div class="col-sm-10">
      {{input type="text" value=item.account.name class="form-control organization" placeholder="Name"}}
      {{#if item.account.isNameEnoughLong}}<span class="glyphicon glyphicon-ok form-control-feedback"></span>{{/if}}
    </div>
  </div>

  <div class="form-group has-feedback has-success">
    <label class="col-md-2 control-label">Dentist Info*</label>
    <div class="col-sm-3">
      {{input type="text" value=item.dentist.first_name class="form-control dentist-first-name" placeholder="First Name"}}
      {{#if item.dentist.isFirstEnoughLong}}<span class="glyphicon glyphicon-ok form-control-feedback"></span>{{/if}}
    </div>
    <div class="col-sm-3">
      {{input type="text" value=item.dentist.last_name class="form-control dentist-last-name" placeholder="Last Name"}}
      {{#if item.dentist.isLastEnoughLong}}<span class="glyphicon glyphicon-ok form-control-feedback"></span>{{/if}}
    </div>
    <div class="col-sm-3">
      {{input type="text" value=item.dentist.email class="form-control dentist-email" placeholder="Email"}}
      {{#if item.dentist.isValidEmail}}<span class="glyphicon glyphicon-ok form-control-feedback"></span>{{/if}}
    </div>
  </div>

  <div class="form-group has-feedback has-success">
    <label class="col-md-2 control-label">Primary Office Contact Info*</label>
    <div class="col-sm-3">
      {{input type="text" value=item.officeContact.first_name class="form-control officeContact-first-name" placeholder="First Name"}}
      {{#if item.officeContact.isFirstEnoughLong}}<span class="glyphicon glyphicon-ok form-control-feedback"></span>{{/if}}
    </div>
    <div class="col-sm-3">
      {{input type="text" value=item.officeContact.last_name class="form-control officeContact-last-name" placeholder="Last Name"}}
      {{#if item.officeContact.isLastEnoughLong}}<span class="glyphicon glyphicon-ok form-control-feedback"></span>{{/if}}
    </div>
    <div class="col-sm-3">
      {{input type="text" value=item.officeContact.email class="form-control officeContact-email" placeholder="Email"}}
      {{#if item.officeContact.isValidEmail}}<span class="glyphicon glyphicon-ok form-control-feedback"></span>{{/if}}
    </div>
  </div>


  <div class="form-group has-feedback has-success">
    <label class="col-md-2 control-label">Country*</label>
    <div class="col-sm-4">
      {{input type="text" value=item.address.country_code class="form-control country" placeholder="Country"}}
      {{#if item.address.isCountryEnoughLong}}<span class="glyphicon glyphicon-ok form-control-feedback"></span>{{/if}}
    </div>

    <label class="col-md-2 control-label">Phone*</label>
    <div class="col-sm-4">
      {{input type="text" value=item.address.telephone1 class="form-control phone1" placeholder="Phone"}}
      {{#if item.address.isTele1EnoughLong}}<span class="glyphicon glyphicon-ok form-control-feedback"></span>{{/if}}
    </div>
  </div>

  <div class="form-group has-feedback has-success">
    <label class="col-md-2 control-label">Phone 2</label>
    <div class="col-sm-10">
      {{input type="text" value=item.address.telephone2 class="form-control phone2" placeholder="Tele 2"}}
      {{#if item.address.isTele2EnoughLong}}<span class="glyphicon glyphicon-ok form-control-feedback"></span>{{/if}}
    </div>
  </div>


  <div class="form-group has-feedback has-success">
    <label class="col-md-2 control-label">Street Address*</label>
    <div class="col-sm-10">
      {{input type="text" value=item.address.line1 class="form-control address" placeholder="Line 1"}}
      {{#if item.address.isLine1EnoughLong}}<span class="glyphicon glyphicon-ok form-control-feedback"></span>{{/if}}
    </div>
  </div>

  <div class="form-group has-feedback has-success">
    <label class="col-md-2 control-label"> 2nd Line Street Address*</label>
    <div class="col-sm-10">
      {{input type="text" value=item.address.line2 class="form-control address2" placeholder="Line 2"}}
      {{#if item.address.isLine2EnoughLong}}<span class="glyphicon glyphicon-ok form-control-feedback"></span>{{/if}}
    </div>
  </div>

  <div class="form-group has-feedback has-success">
    <label class="col-md-2 control-label">City*</label>
    <div class="col-sm-10">
      {{input type="text" value=item.address.city class="form-control city" placeholder="City"}}
      {{#if item.address.isCityEnoughLong}}<span class="glyphicon glyphicon-ok form-control-feedback"></span>{{/if}}
    </div>
  </div>

  <div class="form-group has-feedback has-success">
    <label class="col-md-2 control-label">State*</label>
    <div class="col-sm-10">
      {{input type="text" value=item.address.state_code class="form-control state" placeholder="State"}}
      {{#if item.address.isStateEnoughLong}}<span class="glyphicon glyphicon-ok form-control-feedback"></span>{{/if}}
    </div>
  </div>

  <div class="form-group has-feedback has-success">
    <label class="col-md-2 control-label">Zip Code*</label>
    <div class="col-sm-10">
      {{input type="text" value=item.address.postal_code class="form-control zip" placeholder="Zip Code"}}
      {{#if item.address.isZipEnoughLong}}<span class="glyphicon glyphicon-ok form-control-feedback"></span>{{/if}}
    </div>
  </div>

<div class="form-group has-feedback has-success">
    <label class="col-md-2 control-label">Type</label>
    <div class="col-sm-10">
      <select class="selectpicker form-control type" onchange={{action "setType" item}}>
        <option>-- Please Specify --</option>
        {{#each types as |typeChoice|}}
      <option value={{typeChoice}} selected={{eq item.address.type typeChoice}}>{{typeChoice}}</option>
    {{/each}}
      </select>
    </div>
  </div>

<div class="form-group">
  <div class="col-sm-offset-2 col-sm-10">
    <button type="submit" class="btn btn-default submit" {{action 'buttonClicked' item}} disabled={{unless item.officeContact.isValid true}}>{{buttonLabel}}</button>
  </div>
</div>
</div>

#2

The error message you should care about is this one:

There seems to be a wrong import in your /tests/test-helper.js. customer-portal is the name of your application. Normally there isn’t any module app in an ember application.

This has nothing to do with your registration form.


#3

ahh I see. I am importing ‘Application’ from ‘…/app’ however that comes when I generate the test through Ember. Should I delete it?

/tests/test-helper.js

import config from '../config/environment';
import { setApplication } from '@ember/test-helpers';
import { start } from 'ember-qunit';



setApplication(Application.create(config.APP));

start();

#4

Ah yeah of course I missed that one. The default blueprint for tests/test-helper.js has this import and it should be totally fine. Please make sure that you have an /app/app.js. If this one exists and is that same as generated by ember-cli for a new project, I don’t have any idea what’s going on to be honest.