Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't acceptance test error routes #14627

Closed
amk221 opened this issue Nov 22, 2016 · 3 comments
Closed

Can't acceptance test error routes #14627

amk221 opened this issue Nov 22, 2016 · 3 comments

Comments

@amk221
Copy link

amk221 commented Nov 22, 2016

I'm trying to test that the an error route is displayed correctly if an error occurs in our application.
Like so:

import { skip } from 'qunit';
import moduleForAcceptance from 'foo-app/tests/helpers/module-for-acceptance';
import Pretender from 'pretender';

let server;

moduleForAcceptance('acceptance:error', {
  beforeEach() {
    server = new Pretender(function() {
      this.get('/api/foo', () => {
        return [500, {}, null];
      });
    });
  },
  afterEach() {
    server.shutdown();
  }
});

skip('error', function(assert) {
  assert.expect(1);

  visit('/');

  andThen(() => {
    // can't get here...
  });
});

The problem being that because an error has occurred, the suite fails regardless.

(Sorry if this has been submitted to the wrong repo, it's not clear where this belongs).

@pixelhandler
Copy link
Contributor

pixelhandler commented Dec 29, 2016

@amk221 I think this duplicates #12791 see that issue for workarounds. It may be fine to just us a workaround, not sure if the ember qunit test env will change or add a config for expecting to fail. Or, if perhaps using assert.throws is even possible.

@pixelhandler
Copy link
Contributor

@amk221 did any of the recommendations in #12791 work for you, If so perhaps we can close this one. I have not seen any strong support for changing the testing behavior for the error handing case in acceptance testing. It seems the work around has been sufficient for most.

@amk221
Copy link
Author

amk221 commented Jan 9, 2017

Sure, this solution is adequate - thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants