Reputation: 23
When running a series of acceptance tests, only the first one will correctly work. All those who follow will not even render the DOM. I've tried looking for the reason but haven't been able to find a solution yet. To clarify, all acceptance tests but the first will only render
<div id="ember-testing" class="ember-application"></div>
as root element with nothing in it. I've left one of the tests below to give some insight. All other acceptance tests are very similar to this one.
import { visit, fillIn, click, pauseTest } from '@ember/test-helpers';
import { setupApplicationTest } from 'ember-qunit';
import { worker } from 'atlas/mocks/browser';
// @ts-ignore
import { authenticateSession, invalidateSession } from 'ember-simple-auth/test-support';
import { addWeekdays } from 'atlas/components/financial-document/edit/component';
import moment from 'moment';
module('Acceptance | sales invoice test', function (hooks) {
setupApplicationTest(hooks);
let sleep = (ms: any) => new Promise((resolve) => setTimeout(resolve, ms));
test('visiting /login', async function (assert) {
await worker.start();
await authenticateSession({
authToken: '12345',
otherData: 'some-data',
});
await visit('/sales-invoice/new');
await sleep(500);
await pauseTest();
//enter company into sales-invoice
await click('[data-test="company"] .ember-power-select-trigger');
await fillIn(' .ember-power-select-search-input', 'th');
await sleep(500);
await click('.ember-power-select-option');
await sleep(500);
//testing
assert.dom('[data-test="financialDocument"]').hasAnyText();
assert.dom('[data-test="canBeDirectDebitAlert"]').hasAnyText();
assert.dom('[data-test="directDebitDate"] input').hasValue(addWeekdays(moment(), 3).format('YYYY-MM-DD'));
});
});```
Upvotes: 1
Views: 133