2016-09-13 15:14:17 -04:00
|
|
|
import startApp from 'wizard/test/helpers/start-app';
|
|
|
|
|
|
|
|
var wizard;
|
2017-07-27 10:48:31 -04:00
|
|
|
QUnit.module("Acceptance: wizard", {
|
2016-09-13 15:14:17 -04:00
|
|
|
beforeEach() {
|
|
|
|
wizard = startApp();
|
|
|
|
},
|
|
|
|
|
2017-06-14 13:57:58 -04:00
|
|
|
afterEach() {
|
2016-09-13 15:14:17 -04:00
|
|
|
Ember.run(wizard, 'destroy');
|
|
|
|
}
|
|
|
|
});
|
2016-08-24 14:35:07 -04:00
|
|
|
|
2016-08-25 13:14:56 -04:00
|
|
|
test("Wizard starts", assert => {
|
2016-08-24 14:35:07 -04:00
|
|
|
visit("/");
|
|
|
|
andThen(() => {
|
|
|
|
assert.ok(exists('.wizard-column-contents'));
|
2016-08-25 13:14:56 -04:00
|
|
|
assert.equal(currentPath(), 'step');
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2016-09-02 11:42:14 -04:00
|
|
|
test("Going back and forth in steps", assert => {
|
2016-09-07 18:04:01 -04:00
|
|
|
visit("/steps/hello-world");
|
2016-08-25 13:14:56 -04:00
|
|
|
andThen(() => {
|
|
|
|
assert.ok(exists('.wizard-step'));
|
|
|
|
assert.ok(exists('.wizard-step-hello-world'), 'it adds a class for the step id');
|
|
|
|
|
|
|
|
assert.ok(exists('.wizard-progress'));
|
|
|
|
assert.ok(exists('.wizard-step-title'));
|
|
|
|
assert.ok(exists('.wizard-step-description'));
|
|
|
|
assert.ok(!exists('.invalid .field-full-name'), "don't show it as invalid until the user does something");
|
2016-08-31 13:35:49 -04:00
|
|
|
assert.ok(exists('.wizard-field .field-description'));
|
2016-08-25 13:14:56 -04:00
|
|
|
assert.ok(!exists('.wizard-btn.back'));
|
2016-08-31 13:35:49 -04:00
|
|
|
assert.ok(!exists('.wizard-field .field-error-description'));
|
2016-08-25 13:14:56 -04:00
|
|
|
});
|
|
|
|
|
|
|
|
// invalid data
|
|
|
|
click('.wizard-btn.next');
|
|
|
|
andThen(() => {
|
|
|
|
assert.ok(exists('.invalid .field-full-name'));
|
|
|
|
});
|
|
|
|
|
|
|
|
// server validation fail
|
|
|
|
fillIn('input.field-full-name', "Server Fail");
|
|
|
|
click('.wizard-btn.next');
|
|
|
|
andThen(() => {
|
|
|
|
assert.ok(exists('.invalid .field-full-name'));
|
2016-08-31 13:35:49 -04:00
|
|
|
assert.ok(exists('.wizard-field .field-error-description'));
|
2016-08-25 13:14:56 -04:00
|
|
|
});
|
|
|
|
|
|
|
|
// server validation ok
|
|
|
|
fillIn('input.field-full-name', "Evil Trout");
|
|
|
|
click('.wizard-btn.next');
|
|
|
|
andThen(() => {
|
2016-08-31 13:35:49 -04:00
|
|
|
assert.ok(!exists('.wizard-field .field-error-description'));
|
2016-08-25 13:14:56 -04:00
|
|
|
assert.ok(!exists('.wizard-step-title'));
|
|
|
|
assert.ok(!exists('.wizard-step-description'));
|
2016-09-02 11:42:14 -04:00
|
|
|
|
2017-11-21 05:53:09 -05:00
|
|
|
assert.ok(exists('.select-kit.field-snack'), "went to the next step");
|
2016-09-02 11:42:14 -04:00
|
|
|
assert.ok(exists('.preview-area'), "renders the component field");
|
|
|
|
|
2016-08-25 13:14:56 -04:00
|
|
|
assert.ok(!exists('.wizard-btn.next'));
|
2016-08-31 13:35:49 -04:00
|
|
|
assert.ok(exists('.wizard-btn.done'), 'last step shows a done button');
|
2016-09-15 15:04:25 -04:00
|
|
|
assert.ok(exists('.action-link.back'), 'shows the back button');
|
2016-08-25 13:14:56 -04:00
|
|
|
});
|
|
|
|
|
2016-09-15 15:04:25 -04:00
|
|
|
click('.action-link.back');
|
2016-08-25 13:14:56 -04:00
|
|
|
andThen(() => {
|
|
|
|
assert.ok(exists('.wizard-step-title'));
|
|
|
|
assert.ok(exists('.wizard-btn.next'));
|
|
|
|
assert.ok(!exists('.wizard-prev'));
|
2016-08-24 14:35:07 -04:00
|
|
|
});
|
|
|
|
});
|