Wednesday, March 1, 2017

Ember tests actually redirecting page

Leave a Comment

I am writing ember acceptance tests, and when redirecting as in

visit('/get-started');

it actually visits the page in the browser, redirecting away from /tests.

Any thoughts on what could be causing this?

I am on Ember 2.11.0

1 Answers

Answers 1

I think this behaviour is by design. When you visit('/get-started'); in your acceptance test, it should navigate to the given path in the browser, and perform whatever acceptance criteria you are trying to test.

I'm not sure what your acceptance criteria is for the /get-started page, but if you wanted to simply test that the navigation was successful, your test might look like:

test('navigate to /get-started', function(assert) {   visit('/get-started');   andThen(function() {     assert.equal(currentPath(), 'get-started');   }); }); 

I'm not sure how acceptance tests worked in older versions, but for the current version(2.11.0), I think it is working as intended.

If You Enjoyed This, Take 5 Seconds To Share It

0 comments:

Post a Comment