Skip to content

Commit

Permalink
Skip tests that require jquery if not present
Browse files Browse the repository at this point in the history
  • Loading branch information
cibernox committed Mar 23, 2017
1 parent 5596a01 commit cc7d1a9
Showing 1 changed file with 29 additions and 27 deletions.
56 changes: 29 additions & 27 deletions tests/acceptance/usage-in-acceptance-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,30 +8,32 @@ moduleForAcceptance('Acceptance | usage in acceptance', {
}
});

test('Usage awaiting the world to settle', async function(assert) {
await visit('/signup-example');

assert.ok(find('.signup-example-form'), 'The signup form is displayed');
await fillIn('.signup-example-form__email', 'some@email.com');
await fillIn('.signup-example-form__password', '123123');
await fillIn('.signup-example-form__password-confirmation', '123123');
await click('.signup-example-form__submit-btn');

assert.ok(find('.dashboard-example-header'), 'We are on the dashboard now');
});

test('Usage using `waitUntil` to test unsettled state', async function(assert) {
await visit('/signup-example');

assert.ok(find('.signup-example-form'), 'The signup form is displayed');
fillIn('.signup-example-form__email', 'some@email.com');
fillIn('.signup-example-form__password', '123123');
fillIn('.signup-example-form__password-confirmation', '123123');
let submitPromise = click('.signup-example-form__submit-btn');

await waitUntil(() => find('.dashbord-loading-substate-header'));
assert.equal(find('.dashbord-loading-substate-header').textContent.trim(), 'Loading data for your dashboard. Please be patient.');

await submitPromise;
assert.ok(find('.dashboard-example-header'), 'We are on the dashboard now');
});
if (window.jQuery) {
test('Usage awaiting the world to settle', async function(assert) {
await visit('/signup-example');

assert.ok(find('.signup-example-form'), 'The signup form is displayed');
await fillIn('.signup-example-form__email', 'some@email.com');
await fillIn('.signup-example-form__password', '123123');
await fillIn('.signup-example-form__password-confirmation', '123123');
await click('.signup-example-form__submit-btn');

assert.ok(find('.dashboard-example-header'), 'We are on the dashboard now');
});

test('Usage using `waitUntil` to test unsettled state', async function(assert) {
await visit('/signup-example');

assert.ok(find('.signup-example-form'), 'The signup form is displayed');
fillIn('.signup-example-form__email', 'some@email.com');
fillIn('.signup-example-form__password', '123123');
fillIn('.signup-example-form__password-confirmation', '123123');
let submitPromise = click('.signup-example-form__submit-btn');

await waitUntil(() => find('.dashbord-loading-substate-header'));
assert.equal(find('.dashbord-loading-substate-header').textContent.trim(), 'Loading data for your dashboard. Please be patient.');

await submitPromise;
assert.ok(find('.dashboard-example-header'), 'We are on the dashboard now');
});
}

0 comments on commit cc7d1a9

Please sign in to comment.